Object Management Trickery
These functions are to construct and destruct objects in memory without causing a free or malloc call to occur.
Classes:
Enumerations
DFILE_STATUS { DFILE_OK = 1 }
Typedefs
void *
FILE_HANDLE
Functions
T *
constructArrayInPlace(T * p, U32 num)
T *
constructInPlace(T * p)
Constructs an object that already has memory allocated for it.
T *
constructInPlace(T * p, const T * copy)
Copy constructs an object that already has memory allocated for it.
T *
constructInPlace(T * ptr, T2 t2)
T *
constructInPlace(T * ptr, T2 t2, T3 t3)
T *
constructInPlace(T * ptr, T2 t2, T3 t3, T4 t4)
T *
constructInPlace(T * ptr, T2 t2, T3 t3, T4 t4, T5 t5)
dCopyArray(T * dst, const S * src, dsize_t size)
destructInPlace(T * p)
Destructs an object without freeing the memory associated with it.
dFileClose(FILE_HANDLE handle)
bool
dFileDelete(const char * name)
dFileRead(FILE_HANDLE handle, U32 bytes, char * dst, DFILE_STATUS & error)
bool
dFileRename(const char * oldName, const char * newName)
bool
dFileTouch(const char * name)
dFileWrite(FILE_HANDLE handle, U32 bytes, const char * dst, DFILE_STATUS & error)
dFree_aligned(void * p)
void *
dMalloc_aligned(dsize_t in_size, S32 alignment)
dOpenFileRead(const char * name, DFILE_STATUS & error)
dOpenFileReadWrite(const char * name, bool append, DFILE_STATUS & error)
void *
dRealMalloc(dsize_t in_size)
operator delete(void * ptr)
operator delete[](void * ptr)
setMinimumAllocUnit(U32 allocUnit)
Defines
_new() (__FILE__, __LINE__)
dALIGN(decl) decl
The dALIGN macro ensures the passed declaration is data aligned at 16 byte boundaries.
dMalloc(x) (x, __FILE__, __LINE__)
dRealloc(x, y) (x, y, __FILE__, __LINE__)
new()
TORQUE_TMM_ARGS() , fileName, lineNum
TORQUE_TMM_ARGS_DECL() , char* fileName, lineNum
Memory functions.
TORQUE_TMM_LOC() , __FILE__, __LINE__
Detailed Description
These functions are to construct and destruct objects in memory without causing a free or malloc call to occur.
This is so that we don't have to worry about allocating, say, space for a hundred NetAddresses with a single malloc call, calling delete on a single NetAdress, and having it try to free memory out from under us.
Enumerations
DFILE_STATUS
Enumerator
- DFILE_OK = 1
Typedefs
typedef void * FILE_HANDLE
Functions
constructArrayInPlace(T * p, U32 num)
constructInPlace(T * p)
Constructs an object that already has memory allocated for it.
constructInPlace(T * p, const T * copy)
Copy constructs an object that already has memory allocated for it.
constructInPlace(T * ptr, T2 t2)
constructInPlace(T * ptr, T2 t2, T3 t3)
constructInPlace(T * ptr, T2 t2, T3 t3, T4 t4)
constructInPlace(T * ptr, T2 t2, T3 t3, T4 t4, T5 t5)
dCopyArray(T * dst, const S * src, dsize_t size)
dCopyArray(T * dst, const T * src, dsize_t size)
destructInPlace(T * p)
Destructs an object without freeing the memory associated with it.
dFileClose(FILE_HANDLE handle)
dFileDelete(const char * name)
dFileRead(FILE_HANDLE handle, U32 bytes, char * dst, DFILE_STATUS & error)
dFileRename(const char * oldName, const char * newName)
dFileTouch(const char * name)
dFileWrite(FILE_HANDLE handle, U32 bytes, const char * dst, DFILE_STATUS & error)
dFree(const void * p)
dFree(void * in_pFree)
dFree_aligned(void * p)
dMalloc_aligned(dsize_t in_size, S32 alignment)
dMalloc_r(dsize_t in_size, const char * fileName, const dsize_t)
dMemcmp(const void * ptr1, const void * ptr2, dsize_t size)
dMemcpy(void * dst, const void * src, dsize_t size)
dMemmove(void * dst, const void * src, dsize_t size)
dMemset(void * dst, S32 c, dsize_t size)
dOpenFileRead(const char * name, DFILE_STATUS & error)
dOpenFileReadWrite(const char * name, bool append, DFILE_STATUS & error)
dPathCopy(const char * fromName, const char * toName, bool nooverwrite)
dRealFree(void * in_pFree)
dRealloc_r(void * in_pResize, dsize_t in_size, const char * fileName, const dsize_t)
dRealMalloc(dsize_t in_size)
operator delete(void * ptr)
operator delete[](void * ptr)
operator new(dsize_t size, const char * fileName, const U32)
operator new[](dsize_t size, const char * fileName, const U32)
osGetTemporaryDirectory()
setBreakAlloc(dsize_t )
setMinimumAllocUnit(U32 allocUnit)
Defines
_new() (__FILE__, __LINE__)
dALIGN(decl) decl
The dALIGN macro ensures the passed declaration is data aligned at 16 byte boundaries.
dALIGN_BEGIN()
dALIGN_END()
dMalloc(x) (x, __FILE__, __LINE__)
dRealloc(x, y) (x, y, __FILE__, __LINE__)
new()
TORQUE_TMM_ARGS() , fileName, lineNum
TORQUE_TMM_ARGS_DECL() , char* fileName, lineNum
Memory functions.
TORQUE_TMM_LOC() , __FILE__, __LINE__