A dynamic implementation of the IBuffer interface.
More...
#include <DynamicBuffer.h>
A dynamic implementation of the IBuffer interface.
This class represents a buffer of bytes that can be resized dynamically, providing a flexible way to interact with variable-sized data.
Example
Here's an example of how you might use a CDynamicBuffer:
const char *
buffer = buf.buffer();
size_t bufferSize = buf.size();
buf.reallocate(2048);
bufferSize = buf.size();
A dynamic implementation of the IBuffer interface.
Definition: DynamicBuffer.h:27
const char * buffer() const override
Get a constant pointer to the start of the buffer.
Definition: DynamicBuffer.h:75
◆ CDynamicBuffer() [1/3]
| Devel::IO::CDynamicBuffer::CDynamicBuffer |
( |
const size_t |
i_nSize | ) |
|
Overloaded constructor.
- Parameters
-
| i_nSize | The initial size of the buffer. |
◆ CDynamicBuffer() [2/3]
| Devel::IO::CDynamicBuffer::CDynamicBuffer |
( |
const CDynamicBuffer & |
i_oOther | ) |
|
|
inline |
Copy constructor.
- Parameters
-
| i_oOther | The object to copy from. |
◆ CDynamicBuffer() [3/3]
| Devel::IO::CDynamicBuffer::CDynamicBuffer |
( |
CDynamicBuffer && |
i_oOther | ) |
|
|
inlinenoexcept |
Move constructor.
- Parameters
-
| i_oOther | The object to move from. |
◆ allocatedSize()
| size_t Devel::IO::CDynamicBuffer::allocatedSize |
( |
| ) |
const |
|
inline |
Get the total allocated size of the buffer.
- Returns
- The total allocated size of the buffer.
◆ buffer()
| const char* Devel::IO::CDynamicBuffer::buffer |
( |
| ) |
const |
|
inlineoverridevirtual |
Get a constant pointer to the start of the buffer.
- Returns
- A const char pointer to the buffer.
Implements Devel::IO::IBuffer.
◆ operator=() [1/2]
| void Devel::IO::CDynamicBuffer::operator= |
( |
CDynamicBuffer && |
i_oOther | ) |
|
|
inlinenoexcept |
Move assignment operator.
- Parameters
-
| i_oOther | The object to move from. |
This function will take over the state of another CDynamicBuffer, leaving the other object in a safe, but undefined state.
◆ operator=() [2/2]
| void Devel::IO::CDynamicBuffer::operator= |
( |
const CDynamicBuffer & |
i_oOther | ) |
|
|
inline |
Copy assignment operator.
- Parameters
-
| i_oOther | The object to copy from. |
This function will copy the state of another CDynamicBuffer, allocating memory as necessary.
◆ operator[]()
| const char& Devel::IO::CDynamicBuffer::operator[] |
( |
const size_t |
i_nIndex | ) |
|
|
inline |
Array access operator.
- Parameters
-
| i_nIndex | The index of the byte to retrieve. |
- Exceptions
-
| IndexOutOfRangeException | If the provided index is greater than the size of the buffer, this function will throw an IndexOutOfRangeException. |
- Returns
- The byte at the specified index.
◆ rawBuffer()
| char* Devel::IO::CDynamicBuffer::rawBuffer |
( |
| ) |
const |
|
inlineoverridevirtual |
Get a mutable pointer to the start of the buffer.
- Returns
- A char pointer to the buffer.
Implements Devel::IO::IBuffer.
◆ reallocate()
| void Devel::IO::CDynamicBuffer::reallocate |
( |
const size_t |
i_nSize | ) |
|
Reallocate the buffer to a new size.
- Parameters
-
| i_nSize | The new size for the buffer. |
◆ size()
| size_t Devel::IO::CDynamicBuffer::size |
( |
| ) |
const |
|
inlineoverridevirtual |
The documentation for this class was generated from the following files:
- /home/runner/work/devel-library/devel-library/IO/Buffer/DynamicBuffer/DynamicBuffer.h
- /home/runner/work/devel-library/devel-library/IO/Buffer/DynamicBuffer/DynamicBuffer.cpp