25 #ifndef SER4CPP_ENDIANHELPERS_H 26 #define SER4CPP_ENDIANHELPERS_H 28 #include "ser4cpp/serialization/SerializationTemplates.h" 29 #include "ser4cpp/util/Uncopyable.h" 34 template <
class Int16Type,
class UInt16Type,
class Int32Type,
class UInt32Type,
class Int64Type,
class UInt64Type>
39 template <
class T,
typename... Args>
40 static bool read(
rseq_t& input, T& value, Args& ... args)
42 return read_one(input, value) && read(input, args...);
45 template <
class T,
typename... Args>
46 static bool write(
wseq_t& dest,
const T& value,
const Args& ... args)
48 return write_one(dest, value) && write(dest, args...);
52 static inline bool read(
rseq_t& input)
57 static inline bool read_one(
rseq_t& input, uint8_t& out)
59 return UInt8::read_from(input, out);
62 static inline bool read_one(
rseq_t& input, int16_t& out)
64 return Int16Type::read_from(input, out);
67 static inline bool read_one(
rseq_t& input, uint16_t& out)
69 return UInt16Type::read_from(input, out);
72 static inline bool read_one(
rseq_t& input, int32_t& out)
74 return Int32Type::read_from(input, out);
77 static inline bool read_one(
rseq_t& input, uint32_t& out)
79 return UInt32Type::read_from(input, out);
82 static inline bool read_one(
rseq_t& input, int64_t& out)
84 return Int64Type::read_from(input, out);
87 static inline bool read_one(
rseq_t& input, uint64_t& out)
89 return UInt64Type::read_from(input, out);
92 static inline bool write(
wseq_t& dest)
97 static inline bool write_one(
wseq_t& dest,
const uint8_t& value)
99 return UInt8::write_to(dest, value);
102 static inline bool write_one(
wseq_t& dest,
const int16_t& value)
104 return Int16Type::write_to(dest, value);
107 static inline bool write_one(
wseq_t& dest,
const uint16_t& value)
109 return UInt16Type::write_to(dest, value);
112 static inline bool write_one(
wseq_t& dest,
const int32_t& value)
114 return Int32Type::write_to(dest, value);
117 static inline bool write_one(
wseq_t& dest,
const uint32_t& value)
119 return UInt32Type::write_to(dest, value);
122 static inline bool write_one(
wseq_t& dest,
const int64_t& value)
124 return Int64Type::write_to(dest, value);
127 static inline bool write_one(
wseq_t& dest,
const uint64_t& value)
129 return UInt64Type::write_to(dest, value);
ser4cpp header-only library namespace