c4d_memory.h File Reference

Macros

#define __C4D_MEM_ALIGNMENT_MASK__
 
#define FillMemType(t, d, x, v)
 

Functions

UInt GeMemGetFreePhysicalMemoryEstimate ()
 
void ClearMem (void *d, Int size, Int32 value=0)
 
void CopyMem (const void *s, void *d, Int size)
 
void MemCopy (void *d, const void *s, Int size)
 
template<class T , class U >
void FillMemTypeTemplate (T *data_ptr, Int size, const U *check_type, Int32 value)
 
template<typename T >
void ClearMemType (T *data_ptr, Int cnt)
 
template<typename T >
void CopyMemType (const T *src_ptr, T *dst_ptr, Int cnt)
 

Macro Definition Documentation

◆ __C4D_MEM_ALIGNMENT_MASK__

#define __C4D_MEM_ALIGNMENT_MASK__

Memory returned by NewMem() is guaranteed to be at least aligned to a 16 byte boundary.

◆ FillMemType

#define FillMemType (   t,
  d,
  x,
 
)

Fills a block of memory of the specified type.

Parameters
[in]tData type (e.g. Char, Float).
[out]dAddress of the block of memory to fill. The caller owns the pointed memory.
[in]xSize of the memory block to fill.
[in]vValue to fill the memory block with.

Function Documentation

◆ GeMemGetFreePhysicalMemoryEstimate()

UInt GeMemGetFreePhysicalMemoryEstimate ( )

Gets estimated free physical memory.

Returns
Estimated free physical memory.

◆ ClearMem()

void ClearMem ( void *  d,
Int  size,
Int32  value = 0 
)

Clears a block of memory.

Parameters
[in]dAddress of the memory block to clear. The caller owns the pointed memory.
[in]sizeSize in bytes of the block of memory to clear.
[in]valueValue to clear the memory block with. Default to 0.

◆ CopyMem()

void CopyMem ( const void *  s,
void *  d,
Int  size 
)

Copies a block of memory.

Warning
Parameters order is the opposite of memcpy()
See also
MemCopy()
Parameters
[in]sAddress of the source block of memory. The caller owns the pointed memory.
[out]dAddress of the destination block of memory. The caller owns the pointed memory.
[in]sizeSize in bytes of the block of memory to copy.

◆ MemCopy()

void MemCopy ( void *  d,
const void *  s,
Int  size 
)

Copies a block of memory.

Parameters
[out]dAddress of the destination block of memory. The caller owns the pointed memory.
[in]sAddress of the source block of memory. The caller owns the pointed memory.
[in]sizeSize in bytes of the block of memory to copy.

◆ FillMemTypeTemplate()

void FillMemTypeTemplate ( T *  data_ptr,
Int  size,
const U *  check_type,
Int32  value 
)

Internal.

◆ ClearMemType()

void ClearMemType ( T *  data_ptr,
Int  cnt 
)

Clears a block of memory.
THREADSAFE.

Parameters
[out]data_ptrAddress of the block of memory to clear. The caller owns the pointed memory.
[in]cntNumber of elements to be filled with pattern (> 1 e.g. for arrays), can be 0.

◆ CopyMemType()

void CopyMemType ( const T *  src_ptr,
T *  dst_ptr,
Int  cnt 
)

Copies a block of memory to another of the same kind.
THREADSAFE

Warning
Source and destination must not overlap.
Parameters
[in]src_ptrAddress of the source block of memory to copy. The caller owns the pointed memory.
[out]dst_ptrAddress of the destination block of memory to copy to. The caller owns the pointed memory.
[in]cntNumber of elements to be copied (> 1 e.g. for arrays), can be 0.