SWC-DB  v0.5.12 C++ documentations
SWC-DB© (Super Wide Column Database) - High Performance Scalable Database (https://github.com/kashirin-alex/swc-db)
Serialization.h File Reference
+ Include dependency graph for Serialization.h:
+ This graph shows which files directly or indirectly include this file:

Go to the source code of this file.


 The SWC-DB C++ namespace 'SWC'.
 The SWC-DB Serializations C++ namespace 'SWC::Serialization'.


#define SWC_THROW_OVERRUN(_s_)    SWC_THROWF(Error::SERIALIZATION_INPUT_OVERRUN, "Error decoding %s", _s_)
#define SWC_THROW_UNPOSSIBLE(_s_)    SWC_THROWF(Error::UNPOSSIBLE, "%s", _s_)
#define SWC_ENCODE_VI_0(_p_, _v_)    if(_v_ <= MAX_V1B) { **_p_ = _v_; ++*_p_; return; }
#define SWC_ENCODE_VI_1(_p_, _v_)
#define SWC_ENCODE_VI(_p_, _v_, _shifts_)
#define SWC_DECODE_VI_(_v_, _tmp_, _p_, _shift_)
#define SWC_DECODE_VI_1(_v_, _tmp_, _p_, _r_, _shift_)
#define SWC_DECODE_VI(_t_, _p_, _r_, _bits_, _name_)


SWC_CAN_INLINE void SWC::Serialization::memcopy (void *dest, const uint8_t **bufp, size_t len) noexcept
SWC_CAN_INLINE void SWC::Serialization::memcopy (uint8_t **bufp, const void *src, size_t len) noexcept
constexpr SWC_CAN_INLINE void SWC::Serialization::decode_needed_one (size_t *remainp)
constexpr SWC_CAN_INLINE void SWC::Serialization::decode_needed (size_t *remainp, size_t len)
constexpr SWC_CAN_INLINE void SWC::Serialization::encode_i8 (uint8_t **bufp, uint8_t val) noexcept
constexpr SWC_CAN_INLINE uint8_t SWC::Serialization::decode_i8 (const uint8_t **bufp, size_t *remainp)
constexpr SWC_CAN_INLINE uint8_t SWC::Serialization::decode_byte (const uint8_t **bufp, size_t *remainp)
constexpr SWC_CAN_INLINE void SWC::Serialization::encode_bool (uint8_t **bufp, bool bval) noexcept
constexpr SWC_CAN_INLINE bool SWC::Serialization::decode_bool (const uint8_t **bufp, size_t *remainp)
SWC_CAN_INLINE void SWC::Serialization::encode_i16 (uint8_t **bufp, uint16_t val) noexcept
SWC_CAN_INLINE uint16_t SWC::Serialization::decode_i16 (const uint8_t **bufp, size_t *remainp)
SWC_CAN_INLINE void SWC::Serialization::encode_i24 (uint8_t **bufp, uint24_t val) noexcept
SWC_CAN_INLINE uint24_t SWC::Serialization::decode_i24 (const uint8_t **bufp, size_t *remainp)
SWC_CAN_INLINE void SWC::Serialization::encode_i32 (uint8_t **bufp, uint32_t val) noexcept
SWC_CAN_INLINE uint32_t SWC::Serialization::decode_i32 (const uint8_t **bufp, size_t *remainp)
SWC_CAN_INLINE void SWC::Serialization::encode_i64 (uint8_t **bufp, uint64_t val) noexcept
SWC_CAN_INLINE uint64_t SWC::Serialization::decode_i64 (const uint8_t **bufp, size_t *remainp)
constexpr SWC_CAN_INLINE uint8_t SWC::Serialization::encoded_length_vi24 (uint24_t val) noexcept
constexpr SWC_CAN_INLINE void SWC::Serialization::encode_vi24 (uint8_t **bufp, uint24_t val)
constexpr SWC_CAN_INLINE uint24_t SWC::Serialization::decode_vi24 (const uint8_t **bufp, size_t *remainp)
constexpr SWC_CAN_INLINE uint24_t SWC::Serialization::decode_vi24 (const uint8_t **bufp)
constexpr SWC_CAN_INLINE uint8_t SWC::Serialization::encoded_length_vi32 (uint32_t val) noexcept
constexpr SWC_CAN_INLINE void SWC::Serialization::encode_vi32 (uint8_t **bufp, uint32_t val)
constexpr SWC_CAN_INLINE uint32_t SWC::Serialization::decode_vi32 (const uint8_t **bufp, size_t *remainp)
constexpr SWC_CAN_INLINE uint32_t SWC::Serialization::decode_vi32 (const uint8_t **bufp)
constexpr SWC_CAN_INLINE uint8_t SWC::Serialization::encoded_length_vi64 (uint64_t val) noexcept
constexpr SWC_CAN_INLINE void SWC::Serialization::encode_vi64 (uint8_t **bufp, uint64_t val)
constexpr SWC_CAN_INLINE uint64_t SWC::Serialization::decode_vi64 (const uint8_t **bufp, size_t *remainp)
constexpr SWC_CAN_INLINE uint64_t SWC::Serialization::decode_vi64 (const uint8_t **bufp)
template<uint8_t BITS, uint8_t SZ, typename T >
SWC_CAN_INLINE void SWC::Serialization::encode_fixed_vi (uint8_t **bufp, T val) noexcept
template<uint8_t BITS, uint8_t SZ, typename T >
SWC_CAN_INLINESWC::Serialization::decode_fixed_vi (const uint8_t **bufp) noexcept
constexpr SWC_CAN_INLINE uint8_t SWC::Serialization::encoded_length_fixed_vi24 (uint24_t val) noexcept
SWC_CAN_INLINE void SWC::Serialization::encode_fixed_vi24 (uint8_t **bufp, uint24_t val) noexcept
SWC_CAN_INLINE uint24_t SWC::Serialization::decode_fixed_vi24 (const uint8_t **bufp, size_t *remainp)
SWC_CAN_INLINE uint24_t SWC::Serialization::decode_fixed_vi24 (const uint8_t **bufp)
constexpr SWC_CAN_INLINE uint8_t SWC::Serialization::encoded_length_fixed_vi32 (uint32_t val) noexcept
SWC_CAN_INLINE void SWC::Serialization::encode_fixed_vi32 (uint8_t **bufp, uint32_t val) noexcept
SWC_CAN_INLINE uint32_t SWC::Serialization::decode_fixed_vi32 (const uint8_t **bufp, size_t *remainp)
SWC_CAN_INLINE uint32_t SWC::Serialization::decode_fixed_vi32 (const uint8_t **bufp)
constexpr SWC_CAN_INLINE uint8_t SWC::Serialization::encoded_length_fixed_vi64 (uint64_t val) noexcept
SWC_CAN_INLINE void SWC::Serialization::encode_fixed_vi64 (uint8_t **bufp, uint64_t val) noexcept
SWC_CAN_INLINE uint64_t SWC::Serialization::decode_fixed_vi64 (const uint8_t **bufp, size_t *remainp)
SWC_CAN_INLINE uint64_t SWC::Serialization::decode_fixed_vi64 (const uint8_t **bufp)
constexpr SWC_CAN_INLINE uint8_t SWC::Serialization::encoded_length_double () noexcept
SWC_CAN_INLINE void SWC::Serialization::encode_double (uint8_t **bufp, long double val) noexcept
SWC_CAN_INLINE long double SWC::Serialization::decode_double (const uint8_t **bufp, size_t *remainp)
constexpr SWC_CAN_INLINE size_t SWC::Serialization::encoded_length_bytes (size_t len) noexcept
SWC_CAN_INLINE void SWC::Serialization::encode_bytes (uint8_t **bufp, const void *data, size_t len)
constexpr SWC_CAN_INLINE const uint8_t * SWC::Serialization::decode_bytes (const uint8_t **bufp, size_t *remainp, size_t *lenp)
SWC_CAN_INLINE std::string SWC::Serialization::decode_bytes_string (const uint8_t **bufp, size_t *remainp)
SWC_CAN_INLINE void SWC::Serialization::encode_bytes_fixed (uint8_t **bufp, const void *data, uint32_t len) noexcept
constexpr SWC_CAN_INLINE const uint8_t * SWC::Serialization::decode_bytes_fixed (const uint8_t **bufp, size_t *remainp, uint32_t len)


constexpr const uint64_t SWC::Serialization::MAX_V1B = 0x7f
constexpr const uint64_t SWC::Serialization::MAX_V2B = 0x3fff
constexpr const uint64_t SWC::Serialization::MAX_V3B = 0x1fffff
constexpr const uint64_t SWC::Serialization::MAX_V4B = 0x0fffffff
constexpr const uint64_t SWC::Serialization::MAX_V5B = 0x07ffffffff
constexpr const uint64_t SWC::Serialization::MAX_V6B = 0x03ffffffffff
constexpr const uint64_t SWC::Serialization::MAX_V7B = 0x01ffffffffffff
constexpr const uint64_t SWC::Serialization::MAX_V8B = 0x00ffffffffffffff
constexpr const uint64_t SWC::Serialization::MAX_V9B = 0x7fffffffffffffff
constexpr const uint8_t SWC::Serialization::MAX_LEN_VINT24 = 4
constexpr const uint8_t SWC::Serialization::MAX_LEN_VINT32 = 5
constexpr const uint8_t SWC::Serialization::MAX_LEN_VINT64 = 10

Macro Definition Documentation


#define SWC_DECODE_NEED_BYTE (   _r_)
"Zero byte remain need 1 byte"); \

Definition at line 176 of file Serialization.h.


#define SWC_DECODE_VI (   _t_,
_t_ n = 0; _t_ tmp; for(uint8_t shift=0; *_r_ ; shift+=7) { \
--*_r_; SWC_DECODE_VI_(n, tmp, _p_, shift); \
if(shift == _bits_) SWC_THROW_OVERRUN(_name_); \
} \
"Zero byte remain need 1 byte");

Definition at line 189 of file Serialization.h.


#define SWC_DECODE_VI_ (   _v_,
_v_ |= (_tmp_ = **_p_ & 0x7f) <<= _shift_; \
_tmp_ = **_p_ & 0x80; ++*_p_; if(!tmp) return _v_;

Definition at line 181 of file Serialization.h.


#define SWC_DECODE_VI_1 (   _v_,
SWC_DECODE_VI_(_v_, _tmp_, _p_, _shift_);

Definition at line 185 of file Serialization.h.


#define SWC_ENCODE_VI (   _p_,
SWC_ENCODE_VI_0(_p_, _v_); \
for(uint8_t n=0; n < _shifts_; ++n) { SWC_ENCODE_VI_1(_p_, _v_); } \
SWC_THROW_UNPOSSIBLE("breached encoding length");

Definition at line 170 of file Serialization.h.


#define SWC_ENCODE_VI_0 (   _p_,
)     if(_v_ <= MAX_V1B) { **_p_ = _v_; ++*_p_; return; }

Definition at line 163 of file Serialization.h.


#define SWC_ENCODE_VI_1 (   _p_,
**_p_ = _v_ | 0x80; ++*_p_; _v_ >>= 7; \
SWC_ENCODE_VI_0(_p_, _v_);

Definition at line 166 of file Serialization.h.


#define SWC_THROW_OVERRUN (   _s_)     SWC_THROWF(Error::SERIALIZATION_INPUT_OVERRUN, "Error decoding %s", _s_)

Definition at line 27 of file Serialization.h.


#define SWC_THROW_UNPOSSIBLE (   _s_)     SWC_THROWF(Error::UNPOSSIBLE, "%s", _s_)

Definition at line 30 of file Serialization.h.

#define SWC_DECODE_VI_(_v_, _tmp_, _p_, _shift_)
Definition: Serialization.h:181
Definition: Serialization.h:176
#define SWC_THROW(_code_, _msg_)
Definition: Exception.h:134
Definition: Error.h:61
#define SWC_ENCODE_VI_1(_p_, _v_)
Definition: Serialization.h:166
#define SWC_ENCODE_VI_0(_p_, _v_)
Definition: Serialization.h:163
#define SWC_THROW_OVERRUN(_s_)
Definition: Serialization.h:27