Describes and writes typed data into a raw buffer with object/array hierarchy.
More...
#include <spk_buffer_layout.hpp>
|
|
using | Buffer = std::uint8_t * |
| | Raw byte buffer bound to the layout operations.
|
|
| | BufferLayout (Buffer p_buffer, std::size_t p_size) |
| | Creates a layout bound to a buffer.
|
| Element & | root () |
| | Accesses the root element.
|
| const Element & | root () const |
| | Accesses the root element.
|
| Element & | addMember (const std::wstring &p_name, std::size_t p_relativeOffset, const Element &p_member) |
| | Adds a named member to the root object.
|
| Element & | addArray (const std::wstring &p_name, std::size_t p_relativeOffset, std::size_t p_count, const Element &p_arrayElement) |
| | Adds an array to the root with explicit offset.
|
| Element & | operator[] (const std::wstring &p_name) |
| | Accesses a named child from the root.
|
| const Element & | operator[] (const std::wstring &p_name) const |
| | Accesses a named child from the root (const).
|
| void | remove (const std::wstring &p_name) |
| | Removes a named child from the root.
|
| void | resize (std::size_t p_size) |
| | Resizes the underlying buffer and updates the root size.
|
Describes and writes typed data into a raw buffer with object/array hierarchy.
std::vector<uint8_t> buf(64, 0);
layout[L"pos"].setData(glm::vec3{1.f, 2.f, 3.f});
Node within a BufferLayout representing an object, array or leaf segment.
Definition spk_buffer_layout.hpp:65
Describes and writes typed data into a raw buffer with object/array hierarchy.
Definition spk_buffer_layout.hpp:26
◆ BufferLayout()
| spk::BufferLayout::BufferLayout |
( |
Buffer | p_buffer, |
|
|
std::size_t | p_size ) |
Creates a layout bound to a buffer.
- Parameters
-
| p_buffer | Target buffer pointer. |
| p_size | Total buffer size in bytes. |
◆ addArray()
| BufferLayout::Element & spk::BufferLayout::addArray |
( |
const std::wstring & | p_name, |
|
|
std::size_t | p_relativeOffset, |
|
|
std::size_t | p_count, |
|
|
const Element & | p_arrayElement ) |
Adds an array to the root with explicit offset.
- Parameters
-
| p_name | Field name. |
| p_relativeOffset | Offset within the buffer. |
| p_count | Number of elements. |
| p_arrayElement | Prototype element layout. |
- Returns
- Reference to the inserted array.
◆ addMember()
| BufferLayout::Element & spk::BufferLayout::addMember |
( |
const std::wstring & | p_name, |
|
|
std::size_t | p_relativeOffset, |
|
|
const Element & | p_member ) |
Adds a named member to the root object.
- Parameters
-
| p_name | Field name. |
| p_relativeOffset | Offset within the buffer. |
| p_member | Child element layout. |
- Returns
- Reference to the inserted child.
◆ operator[]() [1/2]
Accesses a named child from the root.
- Parameters
-
- Returns
- Reference to the child element.
◆ operator[]() [2/2]
Accesses a named child from the root (const).
- Parameters
-
- Returns
- Const reference to the child element.
◆ remove()
| void spk::BufferLayout::remove |
( |
const std::wstring & | p_name | ) |
|
Removes a named child from the root.
- Parameters
-
◆ resize()
| void spk::BufferLayout::resize |
( |
std::size_t | p_size | ) |
|
Resizes the underlying buffer and updates the root size.
- Parameters
-
◆ root() [1/2]
Accesses the root element.
- Returns
- Mutable root element.
◆ root() [2/2]
Accesses the root element.
- Returns
- Const root element.
The documentation for this class was generated from the following files: