Templated memory buffer class for element buffers of fixed capacity. More...
#include <r8bbase.h>
Public Member Functions | |
| CFixedBuffer (const int Capacity) | |
| Constructor allocates memory so that the specified number of elements of type T can be stored in this buffer object. | |
| void | alloc (const int Capacity) |
| Allocates memory so that the specified number of elements of type T can be stored in this buffer object. | |
| void | free () |
| Deallocates a previously allocated buffer. | |
| operator T* () const | |
Returns pointer to the first element of the allocated buffer, nullptr, if not allocated. | |
| void | realloc (const int PrevCapacity, const int NewCapacity) |
| Reallocates memory so that the specified number of elements of type T can be stored in this buffer object. Previously allocated data is copied to the new memory buffer. | |
Templated memory buffer class for element buffers of fixed capacity.
Fixed memory buffer object. Supports allocation of a fixed amount of memory. Does not store buffer's capacity - the user should know the actual capacity of the buffer. Does not feature "internal" storage, memory is always allocated via the R8B_MEMALLOCCLASS class's functions. Thus the object of this class can be moved in memory.
This class manages memory space only - it does not perform element class construction nor destruction operations.
This class applies 64-byte memory address alignment to the allocated data block.
| T | The type of the stored elements (e.g., double). |
| r8b::CFixedBuffer< T >::CFixedBuffer | ( | const int | Capacity | ) |
Constructor allocates memory so that the specified number of elements of type T can be stored in this buffer object.
| Capacity | Storage for this number of elements to allocate. |
| void r8b::CFixedBuffer< T >::alloc | ( | const int | Capacity | ) |
Allocates memory so that the specified number of elements of type T can be stored in this buffer object.
| Capacity | Storage for this number of elements to allocate. |
| void r8b::CFixedBuffer< T >::realloc | ( | const int | PrevCapacity, |
| const int | NewCapacity ) |
Reallocates memory so that the specified number of elements of type T can be stored in this buffer object. Previously allocated data is copied to the new memory buffer.
| PrevCapacity | Previous capacity of this buffer. |
| NewCapacity | Storage for this number of elements to allocate. |