![]() |
Feathercoin
0.5.0
P2P Digital Currency
|
#include <string>
#include <vector>
#include <map>
#include <set>
#include <cassert>
#include <limits>
#include <cstring>
#include <cstdio>
#include <boost/type_traits/is_fundamental.hpp>
#include <boost/tuple/tuple.hpp>
#include <boost/tuple/tuple_comparison.hpp>
#include <boost/tuple/tuple_io.hpp>
#include "allocators.h"
#include "version.h"
Go to the source code of this file.
Classes | |
class | CFlatData |
Wrapper for serializing arrays and POD. More... | |
class | CVarInt< I > |
class | CSerActionGetSerializeSize |
class | CSerActionSerialize |
class | CSerActionUnserialize |
struct | ser_streamplaceholder |
class | CDataStream |
Double ended buffer combining vector and stream-like interfaces. More... | |
class | CAutoFile |
RAII wrapper for FILE*. More... | |
class | CBufferedFile |
Wrapper around a FILE* that implements a ring buffer to deserialize from. More... | |
Macros | |
#define | IMPLEMENT_SERIALIZE(statements) |
#define | READWRITE(obj) (nSerSize += ::SerReadWrite(s, (obj), nType, nVersion, ser_action)) |
#define | WRITEDATA(s, obj) s.write((char*)&(obj), sizeof(obj)) |
#define | READDATA(s, obj) s.read((char*)&(obj), sizeof(obj)) |
#define | FLATDATA(obj) REF(CFlatData((char*)&(obj), (char*)&(obj) + sizeof(obj))) |
#define | VARINT(obj) REF(WrapVarInt(REF(obj))) |
Typedefs | |
typedef long long | int64 |
typedef unsigned long long | uint64 |
typedef std::vector< char, zero_after_free_allocator < char > > | CSerializeData |
Enumerations | |
enum | { SER_NETWORK = (1 << 0), SER_DISK = (1 << 1), SER_GETHASH = (1 << 2) } |
Functions | |
template<typename T > | |
T & | REF (const T &val) |
unsigned int | GetSerializeSize (char a, int, int=0) |
unsigned int | GetSerializeSize (signed char a, int, int=0) |
unsigned int | GetSerializeSize (unsigned char a, int, int=0) |
unsigned int | GetSerializeSize (signed short a, int, int=0) |
unsigned int | GetSerializeSize (unsigned short a, int, int=0) |
unsigned int | GetSerializeSize (signed int a, int, int=0) |
unsigned int | GetSerializeSize (unsigned int a, int, int=0) |
unsigned int | GetSerializeSize (signed long a, int, int=0) |
unsigned int | GetSerializeSize (unsigned long a, int, int=0) |
unsigned int | GetSerializeSize (int64 a, int, int=0) |
unsigned int | GetSerializeSize (uint64 a, int, int=0) |
unsigned int | GetSerializeSize (float a, int, int=0) |
unsigned int | GetSerializeSize (double a, int, int=0) |
template<typename Stream > | |
void | Serialize (Stream &s, char a, int, int=0) |
template<typename Stream > | |
void | Serialize (Stream &s, signed char a, int, int=0) |
template<typename Stream > | |
void | Serialize (Stream &s, unsigned char a, int, int=0) |
template<typename Stream > | |
void | Serialize (Stream &s, signed short a, int, int=0) |
template<typename Stream > | |
void | Serialize (Stream &s, unsigned short a, int, int=0) |
template<typename Stream > | |
void | Serialize (Stream &s, signed int a, int, int=0) |
template<typename Stream > | |
void | Serialize (Stream &s, unsigned int a, int, int=0) |
template<typename Stream > | |
void | Serialize (Stream &s, signed long a, int, int=0) |
template<typename Stream > | |
void | Serialize (Stream &s, unsigned long a, int, int=0) |
template<typename Stream > | |
void | Serialize (Stream &s, int64 a, int, int=0) |
template<typename Stream > | |
void | Serialize (Stream &s, uint64 a, int, int=0) |
template<typename Stream > | |
void | Serialize (Stream &s, float a, int, int=0) |
template<typename Stream > | |
void | Serialize (Stream &s, double a, int, int=0) |
template<typename Stream > | |
void | Unserialize (Stream &s, char &a, int, int=0) |
template<typename Stream > | |
void | Unserialize (Stream &s, signed char &a, int, int=0) |
template<typename Stream > | |
void | Unserialize (Stream &s, unsigned char &a, int, int=0) |
template<typename Stream > | |
void | Unserialize (Stream &s, signed short &a, int, int=0) |
template<typename Stream > | |
void | Unserialize (Stream &s, unsigned short &a, int, int=0) |
template<typename Stream > | |
void | Unserialize (Stream &s, signed int &a, int, int=0) |
template<typename Stream > | |
void | Unserialize (Stream &s, unsigned int &a, int, int=0) |
template<typename Stream > | |
void | Unserialize (Stream &s, signed long &a, int, int=0) |
template<typename Stream > | |
void | Unserialize (Stream &s, unsigned long &a, int, int=0) |
template<typename Stream > | |
void | Unserialize (Stream &s, int64 &a, int, int=0) |
template<typename Stream > | |
void | Unserialize (Stream &s, uint64 &a, int, int=0) |
template<typename Stream > | |
void | Unserialize (Stream &s, float &a, int, int=0) |
template<typename Stream > | |
void | Unserialize (Stream &s, double &a, int, int=0) |
unsigned int | GetSerializeSize (bool a, int, int=0) |
template<typename Stream > | |
void | Serialize (Stream &s, bool a, int, int=0) |
template<typename Stream > | |
void | Unserialize (Stream &s, bool &a, int, int=0) |
unsigned int | GetSizeOfCompactSize (uint64 nSize) |
template<typename Stream > | |
void | WriteCompactSize (Stream &os, uint64 nSize) |
template<typename Stream > | |
uint64 | ReadCompactSize (Stream &is) |
template<typename I > | |
unsigned int | GetSizeOfVarInt (I n) |
template<typename Stream , typename I > | |
void | WriteVarInt (Stream &os, I n) |
template<typename Stream , typename I > | |
I | ReadVarInt (Stream &is) |
template<typename I > | |
CVarInt< I > | WrapVarInt (I &n) |
template<typename C > | |
unsigned int | GetSerializeSize (const std::basic_string< C > &str, int, int=0) |
template<typename Stream , typename C > | |
void | Serialize (Stream &os, const std::basic_string< C > &str, int, int=0) |
template<typename Stream , typename C > | |
void | Unserialize (Stream &is, std::basic_string< C > &str, int, int=0) |
template<typename T , typename A > | |
unsigned int | GetSerializeSize_impl (const std::vector< T, A > &v, int nType, int nVersion, const boost::true_type &) |
template<typename T , typename A > | |
unsigned int | GetSerializeSize_impl (const std::vector< T, A > &v, int nType, int nVersion, const boost::false_type &) |
template<typename T , typename A > | |
unsigned int | GetSerializeSize (const std::vector< T, A > &v, int nType, int nVersion) |
template<typename Stream , typename T , typename A > | |
void | Serialize_impl (Stream &os, const std::vector< T, A > &v, int nType, int nVersion, const boost::true_type &) |
template<typename Stream , typename T , typename A > | |
void | Serialize_impl (Stream &os, const std::vector< T, A > &v, int nType, int nVersion, const boost::false_type &) |
template<typename Stream , typename T , typename A > | |
void | Serialize (Stream &os, const std::vector< T, A > &v, int nType, int nVersion) |
template<typename Stream , typename T , typename A > | |
void | Unserialize_impl (Stream &is, std::vector< T, A > &v, int nType, int nVersion, const boost::true_type &) |
template<typename Stream , typename T , typename A > | |
void | Unserialize_impl (Stream &is, std::vector< T, A > &v, int nType, int nVersion, const boost::false_type &) |
template<typename Stream , typename T , typename A > | |
void | Unserialize (Stream &is, std::vector< T, A > &v, int nType, int nVersion) |
unsigned int | GetSerializeSize (const CScript &v, int nType, int nVersion) |
template<typename Stream > | |
void | Serialize (Stream &os, const CScript &v, int nType, int nVersion) |
template<typename Stream > | |
void | Unserialize (Stream &is, CScript &v, int nType, int nVersion) |
template<typename K , typename T > | |
unsigned int | GetSerializeSize (const std::pair< K, T > &item, int nType, int nVersion) |
template<typename Stream , typename K , typename T > | |
void | Serialize (Stream &os, const std::pair< K, T > &item, int nType, int nVersion) |
template<typename Stream , typename K , typename T > | |
void | Unserialize (Stream &is, std::pair< K, T > &item, int nType, int nVersion) |
template<typename T0 , typename T1 , typename T2 > | |
unsigned int | GetSerializeSize (const boost::tuple< T0, T1, T2 > &item, int nType, int nVersion) |
template<typename Stream , typename T0 , typename T1 , typename T2 > | |
void | Serialize (Stream &os, const boost::tuple< T0, T1, T2 > &item, int nType, int nVersion) |
template<typename Stream , typename T0 , typename T1 , typename T2 > | |
void | Unserialize (Stream &is, boost::tuple< T0, T1, T2 > &item, int nType, int nVersion) |
template<typename T0 , typename T1 , typename T2 , typename T3 > | |
unsigned int | GetSerializeSize (const boost::tuple< T0, T1, T2, T3 > &item, int nType, int nVersion) |
template<typename Stream , typename T0 , typename T1 , typename T2 , typename T3 > | |
void | Serialize (Stream &os, const boost::tuple< T0, T1, T2, T3 > &item, int nType, int nVersion) |
template<typename Stream , typename T0 , typename T1 , typename T2 , typename T3 > | |
void | Unserialize (Stream &is, boost::tuple< T0, T1, T2, T3 > &item, int nType, int nVersion) |
template<typename K , typename T , typename Pred , typename A > | |
unsigned int | GetSerializeSize (const std::map< K, T, Pred, A > &m, int nType, int nVersion) |
template<typename Stream , typename K , typename T , typename Pred , typename A > | |
void | Serialize (Stream &os, const std::map< K, T, Pred, A > &m, int nType, int nVersion) |
template<typename Stream , typename K , typename T , typename Pred , typename A > | |
void | Unserialize (Stream &is, std::map< K, T, Pred, A > &m, int nType, int nVersion) |
template<typename K , typename Pred , typename A > | |
unsigned int | GetSerializeSize (const std::set< K, Pred, A > &m, int nType, int nVersion) |
template<typename Stream , typename K , typename Pred , typename A > | |
void | Serialize (Stream &os, const std::set< K, Pred, A > &m, int nType, int nVersion) |
template<typename Stream , typename K , typename Pred , typename A > | |
void | Unserialize (Stream &is, std::set< K, Pred, A > &m, int nType, int nVersion) |
template<typename T > | |
unsigned int | GetSerializeSize (const T &a, long nType, int nVersion) |
template<typename Stream , typename T > | |
void | Serialize (Stream &os, const T &a, long nType, int nVersion) |
template<typename Stream , typename T > | |
void | Unserialize (Stream &is, T &a, long nType, int nVersion) |
template<typename Stream , typename T > | |
unsigned int | SerReadWrite (Stream &s, const T &obj, int nType, int nVersion, CSerActionGetSerializeSize ser_action) |
template<typename Stream , typename T > | |
unsigned int | SerReadWrite (Stream &s, const T &obj, int nType, int nVersion, CSerActionSerialize ser_action) |
template<typename Stream , typename T > | |
unsigned int | SerReadWrite (Stream &s, T &obj, int nType, int nVersion, CSerActionUnserialize ser_action) |
Definition at line 304 of file serialize.h.
#define IMPLEMENT_SERIALIZE | ( | statements | ) |
Definition at line 55 of file serialize.h.
#define READDATA | ( | s, | |
obj | |||
) | s.read((char*)&(obj), sizeof(obj)) |
Definition at line 104 of file serialize.h.
#define READWRITE | ( | obj | ) | (nSerSize += ::SerReadWrite(s, (obj), nType, nVersion, ser_action)) |
Definition at line 93 of file serialize.h.
#define VARINT | ( | obj | ) | REF(WrapVarInt(REF(obj))) |
Definition at line 305 of file serialize.h.
#define WRITEDATA | ( | s, | |
obj | |||
) | s.write((char*)&(obj), sizeof(obj)) |
Definition at line 103 of file serialize.h.
typedef std::vector<char, zero_after_free_allocator<char> > CSerializeData |
Definition at line 792 of file serialize.h.
typedef long long int64 |
Definition at line 25 of file serialize.h.
typedef unsigned long long uint64 |
Definition at line 26 of file serialize.h.
anonymous enum |
Enumerator | |
---|---|
SER_NETWORK | |
SER_DISK | |
SER_GETHASH |
Definition at line 47 of file serialize.h.
|
inline |
Definition at line 106 of file serialize.h.
|
inline |
Definition at line 107 of file serialize.h.
|
inline |
Definition at line 108 of file serialize.h.
|
inline |
Definition at line 109 of file serialize.h.
|
inline |
Definition at line 110 of file serialize.h.
|
inline |
Definition at line 111 of file serialize.h.
|
inline |
Definition at line 112 of file serialize.h.
|
inline |
Definition at line 113 of file serialize.h.
|
inline |
Definition at line 114 of file serialize.h.
|
inline |
Definition at line 115 of file serialize.h.
|
inline |
Definition at line 116 of file serialize.h.
|
inline |
Definition at line 117 of file serialize.h.
|
inline |
Definition at line 118 of file serialize.h.
|
inline |
Definition at line 148 of file serialize.h.
unsigned int GetSerializeSize | ( | const std::basic_string< C > & | str, |
int | , | ||
int | = 0 |
||
) |
Definition at line 451 of file serialize.h.
|
inline |
Definition at line 494 of file serialize.h.
|
inline |
Definition at line 568 of file serialize.h.
unsigned int GetSerializeSize | ( | const std::pair< K, T > & | item, |
int | nType, | ||
int | nVersion | ||
) |
Definition at line 591 of file serialize.h.
unsigned int GetSerializeSize | ( | const boost::tuple< T0, T1, T2 > & | item, |
int | nType, | ||
int | nVersion | ||
) |
Definition at line 616 of file serialize.h.
unsigned int GetSerializeSize | ( | const boost::tuple< T0, T1, T2, T3 > & | item, |
int | nType, | ||
int | nVersion | ||
) |
Definition at line 647 of file serialize.h.
unsigned int GetSerializeSize | ( | const std::map< K, T, Pred, A > & | m, |
int | nType, | ||
int | nVersion | ||
) |
Definition at line 681 of file serialize.h.
unsigned int GetSerializeSize | ( | const std::set< K, Pred, A > & | m, |
int | nType, | ||
int | nVersion | ||
) |
Definition at line 717 of file serialize.h.
|
inline |
Definition at line 426 of file serialize.h.
unsigned int GetSerializeSize_impl | ( | const std::vector< T, A > & | v, |
int | nType, | ||
int | nVersion, | ||
const boost::true_type & | |||
) |
Definition at line 479 of file serialize.h.
unsigned int GetSerializeSize_impl | ( | const std::vector< T, A > & | v, |
int | nType, | ||
int | nVersion, | ||
const boost::false_type & | |||
) |
Definition at line 485 of file serialize.h.
|
inline |
Definition at line 164 of file serialize.h.
|
inline |
Definition at line 260 of file serialize.h.
uint64 ReadCompactSize | ( | Stream & | is | ) |
Definition at line 205 of file serialize.h.
I ReadVarInt | ( | Stream & | is | ) |
Definition at line 290 of file serialize.h.
|
inline |
Definition at line 36 of file serialize.h.
|
inline |
Definition at line 120 of file serialize.h.
|
inline |
Definition at line 121 of file serialize.h.
|
inline |
Definition at line 122 of file serialize.h.
|
inline |
Definition at line 123 of file serialize.h.
|
inline |
Definition at line 124 of file serialize.h.
|
inline |
Definition at line 125 of file serialize.h.
|
inline |
Definition at line 126 of file serialize.h.
|
inline |
Definition at line 127 of file serialize.h.
|
inline |
Definition at line 128 of file serialize.h.
|
inline |
Definition at line 129 of file serialize.h.
|
inline |
Definition at line 130 of file serialize.h.
|
inline |
Definition at line 131 of file serialize.h.
|
inline |
Definition at line 132 of file serialize.h.
|
inline |
Definition at line 149 of file serialize.h.
void Serialize | ( | Stream & | os, |
const std::basic_string< C > & | str, | ||
int | , | ||
int | = 0 |
||
) |
Definition at line 457 of file serialize.h.
|
inline |
Definition at line 517 of file serialize.h.
void Serialize | ( | Stream & | os, |
const CScript & | v, | ||
int | nType, | ||
int | nVersion | ||
) |
Definition at line 574 of file serialize.h.
void Serialize | ( | Stream & | os, |
const std::pair< K, T > & | item, | ||
int | nType, | ||
int | nVersion | ||
) |
Definition at line 597 of file serialize.h.
void Serialize | ( | Stream & | os, |
const boost::tuple< T0, T1, T2 > & | item, | ||
int | nType, | ||
int | nVersion | ||
) |
Definition at line 626 of file serialize.h.
void Serialize | ( | Stream & | os, |
const boost::tuple< T0, T1, T2, T3 > & | item, | ||
int | nType, | ||
int | nVersion | ||
) |
Definition at line 658 of file serialize.h.
void Serialize | ( | Stream & | os, |
const std::map< K, T, Pred, A > & | m, | ||
int | nType, | ||
int | nVersion | ||
) |
Definition at line 690 of file serialize.h.
void Serialize | ( | Stream & | os, |
const std::set< K, Pred, A > & | m, | ||
int | nType, | ||
int | nVersion | ||
) |
Definition at line 726 of file serialize.h.
|
inline |
Definition at line 432 of file serialize.h.
void Serialize_impl | ( | Stream & | os, |
const std::vector< T, A > & | v, | ||
int | nType, | ||
int | nVersion, | ||
const boost::true_type & | |||
) |
Definition at line 501 of file serialize.h.
void Serialize_impl | ( | Stream & | os, |
const std::vector< T, A > & | v, | ||
int | nType, | ||
int | nVersion, | ||
const boost::false_type & | |||
) |
Definition at line 509 of file serialize.h.
|
inline |
Definition at line 757 of file serialize.h.
|
inline |
Definition at line 763 of file serialize.h.
|
inline |
Definition at line 770 of file serialize.h.
|
inline |
Definition at line 134 of file serialize.h.
|
inline |
Definition at line 135 of file serialize.h.
|
inline |
Definition at line 136 of file serialize.h.
|
inline |
Definition at line 137 of file serialize.h.
|
inline |
Definition at line 138 of file serialize.h.
|
inline |
Definition at line 139 of file serialize.h.
|
inline |
Definition at line 140 of file serialize.h.
|
inline |
Definition at line 141 of file serialize.h.
|
inline |
Definition at line 142 of file serialize.h.
|
inline |
Definition at line 143 of file serialize.h.
|
inline |
Definition at line 144 of file serialize.h.
|
inline |
Definition at line 145 of file serialize.h.
|
inline |
Definition at line 146 of file serialize.h.
|
inline |
Definition at line 150 of file serialize.h.
void Unserialize | ( | Stream & | is, |
std::basic_string< C > & | str, | ||
int | , | ||
int | = 0 |
||
) |
Definition at line 465 of file serialize.h.
|
inline |
Definition at line 558 of file serialize.h.
void Unserialize | ( | Stream & | is, |
CScript & | v, | ||
int | nType, | ||
int | nVersion | ||
) |
Definition at line 580 of file serialize.h.
void Unserialize | ( | Stream & | is, |
std::pair< K, T > & | item, | ||
int | nType, | ||
int | nVersion | ||
) |
Definition at line 604 of file serialize.h.
void Unserialize | ( | Stream & | is, |
boost::tuple< T0, T1, T2 > & | item, | ||
int | nType, | ||
int | nVersion | ||
) |
Definition at line 634 of file serialize.h.
void Unserialize | ( | Stream & | is, |
boost::tuple< T0, T1, T2, T3 > & | item, | ||
int | nType, | ||
int | nVersion | ||
) |
Definition at line 667 of file serialize.h.
void Unserialize | ( | Stream & | is, |
std::map< K, T, Pred, A > & | m, | ||
int | nType, | ||
int | nVersion | ||
) |
Definition at line 698 of file serialize.h.
void Unserialize | ( | Stream & | is, |
std::set< K, Pred, A > & | m, | ||
int | nType, | ||
int | nVersion | ||
) |
Definition at line 734 of file serialize.h.
|
inline |
Definition at line 438 of file serialize.h.
void Unserialize_impl | ( | Stream & | is, |
std::vector< T, A > & | v, | ||
int | nType, | ||
int | nVersion, | ||
const boost::true_type & | |||
) |
Definition at line 524 of file serialize.h.
void Unserialize_impl | ( | Stream & | is, |
std::vector< T, A > & | v, | ||
int | nType, | ||
int | nVersion, | ||
const boost::false_type & | |||
) |
Definition at line 540 of file serialize.h.
CVarInt<I> WrapVarInt | ( | I & | n | ) |
Definition at line 363 of file serialize.h.
void WriteCompactSize | ( | Stream & | os, |
uint64 | nSize | ||
) |
Definition at line 173 of file serialize.h.
void WriteVarInt | ( | Stream & | os, |
I | n | ||
) |
Definition at line 273 of file serialize.h.