Public Member Functions | |
Constructor / Destructor | |
CP_Malloc () | |
Constructor. | |
CP_Malloc (UInt32 inSize) | |
CP_Malloc (CP_Malloc &inPtrBlock) | |
~CP_Malloc () | |
Destructor. | |
Copying | |
void | CopyTo (void *ioBuffer, UInt32 inNumBytes) const |
void | CopyFrom (const void *inBuffer, UInt32 inNumBytes) |
Getters | |
char * | GetPtr () const |
Length | |
UInt32 | Length () const |
void | SetLength (UInt32 inLength) |
Operators | |
CP_Malloc & | operator= (const CP_Malloc &inPtrBlock) |
Testers | |
bool | IsValid () const |
bool | OwnsPtr () const |
Wrapping | |
void | Wrap (char *inExistingPtr, bool inOwnsPtr=true) |
void | Detach () |
Protected Attributes | |
char * | fBlock |
bool | fOwnsPtr |
UInt32 | fActualBlockLength |
Private Member Functions | |
Allocation | |
void | Allocate (UInt32 inSize) |
void | Deallocate () |
|
Constructor.
|
|
Constructor.
|
|
Copy constructor.
|
|
Destructor.
|
|
Copies the passed in number of bytes of this memory block to the passed in destination buffer. The copy will start at the beginning of the memory block.
|
|
Copies the passed in number of bytes from the passed in buffer to this block of memory, starting at the first byte of this memory block.
|
|
Returns the pointer to the memory block of this object. Will implicitely lock the block, so you'll need to call Unlock() before you can resize the block.
|
|
Returns the length of this memory block.
|
|
Set the length of the memory block. This will cause the platforms memory block to be resized to accommodate these changes.
|
|
Assignment operator. This will cause the memory of the source block to be copied into a new block.
|
|
Returns true if the memory block is not NULL.
|
|
Returns true if this object owns the block of memory, and is therefore responsible for its deletion. Otherwise the memory block held by this object will not be deleted by this class.
|
|
Wrap ourselves around an existing platforms OSPtr. If inOwnsPtr is true, then this object takes over ownership of the OSPtr and will be responsible for deleting the memory.
|
|
Notifies this class that it no longer owns the memory, and will not delete it. You are now responsible for deleting the memory to avoid a memory leak.
|
|
Private routine to handle the allocation of the platforms memory block.
|
|
Private routine to handle the deallocation of the platforms memory block. This will only happen if this object owns the allocated memory, otherwise you are responsible for the deallocation of the memory.
|
|
|
|
Points to the allocated memory. |
|
Flag to indicate who is responsible for deleting the platforms memory. |