Utility

module. More...

Classes

class  Proud::CAngleFollower
 
class  Proud::ByteArray
 
class  Proud::ByteArrayPtr
 
class  Proud::CriticalSection
 
class  Proud::CriticalSectionLock
 The object that 'lock accesses' CriticalSection object. More...
 
class  Proud::CCryptoAes
 
class  Proud::CCryptoAesKey
 
class  Proud::CCryptoRsaKey
 
class  Proud::CCryptoRsa
 
class  Proud::ILogWriterDelegate
 
class  Proud::CDbLogParameter
 
class  Proud::CDbLogWriter
 
class  Proud::Deque< T >
 
class  Proud::Event
 
class  Proud::Exception
 
class  Proud::CArrayWithExternalBuffer< TYPE, TYPE_IN_REF, RAWTYPE, INDEXTYPE >
 
class  Proud::IClonable
 
class  Proud::Timer
 
class  Proud::Random
 
struct  FastArray_Traits< T, T_IN_REF >
 
struct  Proud::FastArray_Traits< T, true >
 
struct  Proud::FastArray_Traits< T, false >
 
class  Proud::CFastArray< T, T_IN_REF, RAWTYPE, INDEXTYPE >
 
class  Proud::CFastHeap
 
class  Proud::CFastHeapSettings
 
class  Proud::CFastList< E, ETraits >
 
class  Proud::CFastMap< K, V, KTraits, VTraits >
 
class  Proud::CFastSet< K, KTraits >
 
class  Proud::CFixedLengthArray< size, TYPE, ARG_TYPE >
 
class  Proud::CListNode< T >
 
class  Proud::CLookasideAllocator
 
class  Proud::CMilisecTimer
 
class  Proud::CRoundRobinNumberGenerator
 
class  Proud::CCrc
 
class  Proud::AnsiStrTraits
 
class  Proud::UnicodeStrTraits
 
class  Proud::Thread
 
class  Proud::CPositionFollower
 
class  Proud::CFirstHeap
 
class  Proud::CProcHeap
 
class  Proud::CMemoryHeap
 
class  Proud::CHeldPtr< T >
 
class  Proud::SmartPtr< T >
 
class  Proud::RefCount< T >
 
class  Proud::CVirtualAllocPage< T >
 
class  Proud::CQuantizer
 
class  Proud::CRandom
 
class  Proud::Semaphore
 
class  Proud::JitObjectCreator< T >
 
class  Proud::CSingleton< T >
 
class  Proud::CStringEncoder
 
struct  Proud::PN_OVERLAPPED_ENTRY
 
class  Proud::CKernel32Api
 
class  Proud::CLocale
 
class  Proud::CSystemInfo
 
struct  Proud::NewTimerParam
 
class  Proud::CTimerQueue
 
class  Proud::CTimerQueueTimer
 
class  Proud::CTimerThread
 
struct  Proud::TimerEventHandle
 
class  Proud::CLogWriter
 
struct  Proud::Vector3T< FloatType >
 

Macros

#define XXXHeapChk   __noop
 

Typedefs

typedef ByteArrayPtr::Tombstone Proud::ByteArrayPtr_Tombstone
 
typedef RefCount< CCryptoRsaKey > Proud::CRsaKeyPtr
 
typedef uint16_t Proud::CryptCount
 
typedef RefCount
< CLookasideAllocator > 
Proud::CLookasideAllocatorPtr
 
typedef unsigned int Proud::Crc32
 
typedef char Proud::AnsiStrTraits::CharType
 
typedef wchar_t Proud::UnicodeStrTraits::CharType
 
typedef RefCount< Thread > Proud::ThreadPtr
 
typedef HANDLE(WINAPI * Proud::CreateIoCompletionPortProc )(HANDLE FileHandle, HANDLE ExistingCompletionPort, ULONG_PTR CompletionKey, uint32_t NumberOfConcurrentThreads)
 
typedef HEAP_INFORMATION_CLASS Proud::HeapInformationClass
 
typedef HEAP_INFORMATION_CLASS
PVOID 
Proud::HeapInformation
 
typedef HEAP_INFORMATION_CLASS
PVOID size_t 
Proud::HeapInformationLength
 
typedef PVOID Proud::Context
 
typedef PVOID uint32_t Proud::Flags
 
typedef LPDWORD Proud::lpNumberOfBytesTransferred
 
typedef LPDWORD PULONG_PTR Proud::lpCompletionKey
 
typedef LPDWORD PULONG_PTR
LPOVERLAPPED * 
Proud::lpOverlapped
 
typedef LPDWORD PULONG_PTR
LPOVERLAPPED uint32_t 
Proud::dwMilliseconds
 
typedef PN_OVERLAPPED_ENTRY * Proud::lpCompletionPortEntries
 
typedef PN_OVERLAPPED_ENTRY
uint32_t 
Proud::ulCount
 
typedef PN_OVERLAPPED_ENTRY
uint32_t PULONG 
Proud::ulNumEntriesRemoved
 
typedef PN_OVERLAPPED_ENTRY
uint32_t PULONG uint32_t BOOL 
Proud::fAlertable
 
typedef PVECTORED_EXCEPTION_HANDLER Proud::VectoredHandler
 
typedef BOOL(WINAPI * Proud::GetLogicalProcessorInformation )(PSYSTEM_LOGICAL_PROCESSOR_INFORMATION Buffer, PDWORD ReturnLength)
 
typedef BOOLEAN Proud::TimerOrWaitFired
 
typedef HANDLE Proud::TimerQueue
 
typedef HANDLE
WaitOrTimerCallbackProc 
Proud::Callback
 
typedef HANDLE
WaitOrTimerCallbackProc PVOID 
Proud::Parameter
 
typedef HANDLE
WaitOrTimerCallbackProc PVOID
uint32_t 
Proud::DueTime
 
typedef HANDLE
WaitOrTimerCallbackProc PVOID
uint32_t uint32_t 
Proud::Period
 
typedef HANDLE Proud::Timer
 
typedef HANDLE HANDLE Proud::CompletionEvent
 
typedef uint32_t Proud::dwSpinCount
 
typedef Vector3T< double > Proud::Vector3
 
typedef Vector3T< float > Proud::FloatVector3
 

Enumerations

enum  Proud::ExceptionType {
  Proud::ExceptionType_None = 0, Proud::ExceptionType_String, Proud::ExceptionType_Std, Proud::ExceptionType_ComError,
  Proud::ExceptionType_Void, Proud::ExceptionType_ErrorInfo, Proud::ExceptionType_Unhandled, Proud::ExceptionType_Clr
}
 
enum  Proud::GrowPolicy { Proud::GrowPolicy_Normal, Proud::GrowPolicy_HighSpeed, Proud::GrowPolicy_LowMemory }
 
enum  Proud::FastHeapAccessMode { Proud::FastHeapAccessMode_UnsafeSingleThread, Proud::FastHeapAccessMode_MultiThreaded }
 

Functions

PROUD_API void * Proud::ByteArrayPtr_AllocTombstone ()
 
PROUD_API void Proud::ByteArrayPtr_FreeTombstone (void *tombstone)
 
void Proud::XXXHeapChkImpl (int index=1)
 
PROUD_API void Proud::ThrowArrayIsNullError ()
 
template<typename T >
T * Proud::FastHeap_NewInstance (CFastHeap *heap)
 
template<typename T >
void Proud::FastHeap_DeleteInstance (CFastHeap *heap, T *obj)
 
PROUD_API int64_t Proud::GetPreciseCurrentTimeMs ()
 
PROUD_API int64_t Proud::GetEpochTimeMs ()
 
template<typename T >
Proud::Lerp (T v1, T v2, T ratio)
 
template<typename T >
Proud::LerpInt (T v1, T v2, T ratio1, T ratio2)
 
static PROUD_API int Proud::AnsiStrTraits::SafeStringLen (const CharType *str)
 
static PROUD_API void Proud::AnsiStrTraits::CopyString (CharType *dest, int destNumOfElements, const CharType *src, int length)
 
static PROUD_API int Proud::AnsiStrTraits::StringCompare (const CharType *a, const CharType *b)
 
static int Proud::AnsiStrTraits::StringCompareNoCase (const CharType *a, const CharType *b)
 
static PROUD_API int Proud::AnsiStrTraits::GetFormattedLength (const char *pszFormat, va_list args)
 
static PROUD_API int __cdecl Proud::AnsiStrTraits::Format (char *pszBuffer, size_t nlength, const char *pszFormat, va_list args) throw ()
 
static PROUD_API char * Proud::AnsiStrTraits::StringUppercase (char *psz, size_t size) throw ()
 
static PROUD_API char * Proud::AnsiStrTraits::StringLowercase (char *psz, size_t size) throw ()
 
static PROUD_API const char
*__cdecl 
Proud::AnsiStrTraits::StringFindString (const char *pszBlock, const char *pszMatch) throw ()
 
static PROUD_API char *__cdecl Proud::AnsiStrTraits::StringFindString (char *pszBlock, const char *pszMatch) throw ()
 
static PROUD_API const char
*__cdecl 
Proud::AnsiStrTraits::StringFindChar (const char *pszBlock, char chMatch) throw ()
 
static PROUD_API int __cdecl Proud::AnsiStrTraits::StringSpanIncluding (const char *pszBlock, const char *pszSet) throw ()
 
static PROUD_API int __cdecl Proud::AnsiStrTraits::StringSpanExcluding (const char *pszBlock, const char *pszSet) throw ()
 
static PROUD_API char *__cdecl Proud::AnsiStrTraits::CharNext (const char *p) throw ()
 
static PROUD_API int __cdecl Proud::AnsiStrTraits::IsDigit (char ch) throw ()
 
static PROUD_API int __cdecl Proud::AnsiStrTraits::IsSpace (char ch) throw ()
 
template<typename PNSTRING >
static void Proud::AnsiStrTraits::ToStdString (const PNSTRING &src, std::string &dest)
 
template<typename PNSTRING >
static void Proud::AnsiStrTraits::ToStdWString (const PNSTRING &src, std::wstring &dest)
 
template<typename PNSTRING >
static void Proud::AnsiStrTraits::FromStdString (const std::string &src, PNSTRING &dest)
 
template<typename PNSTRING >
static void Proud::AnsiStrTraits::FromStdWString (const std::wstring &src, PNSTRING &dest)
 
static PROUD_API int Proud::UnicodeStrTraits::SafeStringLen (const CharType *str)
 
static PROUD_API void Proud::UnicodeStrTraits::CopyString (CharType *dest, int destNumOfElements, const CharType *src, int length)
 
static PROUD_API int Proud::UnicodeStrTraits::StringCompare (const CharType *a, const CharType *b)
 
static PROUD_API int Proud::UnicodeStrTraits::StringCompareNoCase (const CharType *a, const CharType *b)
 
static PROUD_API int Proud::UnicodeStrTraits::GetFormattedLength (const wchar_t *pszFormat, va_list args)
 
static PROUD_API int __cdecl Proud::UnicodeStrTraits::Format (wchar_t *pszBuffer, size_t nLength, const wchar_t *pszFormat, va_list args) throw ()
 
static PROUD_API wchar_t * Proud::UnicodeStrTraits::StringUppercase (wchar_t *psz, size_t size) throw ()
 
static PROUD_API wchar_t * Proud::UnicodeStrTraits::StringLowercase (wchar_t *psz, size_t size) throw ()
 
static PROUD_API const wchar_t
*__cdecl 
Proud::UnicodeStrTraits::StringFindString (const wchar_t *pszBlock, const wchar_t *pszMatch) throw ()
 
static PROUD_API wchar_t *__cdecl Proud::UnicodeStrTraits::StringFindString (wchar_t *pszBlock, const wchar_t *pszMatch) throw ()
 
static PROUD_API const wchar_t
*__cdecl 
Proud::UnicodeStrTraits::StringFindChar (const wchar_t *pszBlock, wchar_t chMatch) throw ()
 
static PROUD_API int __cdecl Proud::UnicodeStrTraits::StringSpanIncluding (const wchar_t *pszBlock, const wchar_t *pszSet) throw ()
 
static PROUD_API int __cdecl Proud::UnicodeStrTraits::StringSpanExcluding (const wchar_t *pszBlock, const wchar_t *pszSet) throw ()
 
static PROUD_API wchar_t *__cdecl Proud::UnicodeStrTraits::CharNext (const wchar_t *psz) throw ()
 
static PROUD_API int __cdecl Proud::UnicodeStrTraits::IsDigit (wchar_t ch) throw ()
 
static PROUD_API int __cdecl Proud::UnicodeStrTraits::IsSpace (wchar_t ch) throw ()
 
template<typename PNSTRING >
static void Proud::UnicodeStrTraits::ToStdString (const PNSTRING &src, std::string &dest)
 
template<typename PNSTRING >
static void Proud::UnicodeStrTraits::ToStdWString (const PNSTRING &src, std::wstring &dest)
 
template<typename PNSTRING >
static void Proud::UnicodeStrTraits::FromStdString (const std::string &src, PNSTRING &dest)
 
template<typename PNSTRING >
static void Proud::UnicodeStrTraits::FromStdWString (const std::wstring &src, PNSTRING &dest)
 
template<typename T >
bool Proud::operator< (const CHeldPtr< T > a, const CHeldPtr< T > b)
 
template<typename T >
Proud::GetRandomElement (const CFastArray< T > &arr)
 
template<typename T >
Proud::GetRandomElement (const std::vector< T > &arr)
 
void Proud::iconv_string_convert (CStringEncoder *encoder, const char *input, size_t *inbytesleft, char *out, size_t *outbytesleft)
 
PROUD_API void Proud::USleep (long uSec)
 
PROUD_API void Proud::FindFiles (const String &directory, const String &searchFilter, CFastArray< String > &output)
 
PROUD_API uint32_t Proud::GetNoofProcessors ()
 
PROUD_API String Proud::GetProcessName ()
 
PROUD_API uint64_t Proud::GetCurrentThreadID ()
 
PROUD_API void Proud::ShowUserMisuseError (const PNTCHAR *text)
 
PROUD_API void Proud::TraceA (const char *format,...)
 
size_t Proud::GetOccupiedPhysicalMemory ()
 
size_t Proud::GetTotalPhysicalMemory ()
 
String Proud::GetComputerName ()
 
PROUD_API bool Proud::EnableLowFragmentationHeap ()
 
PROUD_API String Proud::GetCurrentProgramDirectory ()
 
PROUD_API void Proud::SetCurrentDirectoryWhereProgramExists ()
 
PROUD_API int Proud::SetCurrentDirectory (const PNTCHAR *directoryName)
 
PROUD_API int64_t Proud::GetCurrentProcessId ()
 
PROUD_API bool Proud::GetFileLastWriteTime (const PNTCHAR *fileName, std::time_t &output)
 
PROUD_API StringA Proud::UntabifyText (const StringA &text)
 
PROUD_API StringA Proud::ReadTextFile (const char *fileName)
 
PROUD_API bool Proud::CreateTempDirectory (const PNTCHAR *prefix, String &output)
 
PROUD_API bool Proud::FileExists (const PNTCHAR *fileName)
 
bool Proud::IsServiceMode ()
 
bool Proud::IsGqcsExSupported ()
 
bool Proud::IsHyperThreading ()
 
uint32_t Proud::CountSetBits (uintptr_t bitMask)
 
typedef Proud::BOOL (WINAPI *HeapSetInformationProc)(HANDLE HeapHandle
 
typedef Proud::PVOID (WINAPI *AddVectoredExceptionHandlerProc)(uint32_t FirstHandler
 
String Proud::GetFullPath (const PNTCHAR *fileName)
 
bool Proud::CreateFullDirectory (const PNTCHAR *lpPathName, String &outCreatedDirectory)
 
String Proud::GetCurrentDirectory ()
 
typedef Proud::VOID (NTAPI *WaitOrTimerCallbackProc)(PVOID lpParameter
 
typedef Proud::HANDLE (WINAPI *CreateTimerQueueProc)(VOID)
 
bool Proud::GetWindowsVersion (DWORD &major, DWORD &minor, DWORD &servicePack)
 
 Proud::DECLARE_DLL_SINGLETON (PROUD_API, CLocale)
 
 Proud::DECLARE_DLL_SINGLETON (PROUD_API, CSystemInfo)
 
PROUD_API int Proud::GetTotalThreadCount ()
 
DWORD Proud::GetThreadStatus (HANDLE const handle)
 
PROUD_API void Proud::SetThreadName (uint32_t dwThreadID, const char *szThreadName)
 
PROUD_API HANDLE Proud::GetCurrentRealThread ()
 
 Proud::DECLARE_DLL_SINGLETON (PROUD_API, CTimerQueue)
 
template<typename FloatType >
FloatType Proud::ScalarLerp (const FloatType v1, const FloatType v2, const FloatType ratio)
 
template<typename FloatType >
Vector3T< FloatType > Proud::operator* (FloatType scale, const struct Vector3T< FloatType > &src)
 

Variables

PROUD_API const char * Proud::ExternalBufferArrayIsUninitializedError
 
PROUD_API const char * Proud::ExternalBufferArrayIsInitializedError
 
const char * Proud::CannotUseFastHeapForFilledCollectionErrorText
 
const char * Proud::ArrayPtrIsNullError
 
const char * Proud::ArrayPtrIsNotNullError
 
const char * Proud::MustInternalBufferError
 
const char * Proud::MustNotExternalBufferError
 
const char * Proud::MustUnsafeInternalBufferError
 
PROUD_API const char * Proud::AlreadyHasInternalBufferError
 
const char * Proud::AlreadyHasUnsafeInternalBufferError
 
PROUD_API const char * Proud::AlreadyHasExternalBufferError
 

Detailed Description

module.

Please refer to Utility Programs of ProudNet for more information of

Typedef Documentation

typedef RefCount<Thread> Proud::ThreadPtr

Smart pointer of thread object.

Enumeration Type Documentation

Exception Type object

  • You can get pointer and information of exception object by classifying type.
Enumerator
ExceptionType_None 

None

ExceptionType_String 

Exception that created by Exception(LPCWSTR pFormat, ...);

ExceptionType_Std 

Exception that created by Exception(std::exception& src);

ExceptionType_ComError 

Exception that created by Exception(_com_error& src);

ExceptionType_Void 

Exception that created by Exception(void* src);

ExceptionType_ErrorInfo 

Exception that created by Exception(ErrorInfo* src);

ExceptionType_Unhandled 

UnhandleException that created by Exception()

ExceptionType_Clr 

Exception occurred in the managed code in case of using a CLR.

This is how to access Fast Heap.

Enumerator
FastHeapAccessMode_UnsafeSingleThread 

Only 1 tread accesses to Fast Heap but the inside of Fast Heap is not Thread safe. This setting must be used when there is a guarantee that onl 1 thread accessed to Fast Heap.!

FastHeapAccessMode_MultiThreaded 

This operates safely even if multiple threads accee to Fast Heap. And has a way to utilize all of CPU cores.

The weight type when the size of the array of this object.

Enumerator
GrowPolicy_Normal 

Balance

GrowPolicy_HighSpeed 

High performance but use more memory

GrowPolicy_LowMemory 

Save memory but when array size is increased, it shows low performance because of overload of copying

Function Documentation

uint32_t Proud::CountSetBits ( uintptr_t  bitMask)

Check the number with the bit as 1.

Parameters
bitMaskParameter to check the bit.
Returns
Number with the bit as 1.
bool Proud::CreateFullDirectory ( const PNTCHAR *  lpPathName,
String &  outCreatedDirectory 
)

Generate a directory and get the full path.

PROUD_API bool Proud::EnableLowFragmentationHeap ( )

As the feature supported only in Window XP and 2003, it uses low-fragmentation heap.

  • When you use this, the heap access speed increases dramatically in SMP environment. Of course, you also get the benefits of low-fragmentation. Therefore, we strongly recommend you to use this if possible.
  • This method is not supported in Windows 98, etc. and in this case, this method does not do anything. However, errors do not occur when an essential Win32 API is not searched in Window 98.
PROUD_API bool Proud::FileExists ( const PNTCHAR *  fileName)

파일이 존재하는지?

PROUD_API void Proud::FindFiles ( const String &  directory,
const String &  searchFilter,
CFastArray< String > &  output 
)

Find files that match fileNameWithWildcard(e.g. xxx*.txt) to output.

String Proud::GetComputerName ( )

Get the computer name.

String Proud::GetCurrentDirectory ( )

Get the current directory.

PROUD_API HANDLE Proud::GetCurrentRealThread ( )

Gets the real handle of this thread

PROUD_API uint64_t Proud::GetCurrentThreadID ( )
Returns current thread ID.
  • win32 kinds: same to ::GetCurrentThreadId().
  • unix kinds: same to pthread_self().
PROUD_API int64_t Proud::GetEpochTimeMs ( )

epoch 즉 1970-1-1부터의 지난 시간(밀리초)를 구합니다.

PROUD_API bool Proud::GetFileLastWriteTime ( const PNTCHAR *  fileName,
std::time_t &  output 
)
파일의 마지막 업데이트 시간을 리턴합니다.

성공시 true 리턴 및 output에 값이 채워집니다.

String Proud::GetFullPath ( const PNTCHAR *  fileName)

Get the absolute pathname of the file. If it is already the absolute pathname, return as it is.

size_t Proud::GetOccupiedPhysicalMemory ( )

Calculate the physical memory occupancy rate

PROUD_API int64_t Proud::GetPreciseCurrentTimeMs ( )

Gets very precise "current time". 1ms resolution. the time cost of this function is a critical section lock.

PROUD_API String Proud::GetProcessName ( )

Get the name of the process.

DWORD Proud::GetThreadStatus ( HANDLE const  handle)

Gain the condition of that thead currently.

size_t Proud::GetTotalPhysicalMemory ( )

Calculate the total memory

PROUD_API int Proud::GetTotalThreadCount ( )

Gain the number of whole threads which is used in process now.

bool Proud::IsGqcsExSupported ( )

Check whether it can be used. It is known that it can only be used in Server2008 or higher.

Returns
1 if usable, otherwise 0.
bool Proud::IsHyperThreading ( )

Check whether it supports HyperThreading.

bool Proud::IsServiceMode ( )

Check whether the current process is being executed in service mode.

Returns
1 if service mode, otherwise 0.
template<typename T >
T Proud::Lerp ( v1,
v2,
ratio 
)
inline

Obtains a interior division ratio of two values of v1,v2, v1->v2. As ratio gets closer to 0, it gets closer to v1.

template<typename T >
T Proud::LerpInt ( v1,
v2,
ratio1,
ratio2 
)
inline

TODO:translate needed. Integer version of Lerp. Numerator of the ratio is ratio 1. Denominator is ratio 2.

template<typename FloatType >
FloatType Proud::ScalarLerp ( const FloatType  v1,
const FloatType  v2,
const FloatType  ratio 
)
inline

Get a ratio of interior division of v1 and v2 by v1 -> v2. As ratio is closer to 0, it's closer to v1.

PROUD_API void Proud::SetCurrentDirectoryWhereProgramExists ( )

Look for the folder where this program is being run and set as the current directory.

  • In this case, the media file is searched properly even this program is run in other directories.
PROUD_API void Proud::SetThreadName ( uint32_t  dwThreadID,
const char *  szThreadName 
)

Designates a name to thread. By doing so, each thread will have their names shown at debugger thread view.

  • Debugging will be easier.
  • Please refer ms-help://MS.VSCC.2003/MS.MSDNQTR.2003APR.1033/vsdebug/html/vxtskSettingThreadName.htm
PROUD_API void Proud::ShowUserMisuseError ( const PNTCHAR *  text)

This is an error shown only when a ProudNet user makes a mistake.

PROUD_API void Proud::TraceA ( const char *  format,
  ... 
)

Prints text for debugging to debugger output window or console, without newline.

typedef Proud::VOID ( NTAPI *  WaitOrTimerCallbackProc)

Timer user callback function

  • An application-defined function that serves as the starting address for a timer callback or a registered wait callback. Specify this address when calling the CreateTimerQueueTimer, RegisterWaitForSingleObject function.

The WaitOrTimerCallbackProc type defines a pointer to this callback function. WaitOrTimerCallback is a placeholder for the application-defined function name.

Parameters
[in]lpParameterThe thread data passed to the function using a parameter of the CreateTimerQueueTimer or RegisterWaitForSingleObject function.
TimerOrWaitFiredIf this parameter is TRUE, the wait timed out. If this parameter is FALSE, the wait event has been signaled. (This parameter is always TRUE for timer callbacks.)