odtone::buffer
// In header: </home/carlos/Projectos/odtone/inc/odtone/buffer.hpp> template<typename T> class buffer { public: // construct/copy/destruct buffer(); buffer(buffer &); buffer(buffer &&); buffer(size_t); buffer& operator=(const buffer &); buffer& operator=(buffer &&); ~buffer(); // private member functions ODTONE_STATIC_ASSERT(boost::is_pod< T >::value, "T must be POD type"); // public member functions void size(size_t); void zero(); T * get(); const T * get() const; size_t size() const; };
A container for data of a specific data type with linear and finite sequence of elements.
buffer
public
construct/copy/destructbuffer();
Construct an empty buffer. The created buffer will be empty and with zero length.
buffer(buffer & buff);
Construct a buffer. The new created buffer will be a copy of another buffer.
Parameters: |
|
buffer(buffer && buff);
Construct a buffer. The new created buffer will be a copy of another buffer.
Parameters: |
|
buffer(size_t len);
Construct an empty buffer. Although the created buffer is empty, it has the length defined at its creation.
Parameters: |
|
buffer& operator=(const buffer &);
buffer& operator=(buffer && buff);
Copy the elements from another buffer. The elements contained in the buffer will be overwrited.
Parameters: |
|
||
Returns: |
The reference to the buffer. |
~buffer();
Destruct a buffer.
buffer
public member functionsvoid size(size_t len);
Set the number of elements the buffer can store.
Parameters: |
|
void zero();
Remove all stored elements from the buffer.
T * get();
Get the pointer to the first element of the buffer.
Returns: |
The pointer to the first element of the buffer. |
const T * get() const;
Get the pointer to the first element of the buffer.
Returns: |
The pointer to the first element of the buffer. |
size_t size() const;
Get the number of elements the buffer can store.
Returns: |
The number of elements the buffer can store. |