Dash Core Source Documentation (0.16.0.1)
Find detailed information regarding the Dash Core source code.
serialize.h
Go to the documentation of this file.
184 template<typename Stream> inline void Serialize(Stream& s, char a ) { ser_writedata8(s, a); } // TODO Get rid of bare char
186 template<typename Stream> inline void Serialize(Stream& s, uint8_t a ) { ser_writedata8(s, a); }
187 template<typename Stream> inline void Serialize(Stream& s, int16_t a ) { ser_writedata16(s, a); }
188 template<typename Stream> inline void Serialize(Stream& s, uint16_t a) { ser_writedata16(s, a); }
189 template<typename Stream> inline void Serialize(Stream& s, int32_t a ) { ser_writedata32(s, a); }
190 template<typename Stream> inline void Serialize(Stream& s, uint32_t a) { ser_writedata32(s, a); }
191 template<typename Stream> inline void Serialize(Stream& s, int64_t a ) { ser_writedata64(s, a); }
192 template<typename Stream> inline void Serialize(Stream& s, uint64_t a) { ser_writedata64(s, a); }
193 template<typename Stream> inline void Serialize(Stream& s, float a ) { ser_writedata32(s, ser_float_to_uint32(a)); }
194 template<typename Stream> inline void Serialize(Stream& s, double a ) { ser_writedata64(s, ser_double_to_uint64(a)); }
196 template<typename Stream> inline void Unserialize(Stream& s, char& a ) { a = ser_readdata8(s); } // TODO Get rid of bare char
197 template<typename Stream> inline void Unserialize(Stream& s, int8_t& a ) { a = ser_readdata8(s); }
198 template<typename Stream> inline void Unserialize(Stream& s, uint8_t& a ) { a = ser_readdata8(s); }
199 template<typename Stream> inline void Unserialize(Stream& s, int16_t& a ) { a = ser_readdata16(s); }
200 template<typename Stream> inline void Unserialize(Stream& s, uint16_t& a) { a = ser_readdata16(s); }
201 template<typename Stream> inline void Unserialize(Stream& s, int32_t& a ) { a = ser_readdata32(s); }
202 template<typename Stream> inline void Unserialize(Stream& s, uint32_t& a) { a = ser_readdata32(s); }
203 template<typename Stream> inline void Unserialize(Stream& s, int64_t& a ) { a = ser_readdata64(s); }
204 template<typename Stream> inline void Unserialize(Stream& s, uint64_t& a) { a = ser_readdata64(s); }
205 template<typename Stream> inline void Unserialize(Stream& s, float& a ) { a = ser_uint32_to_float(ser_readdata32(s)); }
206 template<typename Stream> inline void Unserialize(Stream& s, double& a ) { a = ser_uint64_to_double(ser_readdata64(s)); }
208 template<typename Stream> inline void Serialize(Stream& s, bool a) { char f=a; ser_writedata8(s, f); }
209 template<typename Stream> inline void Unserialize(Stream& s, bool& a) { char f=ser_readdata8(s); a=f; }
228 else if (nSize <= std::numeric_limits<unsigned short>::max()) return sizeof(unsigned char) + sizeof(unsigned short);
229 else if (nSize <= std::numeric_limits<unsigned int>::max()) return sizeof(unsigned char) + sizeof(unsigned int);
655 template<typename Stream, typename C> void Serialize(Stream& os, const std::basic_string<C>& str);
662 template<typename Stream, unsigned int N, typename T> void Serialize_impl(Stream& os, const prevector<N, T>& v, const unsigned char&);
663 template<typename Stream, unsigned int N, typename T, typename V> void Serialize_impl(Stream& os, const prevector<N, T>& v, const V&);
664 template<typename Stream, unsigned int N, typename T> inline void Serialize(Stream& os, const prevector<N, T>& v);
665 template<typename Stream, unsigned int N, typename T> void Unserialize_impl(Stream& is, prevector<N, T>& v, const unsigned char&);
666 template<typename Stream, unsigned int N, typename T, typename V> void Unserialize_impl(Stream& is, prevector<N, T>& v, const V&);
667 template<typename Stream, unsigned int N, typename T> inline void Unserialize(Stream& is, prevector<N, T>& v);
673 template<typename Stream, typename T, typename A> void Serialize_impl(Stream& os, const std::vector<T, A>& v, const unsigned char&);
674 template<typename Stream, typename T, typename A, typename V> void Serialize_impl(Stream& os, const std::vector<T, A>& v, const V&);
675 template<typename Stream, typename T, typename A> inline void Serialize(Stream& os, const std::vector<T, A>& v);
676 template<typename Stream, typename T, typename A> void Unserialize_impl(Stream& is, std::vector<T, A>& v, const unsigned char&);
677 template<typename Stream, typename T, typename A, typename V> void Unserialize_impl(Stream& is, std::vector<T, A>& v, const V&);
678 template<typename Stream, typename T, typename A> inline void Unserialize(Stream& is, std::vector<T, A>& v);
683 template<typename Stream, typename K, typename T> void Serialize(Stream& os, const std::pair<K, T>& item);
684 template<typename Stream, typename K, typename T> void Unserialize(Stream& is, std::pair<K, T>& item);
689 template<typename Stream, typename... Elements> void Serialize(Stream& os, const std::tuple<Elements...>& item);
690 template<typename Stream, typename... Elements> void Unserialize(Stream& is, std::tuple<Elements...>& item);
695 template<typename Stream, typename K, typename T, typename Pred, typename A> void Serialize(Stream& os, const std::map<K, T, Pred, A>& m);
696 template<typename Stream, typename K, typename T, typename Pred, typename A> void Unserialize(Stream& is, std::map<K, T, Pred, A>& m);
697 template<typename Stream, typename K, typename T, typename Hash, typename Pred, typename A> void Serialize(Stream& os, const std::unordered_map<K, T, Hash, Pred, A>& m);
698 template<typename Stream, typename K, typename T, typename Hash, typename Pred, typename A> void Unserialize(Stream& is, std::unordered_map<K, T, Hash, Pred, A>& m);
703 template<typename Stream, typename K, typename Pred, typename A> void Serialize(Stream& os, const std::set<K, Pred, A>& m);
704 template<typename Stream, typename K, typename Pred, typename A> void Unserialize(Stream& is, std::set<K, Pred, A>& m);
705 template<typename Stream, typename K, typename Hash, typename Pred, typename A> void Serialize(Stream& os, const std::unordered_set<K, Hash, Pred, A>& m);
706 template<typename Stream, typename K, typename Hash, typename Pred, typename A> void Unserialize(Stream& is, std::unordered_set<K, Hash, Pred, A>& m);
717 template<typename Stream, typename T> void Serialize(Stream& os, const std::unique_ptr<const T>& p);
718 template<typename Stream, typename T> void Unserialize(Stream& os, std::unique_ptr<const T>& p);
725 template<typename Stream, typename T, typename std::enable_if<std::is_class<T>::value>::type* = nullptr>
731 template<typename Stream, typename T, typename std::enable_if<std::is_class<T>::value>::type* = nullptr>
747 template<typename Stream, typename T, typename std::enable_if<std::is_enum<T>::value>::type* = nullptr>
750 // If you ever get into this situation, it usaully means you forgot to declare is_serializable_enum for the desired enum type
758 template<typename Stream, typename T, typename std::enable_if<std::is_enum<T>::value>::type* = nullptr>
761 // If you ever get into this situation, it usaully means you forgot to declare is_serializable_enum for the desired enum type
986 SerializeTuple<Stream, size - 1, Elements...>{}(os, const_cast<std::tuple<Elements...>&>(item));
1016 std::pair<typename std::remove_const<typename Map::key_type>::type, typename std::remove_const<typename Map::mapped_type>::type> item;
void operator()(Stream &s, std::tuple< Ts... > &t)
Definition: serialize.h:953
CFixedBitSet(std::vector< bool > &vecIn, size_t sizeIn)
Definition: serialize.h:426
If none of the specialized versions above matched and T is an enum, default to calling Serialize/Unse...
Definition: params.h:197
void WriteCompactSize(CSizeComputer &os, uint64_t nSize)
Definition: serialize.h:1289
void SerReadWriteMany(Stream &s, CSerActionSerialize ser_action, Args &&... args)
Definition: serialize.h:1272
size_t GetSerializeSize(const T &t, int nType, int nVersion=0)
Definition: serialize.h:1295
Definition: serialize.h:1163
Definition: serialize.h:457
unsigned int GetSizeOfCompactSize(uint64_t nSize)
Compact Size size < 253 – 1 byte size <= USHRT_MAX – 3 bytes (253 + 2 bytes) size <= UINT_MAX – 5 ...
Definition: serialize.h:225
Definition: serialize.h:594
Definition: prevector.h:100
void resize_uninitialized(size_type new_size)
Definition: prevector.h:414
Definition: serialize.h:419
Definition: serialize.h:967
Serializes either as a CFixedBitSet or CFixedVarIntsBitSet, depending on which would give a smaller s...
Definition: serialize.h:533
void SerReadWrite(Stream &s, const T &obj, CSerActionSerialize ser_action)
Definition: serialize.h:1169
unsigned int GetSizeOfVarInt(I n)
Variable-length integers: bytes are a MSB base-128 encoding of the number.
Definition: serialize.h:317
Support for ADD_SERIALIZE_METHODS and READWRITE macro.
Definition: serialize.h:1159
Implements a drop-in replacement for std::vector<T> which stores up to N elements directly (without h...
Definition: prevector.h:39
Definition: serialize.h:617
CFixedVarIntsBitSet(std::vector< bool > &vecIn, size_t sizeIn)
Definition: serialize.h:491
void seek(size_t _nSize)
Pretend _nSize bytes are written, without specifying them.
Definition: serialize.h:1215
Definition: serialize.h:576
CAutoBitSet(std::vector< bool > &vecIn, size_t sizeIn)
Definition: serialize.h:540
void operator()(Stream &s, std::tuple< Ts... > &t)
Definition: serialize.h:968
void Serialize_impl(Stream &os, const prevector< N, T > &v, const unsigned char &)
prevector prevectors of unsigned char are a special case and are intended to be serialized as a singl...
Definition: serialize.h:799
T * NCONST_PTR(const T *val)
Used to acquire a non-const pointer "this" to generate bodies of const serialization operations from ...
Definition: serialize.h:60
void Unserialize_impl(Stream &is, prevector< N, T > &v, const unsigned char &)
Definition: serialize.h:822
Definition: serialize.h:1199
T & REF(const T &val)
Used to bypass the rule against non-const reference to temporary where it makes sense with wrappers s...
Definition: serialize.h:50
Definition: serialize.h:160
Definition: serialize.h:162
Definition: serialize.h:161