Electroneum
Loading...
Searching...
No Matches
binary_archive< false > Struct Reference

#include <binary_archive.h>

Inheritance diagram for binary_archive< false >:
Collaboration diagram for binary_archive< false >:

Public Member Functions

 binary_archive (stream_type &s)
template<class T>
void serialize_int (T &v)
template<class T>
void serialize_uint (T &v, size_t width=sizeof(T))
 serializes an unsigned integer
void serialize_blob (void *buf, size_t len, const char *delimiter="")
void serialize_string (std::string str, const char *delimiter="")
template<class T>
void serialize_varint (T &v)
template<class T>
void serialize_uvarint (T &v)
void begin_array (size_t &s)
void begin_array ()
void delimit_array ()
void end_array ()
void begin_string (const char *delimiter)
void end_string (const char *delimiter)
void read_variant_tag (variant_tag_type &t)
size_t remaining_bytes ()
Public Member Functions inherited from binary_archive_base< std::istream, false >
 binary_archive_base (stream_type &s)
void tag (const char *)
void begin_object ()
void end_object ()
void begin_variant ()
void end_variant ()
stream_typestream ()

Protected Attributes

std::streamoff eof_pos_
Protected Attributes inherited from binary_archive_base< std::istream, false >
stream_typestream_

Additional Inherited Members

Public Types inherited from binary_archive_base< std::istream, false >
typedef std::istream stream_type
typedef binary_archive_base< std::istream, IsSaving > base_type
typedef boost::mpl::bool_< IsSaving > is_saving
typedef uint8_t variant_tag_type

Detailed Description

Definition at line 98 of file binary_archive.h.

Constructor & Destructor Documentation

◆ binary_archive()

binary_archive< false >::binary_archive ( stream_type & s)
inlineexplicit

Definition at line 101 of file binary_archive.h.

101 : base_type(s) {
103 stream_.seekg(0, std::ios_base::end);
104 eof_pos_ = stream_.tellg();
105 stream_.seekg(pos);
106 }
binary_archive_base< std::istream, IsSaving > base_type

Member Function Documentation

◆ begin_array() [1/2]

void binary_archive< false >::begin_array ( )
inline

Definition at line 163 of file binary_archive.h.

163{ }

◆ begin_array() [2/2]

void binary_archive< false >::begin_array ( size_t & s)
inline

Definition at line 158 of file binary_archive.h.

159 {
161 }
Here is the call graph for this function:

◆ begin_string()

void binary_archive< false >::begin_string ( const char * delimiter)
inline

Definition at line 167 of file binary_archive.h.

167{ }

◆ delimit_array()

void binary_archive< false >::delimit_array ( )
inline

Definition at line 164 of file binary_archive.h.

164{ }

◆ end_array()

void binary_archive< false >::end_array ( )
inline

Definition at line 165 of file binary_archive.h.

165{ }

◆ end_string()

void binary_archive< false >::end_string ( const char * delimiter)
inline

Definition at line 168 of file binary_archive.h.

168{ }

◆ read_variant_tag()

void binary_archive< false >::read_variant_tag ( variant_tag_type & t)
inline

Definition at line 170 of file binary_archive.h.

170 {
172 }
Here is the call graph for this function:

◆ remaining_bytes()

size_t binary_archive< false >::remaining_bytes ( )
inline

Definition at line 174 of file binary_archive.h.

174 {
175 if (!stream_.good())
176 return 0;
177 //std::cerr << "tell: " << stream_.tellg() << std::endl;
178 assert(stream_.tellg() <= eof_pos_);
179 return eof_pos_ - stream_.tellg();
180 }

◆ serialize_blob()

void binary_archive< false >::serialize_blob ( void * buf,
size_t len,
const char * delimiter = "" )
inline

Definition at line 134 of file binary_archive.h.

135 {
136 stream_.read((char *)buf, len);
137 }

◆ serialize_int()

template<class T>
void binary_archive< false >::serialize_int ( T & v)
inline

Definition at line 109 of file binary_archive.h.

110 {
112 }
void serialize_uint(T &v, size_t width=sizeof(T))
serializes an unsigned integer
Here is the call graph for this function:
Here is the caller graph for this function:

◆ serialize_string()

void binary_archive< false >::serialize_string ( std::string str,
const char * delimiter = "" )
inline

Definition at line 139 of file binary_archive.h.

140 {
141 stream_.read((char *)str.c_str(), str.size());
142 }

◆ serialize_uint()

template<class T>
void binary_archive< false >::serialize_uint ( T & v,
size_t width = sizeof(T) )
inline

serializes an unsigned integer

Definition at line 119 of file binary_archive.h.

120 {
121 T ret = 0;
122 unsigned shift = 0;
123 for (size_t i = 0; i < width; i++) {
124 //std::cerr << "tell: " << stream_.tellg() << " value: " << ret << std::endl;
125 char c;
126 stream_.get(c);
127 T b = (unsigned char)c;
128 ret += (b << shift); // can this be changed to OR, i think it can.
129 shift += 8;
130 }
131 v = ret;
132 }
Here is the caller graph for this function:

◆ serialize_uvarint()

template<class T>
void binary_archive< false >::serialize_uvarint ( T & v)
inline

Definition at line 151 of file binary_archive.h.

152 {
154 if (tools::read_varint(it(stream_), it(), v) < 0)
156 }
Here is the call graph for this function:
Here is the caller graph for this function:

◆ serialize_varint()

template<class T>
void binary_archive< false >::serialize_varint ( T & v)
inline

Definition at line 145 of file binary_archive.h.

146 {
148 }
Here is the call graph for this function:
Here is the caller graph for this function:

Member Data Documentation

◆ eof_pos_

std::streamoff binary_archive< false >::eof_pos_
protected

Definition at line 182 of file binary_archive.h.


The documentation for this struct was generated from the following file:
  • /home/abuild/rpmbuild/BUILD/electroneum-5.1.3.1-build/electroneum-5.1.3.1/src/serialization/binary_archive.h