FrontPanel API 5.3.6
|
Fixed size buffer used for passing data to/from script functions. More...
Public Member Functions | |
Buffer () | |
Default constructor creates an empty buffer. | |
Buffer (size_t size) | |
Allocates the specified amount of memory for the buffer. | |
Buffer (void *ptr, size_t size) | |
Buffer (const Buffer &buf) | |
Buffer & | operator= (const Buffer &buf) |
bool | IsEmpty () const |
Return true if the buffer is empty. | |
size_t | GetSize () const |
Return the fixed size of the buffer, possibly 0 if it is empty. | |
unsigned char * | GetData () const |
Buffers are reference counted, meaning that while they can be assigned to each other, the assignment is shallow and all copies of the same buffer share the same data.
A buffer can either allocate and own its own memory or use some existing memory preallocated by the caller.
OpalKelly::Buffer::Buffer | ( | void * | ptr, |
size_t | size ) |
Creates a buffer using the specified chunk of memory.
The buffer will not free ptr and it should remain valid for the entire life-time of the buffer (including any of its copies).
OpalKelly::Buffer::Buffer | ( | const Buffer & | buf | ) |
Create a shallow copy of the buffer.
Any modifications done to this buffer will also affect the original one.
unsigned char * OpalKelly::Buffer::GetData | ( | ) | const |
Get direct access to the buffer contents.
Returns NULL
if and only if the buffer is empty.