CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
Macros | Functions
IceMemoryMacros.h File Reference
#include <cstring>

Go to the source code of this file.

Macros

#define CHECKALLOC(x)
 
#define DELETEARRAY(x)
 Deletes an array. More...
 
#define DELETESINGLE(x)
 Deletes an instance of a class. More...
 
#define SAFE_ALLOC(ptr, type, count)
 Standard allocation cycle. More...
 
#define SAFE_DESTRUCT(x)
 Safe ICE-style release. More...
 
#define SAFE_RELEASE(x)
 Safe D3D-style release. More...
 
#define SIZEOFOBJECT   sizeof(*this)
 Gives the size of current object. Avoid some mistakes (e.g. "sizeof(this)"). More...
 

Functions

void CopyMemory (void *dest, const void *src, udword size)
 
void FillMemory (void *dest, udword size, ubyte val)
 
void MoveMemory (void *dest, const void *src, udword size)
 
void ZeroMemory (void *addr, udword size)
 

Detailed Description

Contains all memory macros.

Author
Pierre Terdiman
Date
April, 4, 2000

Definition in file IceMemoryMacros.h.

Macro Definition Documentation

#define CHECKALLOC (   x)
Value:
if (!x) \
return false;
float x

Definition at line 128 of file IceMemoryMacros.h.

Referenced by RadixSort::Resize().

#define DELETEARRAY (   x)
Value:
if (x) { \
operator delete[](x); \
x = 0; \
}
float x

Deletes an array.

Definition at line 95 of file IceMemoryMacros.h.

Referenced by RadixSort::RelinquishRanks(), RadixSort::Resize(), and RadixSort::~RadixSort().

#define DELETESINGLE (   x)
Value:
if (x) { \
delete x; \
x = 0; \
}
float x

Deletes an instance of a class.

Definition at line 86 of file IceMemoryMacros.h.

#define SAFE_ALLOC (   ptr,
  type,
  count 
)
Value:
DELETEARRAY(ptr); \
ptr = new type[count]; \
#define DELETEARRAY(x)
Deletes an array.
#define CHECKALLOC(x)

Standard allocation cycle.

Definition at line 134 of file IceMemoryMacros.h.

#define SAFE_DESTRUCT (   x)
Value:
if (x) { \
(x)->SelfDestruct(); \
(x) = 0; \
}
float x

Safe ICE-style release.

Definition at line 113 of file IceMemoryMacros.h.

#define SAFE_RELEASE (   x)
Value:
if (x) { \
(x)->release(); \
(x) = 0; \
}
float x

Safe D3D-style release.

Definition at line 104 of file IceMemoryMacros.h.

#define SIZEOFOBJECT   sizeof(*this)

Gives the size of current object. Avoid some mistakes (e.g. "sizeof(this)").

Definition at line 84 of file IceMemoryMacros.h.

Function Documentation

void CopyMemory ( void *  dest,
const void *  src,
udword  size 
)
inline

Copies a buffer.

Parameters
addr[in] destination buffer address
addr[in] source buffer address
size[in] buffer length
See Also
ZeroMemory
FillMemory
StoreDwords
MoveMemory

Definition at line 72 of file IceMemoryMacros.h.

72 { memcpy(dest, src, size); }
tuple size
Write out results.
void FillMemory ( void *  dest,
udword  size,
ubyte  val 
)
inline

Fills a buffer with a given byte.

Parameters
addr[in] buffer address
size[in] buffer length
val[in] the byte value
See Also
StoreDwords
ZeroMemory
CopyMemory
MoveMemory

Definition at line 39 of file IceMemoryMacros.h.

39 { memset(dest, val, size); }
tuple size
Write out results.
void MoveMemory ( void *  dest,
const void *  src,
udword  size 
)
inline

Moves a buffer.

Parameters
addr[in] destination buffer address
addr[in] source buffer address
size[in] buffer length
See Also
ZeroMemory
FillMemory
StoreDwords
CopyMemory

Definition at line 82 of file IceMemoryMacros.h.

82 { memmove(dest, src, size); }
tuple size
Write out results.
void ZeroMemory ( void *  addr,
udword  size 
)
inline

Clears a buffer.

Parameters
addr[in] buffer address
size[in] buffer length
See Also
FillMemory
StoreDwords
CopyMemory
MoveMemory

Definition at line 29 of file IceMemoryMacros.h.

29 { memset(addr, 0, size); }
tuple size
Write out results.