Runtime serializer type-erased handle. Traversal logic is shared with compile-time serialization, while raw I/O is delegated through function pointers bound to a concrete serializer instance. This is a binary traversal API. JSON document I/O uses ser::ser_json.
More...
#include <ser_rt.h>
|
| | serializer (const serializer_ctx &ctx) |
| | Creates a serializer from an existing callback context.
|
| |
| GAIA_NODISCARD bool | valid () const |
| | Checks whether mandatory backend callbacks are bound.
|
| |
| template<typename T > |
| void | save (const T &arg) |
| | Serializes a value through generic traversal.
|
| |
| template<typename T > |
| void | load (T &arg) |
| | Deserializes a value through generic traversal.
|
| |
| template<typename T > |
| void | save_raw (const T &value) |
| | Writes the object representation of a typed value.
|
| |
| template<typename T > |
| void | load_raw (T &value) |
| | Reads an object representation into a typed value.
|
| |
| void | save_raw (const void *src, uint32_t size, serialization_type_id id) |
| | Writes raw bytes through the bound backend.
|
| |
| void | load_raw (void *src, uint32_t size, serialization_type_id id) |
| | Reads raw bytes through the bound backend.
|
| |
| GAIA_NODISCARD const char * | data () const |
| | Returns the backend data pointer when exposed.
|
| |
|
void | reset () |
| | Resets the backend when supported.
|
| |
| GAIA_NODISCARD uint32_t | tell () const |
| | Returns the current backend cursor.
|
| |
| GAIA_NODISCARD uint32_t | bytes () const |
| | Returns the backend byte count when exposed.
|
| |
| void | seek (uint32_t pos) |
| | Moves the backend cursor.
|
| |
|
| template<typename TSerializer > |
| static serializer_ctx | bind_ctx (TSerializer &obj) |
| | Creates a callback context bound to a concrete backend.
|
| |
| template<typename TSerializer > |
| static serializer | bind (TSerializer &obj) |
| | Creates a runtime serializer bound to a concrete backend.
|
| |
Runtime serializer type-erased handle. Traversal logic is shared with compile-time serialization, while raw I/O is delegated through function pointers bound to a concrete serializer instance. This is a binary traversal API. JSON document I/O uses ser::ser_json.
◆ serializer()
Creates a serializer from an existing callback context.
- Parameters
-
| ctx | Backend context to copy. |
◆ bind()
template<typename TSerializer >
| static serializer gaia::ser::serializer::bind |
( |
TSerializer & |
obj | ) |
|
|
inlinestatic |
Creates a runtime serializer bound to a concrete backend.
- Template Parameters
-
- Parameters
-
| obj | Backend instance that must outlive the serializer. |
- Returns
- Bound runtime serializer.
◆ bind_ctx()
template<typename TSerializer >
| static serializer_ctx gaia::ser::serializer::bind_ctx |
( |
TSerializer & |
obj | ) |
|
|
inlinestatic |
Creates a callback context bound to a concrete backend.
- Template Parameters
-
- Parameters
-
| obj | Backend instance that must outlive the context. |
- Returns
- Type-erased callback context.
◆ bytes()
| GAIA_NODISCARD uint32_t gaia::ser::serializer::bytes |
( |
| ) |
const |
|
inline |
Returns the backend byte count when exposed.
- Returns
- Byte count, or zero when unsupported.
◆ data()
| GAIA_NODISCARD const char * gaia::ser::serializer::data |
( |
| ) |
const |
|
inline |
Returns the backend data pointer when exposed.
- Returns
- Backing data pointer, or null when unsupported.
◆ load()
template<typename T >
| void gaia::ser::serializer::load |
( |
T & |
arg | ) |
|
|
inline |
Deserializes a value through generic traversal.
- Template Parameters
-
- Parameters
-
| [out] | arg | Destination value. |
◆ load_raw() [1/2]
template<typename T >
| void gaia::ser::serializer::load_raw |
( |
T & |
value | ) |
|
|
inline |
Reads an object representation into a typed value.
- Template Parameters
-
- Parameters
-
| [out] | value | Destination value. |
◆ load_raw() [2/2]
| void gaia::ser::serializer::load_raw |
( |
void * |
src, |
|
|
uint32_t |
size, |
|
|
serialization_type_id |
id |
|
) |
| |
|
inline |
Reads raw bytes through the bound backend.
- Parameters
-
| [out] | src | Destination bytes. |
| size | Number of bytes. |
| id | Serialization representation. |
◆ save()
template<typename T >
| void gaia::ser::serializer::save |
( |
const T & |
arg | ) |
|
|
inline |
Serializes a value through generic traversal.
- Template Parameters
-
- Parameters
-
◆ save_raw() [1/2]
template<typename T >
| void gaia::ser::serializer::save_raw |
( |
const T & |
value | ) |
|
|
inline |
Writes the object representation of a typed value.
- Template Parameters
-
- Parameters
-
◆ save_raw() [2/2]
| void gaia::ser::serializer::save_raw |
( |
const void * |
src, |
|
|
uint32_t |
size, |
|
|
serialization_type_id |
id |
|
) |
| |
|
inline |
Writes raw bytes through the bound backend.
- Parameters
-
| src | Source bytes. |
| size | Number of bytes. |
| id | Serialization representation. |
◆ seek()
| void gaia::ser::serializer::seek |
( |
uint32_t |
pos | ) |
|
|
inline |
Moves the backend cursor.
- Parameters
-
| pos | Absolute byte position. |
◆ tell()
| GAIA_NODISCARD uint32_t gaia::ser::serializer::tell |
( |
| ) |
const |
|
inline |
Returns the current backend cursor.
- Returns
- Cursor position in bytes.
◆ valid()
| GAIA_NODISCARD bool gaia::ser::serializer::valid |
( |
| ) |
const |
|
inline |
Checks whether mandatory backend callbacks are bound.
- Returns
- True when save, load, tell, and seek are available.
The documentation for this struct was generated from the following file:
- /home/runner/work/gaia-ecs/gaia-ecs/include/gaia/ser/ser_rt.h