A wrapper around Buffer that ensures automatic release of memory when it goes out of scope.
More...
#include <Buffer.h>
A wrapper around Buffer that ensures automatic release of memory when it goes out of scope.
This class encapsulates a Buffer and ensures that the memory is released automatically when the object is destroyed. It is useful when you need to manage buffer memory in a scope-bound manner.
◆ ScopedBuffer() [1/2]
| Raven::ScopedBuffer::ScopedBuffer |
( |
Buffer | buffer | ) |
|
|
inlineexplicit |
Constructs a ScopedBuffer from a Buffer.
- Parameters
-
| buffer | The buffer to wrap in this scoped object. |
◆ ScopedBuffer() [2/2]
| Raven::ScopedBuffer::ScopedBuffer |
( |
u64 | size | ) |
|
|
inlineexplicit |
Constructs a ScopedBuffer by allocating a buffer of the specified size.
- Parameters
-
| size | The size of the buffer to allocate. |
◆ ~ScopedBuffer()
| Raven::ScopedBuffer::~ScopedBuffer |
( |
| ) |
|
|
inline |
Destructor that releases the buffer's memory.
◆ As()
template<typename T>
| T * Raven::ScopedBuffer::As |
( |
| ) |
|
|
inline |
Casts the buffer's raw data to a specific type.
- Template Parameters
-
- Returns
- A pointer to the buffer's data as type T.
◆ Data()
| u8 * Raven::ScopedBuffer::Data |
( |
| ) |
const |
|
inlinenodiscard |
Accessor for the buffer's raw data.
- Returns
- A pointer to the buffer's data.
◆ operator bool()
| Raven::ScopedBuffer::operator bool |
( |
| ) |
const |
|
inlineexplicit |
Converts the ScopedBuffer to a boolean value.
- Returns
- true if the buffer contains data, false otherwise.
◆ Size()
| u64 Raven::ScopedBuffer::Size |
( |
| ) |
const |
|
inlinenodiscard |
Accessor for the buffer's size.
- Returns
- The size of the buffer.
The documentation for this struct was generated from the following file: