#include <Buffer.h>
TSP-enforcing: Yes
Definition at line 31 of file Buffer.h.
Public Member Functions | |
CPKIFBuffer () | |
CPKIFBuffer (const unsigned char *buf, unsigned int bufLen) | |
CPKIFBuffer (bool takeOwnership, unsigned char *buf, unsigned int bufLen) | |
CPKIFBuffer (const CPKIFBuffer &data) | |
virtual | ~CPKIFBuffer () |
unsigned char * | AllocateBuffer (int len) |
added implementation 05/06/2003 | |
const unsigned char * | GetBuffer () const |
unsigned int | GetLength () const |
bool | operator== (const CPKIFBuffer &rhs) |
bool | operator!= (const CPKIFBuffer &rhs) |
CPKIFBuffer::CPKIFBuffer | ( | ) |
Interface: External
Several constructors are provided. The first creates an empty CPKIFBuffer object. The second, third and fourth create a CPKIFBuffer containing a copy of the data passed as parameters. The fifth provides a means of transferring (or not) ownership of an existing buffer to a CPKIFBuffer object. When takeOwnership is set to true, the new instance of CPKIFBuffer will assume responsibility for the pointer passed via buf an will free the pointer by a call to delete when the CPKIFBuffer object is destroyed (and, thus, must have been allocated on the same heap). When takeOwnership is set to false, the new instance of CPKIFBuffer simply copies the pointer value and references the application-provided buffer directly without calling delete upon destruction.
Callers must ensure that a correct length value is provided to constructor variants that accept parameters. If NULL is passed as a buffer value or 0 is passed as a buffer length value, the new instance will be created with NULL for the Buffer property and 0 for the Length property.
Definition at line 40 of file Buffer.cpp.
CPKIFBuffer::CPKIFBuffer | ( | const unsigned char * | buf, | |
unsigned int | bufLen | |||
) |
Interface: External
Several constructors are provided. The first creates an empty CPKIFBuffer object. The second, third and fourth create a CPKIFBuffer containing a copy of the data passed as parameters. The fifth provides a means of transferring (or not) ownership of an existing buffer to a CPKIFBuffer object. When takeOwnership is set to true, the new instance of CPKIFBuffer will assume responsibility for the pointer passed via buf an will free the pointer by a call to delete when the CPKIFBuffer object is destroyed (and, thus, must have been allocated on the same heap). When takeOwnership is set to false, the new instance of CPKIFBuffer simply copies the pointer value and references the application-provided buffer directly without calling delete upon destruction.
Callers must ensure that a correct length value is provided to constructor variants that accept parameters. If NULL is passed as a buffer value or 0 is passed as a buffer length value, the new instance will be created with NULL for the Buffer property and 0 for the Length property.
buf | [in] The data to store in the new CPKIFBuffer |
bufLen | [in] The length of buf |
Definition at line 110 of file Buffer.cpp.
CPKIFBuffer::CPKIFBuffer | ( | bool | takeOwnership, | |
unsigned char * | buf, | |||
unsigned int | bufLen | |||
) |
takeOwnership = true means the CPKIFBuffer class will destroy the buffer takeOwnership = false means the CPKIFBuffer class will make a copy
Interface: External
Several constructors are provided. The first creates an empty CPKIFBuffer object. The second, third and fourth create a CPKIFBuffer containing a copy of the data passed as parameters. The fifth provides a means of transferring (or not) ownership of an existing buffer to a CPKIFBuffer object. When takeOwnership is set to true, the new instance of CPKIFBuffer will assume responsibility for the pointer passed via buf an will free the pointer by a call to delete when the CPKIFBuffer object is destroyed (and, thus, must have been allocated on the same heap). When takeOwnership is set to false, the new instance of CPKIFBuffer simply copies the pointer value and references the application-provided buffer directly without calling delete upon destruction.
Callers must ensure that a correct length value is provided to constructor variants that accept parameters. If NULL is passed as a buffer value or 0 is passed as a buffer length value, the new instance will be created with NULL for the Buffer property and 0 for the Length property.
takeOwnership | [in] Boolean indicating whether to transfer ownership of the buffer pointed to by buf to the new object |
buf | [in] The data to store in the new CPKIFBuffer |
bufLen | [in] The length of buf |
Definition at line 63 of file Buffer.cpp.
CPKIFBuffer::CPKIFBuffer | ( | const CPKIFBuffer & | data | ) |
Interface: External
Several constructors are provided. The first creates an empty CPKIFBuffer object. The second, third and fourth create a CPKIFBuffer containing a copy of the data passed as parameters. The fifth provides a means of transferring (or not) ownership of an existing buffer to a CPKIFBuffer object. When takeOwnership is set to true, the new instance of CPKIFBuffer will assume responsibility for the pointer passed via buf an will free the pointer by a call to delete when the CPKIFBuffer object is destroyed (and, thus, must have been allocated on the same heap). When takeOwnership is set to false, the new instance of CPKIFBuffer simply copies the pointer value and references the application-provided buffer directly without calling delete upon destruction.
Callers must ensure that a correct length value is provided to constructor variants that accept parameters. If NULL is passed as a buffer value or 0 is passed as a buffer length value, the new instance will be created with NULL for the Buffer property and 0 for the Length property.
data | [in] A CPKIFBuffer object to copy |
Definition at line 147 of file Buffer.cpp.
References m_impl.
CPKIFBuffer::~CPKIFBuffer | ( | ) | [virtual] |
Interface: External
The function destroys an instance of CPKIFBuffer
Definition at line 171 of file Buffer.cpp.
unsigned char * CPKIFBuffer::AllocateBuffer | ( | int | len | ) |
added implementation 05/06/2003
Interface: External
This function allocates a buffer inside a CPKIFBuffer object and returns a pointer to that buffer. Care must be taken when using this function, particularly if the object is shared as a CPKIFBufferPtr.
Destroys previously allocated buffer and allocates a new buffer of desired size. All pointers to the buffer are effected when this function is invoked, i.e. if there are two smart pointers to the same CPKIFBuffer object both will be effected when allocateBuffer is invoked on one of them.
len | [in] The length of the buffer to allocate |
Definition at line 260 of file Buffer.cpp.
Referenced by WriteCB().
const unsigned char * CPKIFBuffer::GetBuffer | ( | ) | const |
Interface: External
This function returns a const pointer to the internal buffer managed by the instance of CPKIFBuffer. This pointer is valid only for the life of the CPKIFBuffer object from which it was obtained, or until allocateBuffer is called on that object.
Definition at line 193 of file Buffer.cpp.
Referenced by WriteCB().
unsigned int CPKIFBuffer::GetLength | ( | ) | const |
Interface: External
This function returns the length of the data maintained in the internal buffer, e.g. the buffer available via a call to GetBuffer.
Definition at line 204 of file Buffer.cpp.
Referenced by WriteCB().
bool CPKIFBuffer::operator== | ( | const CPKIFBuffer & | rhs | ) |
Interface: External
This function returns true if the value held by the object passed via the rhs parameter is the same, i.e. binary comparison, as the value held by the object on which this function was invoked and false otherwise.
added 12/6/2003
both equal zero
rhs | [in] Reference to a smart pointer to a CPKIFBuffer object containing the buffer to compare |
Definition at line 218 of file Buffer.cpp.
References m_impl.
Referenced by operator!=().
bool CPKIFBuffer::operator!= | ( | const CPKIFBuffer & | rhs | ) |
Interface: External
This function returns true if the value held by the object passed via the rhs parameter is not the same as the value held by the object on which this function was invoked and false otherwise.
rhs | [in] Reference to a smart pointer to a CPKIFBuffer object containing the buffer to compare |
Definition at line 240 of file Buffer.cpp.
References operator==().