Public Member Functions | |
Constructor / Destructor | |
CP_HandleBlock () | |
Constructor. | |
CP_HandleBlock (UInt32 inSize) | |
CP_HandleBlock (const CP_HandleBlock &inHandleBlock) | |
~CP_HandleBlock () throw () | |
Destructor. | |
Copying | |
void | CopyTo (void *ioBuffer, UInt32 inNumBytes) const |
void | CopyFrom (const void *inBuffer, UInt32 inNumBytes) |
Getters | |
OSHandle | GetOSHandle () const |
char * | GetPtr () const |
Length | |
UInt32 | Length () const |
void | SetLength (UInt32 inLength) |
Locking | |
void | Lock () const |
void | Unlock () const |
bool | IsLocked () const |
Operators | |
CP_HandleBlock & | operator= (const CP_HandleBlock &inHandleBlock) |
Testers | |
bool | IsValid () const |
bool | OwnsHandle () const |
Utility | |
void | Wrap (OSHandle inExistingHandle, bool inOwnsHandle=true) |
void | Detach () |
CP_HandleBlock * | Clone () |
Constructor / Destructor | |
CP_HandleBlock (Handle inMacHandle, bool inOwnsHandle=true) | |
Constructor. | |
Getters | |
operator Handle () const | |
Protected Attributes | |
OSHandle | fBlock |
bool | fOwnsHandle |
bool | fLocked |
UInt32 | fActualBlockLength |
char * | fBlockPtr |
Private Member Functions | |
Allocation | |
void | Allocate (UInt32 inSize) |
void | Deallocate () |
|
Constructor.
|
|
Constructor.
|
|
Copy constructor. Ownership of the memory block will be handled according to the inOwnershipOptions parameter.
|
|
Destructor.
|
|
Pointer to the memory when the block is locked. |
|
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 OSHandle for the memory block of this object. If this object still owns this memory, be careful not to delete the OSHandle, otherwise there will be a problem when this object tries to release the already released memory.
|
|
Returns a char * to the actual bytes of this memory. This will lock the handle for accessing, in case the underlying OS can move a handle. You are responsible for calling the Unlock() memory when done to unlock the memory.
|
|
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.
|
|
Locks the platforms OSHandle.
|
|
Unlocks the platforms OSHandle.
|
|
Returns true if the memory block is locked.
|
|
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 OSHandle. If inOwnsHandle is true, then this object takes over ownership of the OSHandle 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.
|
|
Return a new CP_HandleBlock object that is a duplicate of this one. Use this method if you want to duplicate the data inside another CP_HandleBlock object without retaining a reference to it.
|
|
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.
|
|
Returns the MacOS Handle.
|
|
|
|
Platforms memory object. |
|
Flag to indicate who is responsible for deleting the platforms memory. |
|
Flag to indicate if the block is locked. |
|
Length of the memory block. |