2#include "gaia/config/config.h"
7#include "gaia/core/utility.h"
8#include "gaia/ser/impl/ser_dispatch.h"
9#include "gaia/ser/ser_common.h"
18 template <
typename Writer,
typename T>
19 void save_one(Writer& s,
const T& arg) {
20 auto saveTrivial = [](
auto& writer,
const auto& value) {
23 save_dispatch(s, arg, saveTrivial);
26 template <
typename Reader,
typename T>
27 void load_one(Reader& s, T& arg) {
28 auto loadTrivial = [](
auto& reader,
auto& value) {
31 load_dispatch(s, arg, loadTrivial);
34#if GAIA_ASSERT_ENABLED
35 template <
typename Writer,
typename T>
36 void check_one(Writer& s,
const T& arg) {
41 const auto pos0 = s.tell();
43 const auto pos1 = s.tell();
46 GAIA_ASSERT(s.tell() == pos1);
60 m_pos += (uint32_t)
sizeof(T);
63 void save_raw(
const void*, uint32_t size, [[maybe_unused]] ser::serialization_type_id
id) {
67 void seek(uint32_t pos) {
71 GAIA_NODISCARD uint32_t tell()
const {
80 GAIA_NODISCARD uint32_t bytes(
const T& data) {
82 detail::save_one(counter, data);
83 return counter.tell();
92 template <
typename Writer,
typename T>
93 void save(Writer& writer,
const T& data) {
94 detail::save_one(writer, data);
103 template <
typename Reader,
typename T>
104 void load(Reader& reader, T& data) {
105 detail::load_one(reader, data);
108#if GAIA_ASSERT_ENABLED
116 template <
typename Writer,
typename T>
117 void check(Writer& writer,
const T& data) {
118 detail::check_one(writer, data);
Minimal writer used by ser::bytes to count produced bytes without storing data.
Definition ser_ct.h:54
Checks if endianess was detected correctly at compile-time.
Definition bitset.h:9