Electroneum
boost::archive::portable_binary_oarchive Class Reference

#include <portable_binary_oarchive.hpp>

Inheritance diagram for boost::archive::portable_binary_oarchive:
Collaboration diagram for boost::archive::portable_binary_oarchive:

Public Types

typedef boost::archive::detail::common_oarchive< portable_binary_oarchivedetail_common_oarchive
 

Public Member Functions

void save_impl (const boost::intmax_t l, const char maxsize)
 
template<class T >
void save (const T &t)
 
void save (const std::string &t)
 
void save (const std::wstring &t)
 
void save (const float &t)
 
void save (const double &t)
 
void save (const char &t)
 
void save (const unsigned char &t)
 
template<class T >
void save_override (T &t, int)
 
void save_override (const boost::archive::class_name_type &t, int)
 
void save_override (const boost::archive::class_id_optional_type &, int)
 
void init (unsigned int flags)
 
 portable_binary_oarchive (std::ostream &os, unsigned flags=endian_little)
 
 portable_binary_oarchive (std::basic_streambuf< std::ostream::char_type, std::ostream::traits_type > &bsb, unsigned int flags)
 

Public Attributes

unsigned int m_flags
 

Detailed Description

Definition at line 72 of file portable_binary_oarchive.hpp.

Member Typedef Documentation

◆ detail_common_oarchive

Definition at line 141 of file portable_binary_oarchive.hpp.

Constructor & Destructor Documentation

◆ portable_binary_oarchive() [1/2]

boost::archive::portable_binary_oarchive::portable_binary_oarchive ( std::ostream &  os,
unsigned  flags = endian_little 
)
inline

Definition at line 174 of file portable_binary_oarchive.hpp.

174  :
175  primitive_base_t(
176  * os.rdbuf(),
177  0 != (flags & boost::archive::no_codecvt)
178  ),
179  archive_base_t(flags),
180  m_flags(flags & (endian_big | endian_little))
181  {
182  init(flags);
183  }
Here is the call graph for this function:

◆ portable_binary_oarchive() [2/2]

boost::archive::portable_binary_oarchive::portable_binary_oarchive ( std::basic_streambuf< std::ostream::char_type, std::ostream::traits_type > &  bsb,
unsigned int  flags 
)
inline

Definition at line 185 of file portable_binary_oarchive.hpp.

191  :
192  primitive_base_t(
193  bsb,
194  0 != (flags & boost::archive::no_codecvt)
195  ),
196  archive_base_t(flags),
197  m_flags(0)
198  {
199  init(flags);
200  }
Here is the call graph for this function:

Member Function Documentation

◆ init()

void boost::archive::portable_binary_oarchive::init ( unsigned int  flags)
inline

Definition at line 273 of file portable_binary_oarchive.hpp.

273  {
274  if(m_flags == (endian_big | endian_little)){
275  boost::serialization::throw_exception(
276  portable_binary_oarchive_exception()
277  );
278  }
279  if(0 == (flags & boost::archive::no_header)){
280  // write signature in an archive version independent manner
281  const std::string file_signature(
282  boost::archive::BOOST_ARCHIVE_SIGNATURE()
283  );
284  * this << file_signature;
285  // ignore archive version checking
286  const boost::archive::library_version_type v{};
287  /*
288  // write library version
289  const boost::archive::library_version_type v(
290  boost::archive::BOOST_ARCHIVE_VERSION()
291  );
292  */
293  * this << v;
294  }
295  save(static_cast<unsigned char>(m_flags >> CHAR_BIT));
296 }
::std::string string
Definition: gtest-port.h:1097
Here is the call graph for this function:
Here is the caller graph for this function:

◆ save() [1/7]

template<class T >
void boost::archive::portable_binary_oarchive::save ( const T t)
inline

Definition at line 110 of file portable_binary_oarchive.hpp.

110  {
111  save_impl(t, sizeof(T));
112  }
const uint32_t T[512]
void save_impl(const boost::intmax_t l, const char maxsize)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ save() [2/7]

void boost::archive::portable_binary_oarchive::save ( const std::string &  t)
inline

Definition at line 113 of file portable_binary_oarchive.hpp.

113  {
114  this->primitive_base_t::save(t);
115  }
void save(Archive &a, const std::unordered_map< h_key, hval > &x, const boost::serialization::version_type ver)
Here is the call graph for this function:

◆ save() [3/7]

void boost::archive::portable_binary_oarchive::save ( const std::wstring &  t)
inline

Definition at line 117 of file portable_binary_oarchive.hpp.

117  {
118  this->primitive_base_t::save(t);
119  }
void save(Archive &a, const std::unordered_map< h_key, hval > &x, const boost::serialization::version_type ver)
Here is the call graph for this function:

◆ save() [4/7]

void boost::archive::portable_binary_oarchive::save ( const float &  t)
inline

Definition at line 121 of file portable_binary_oarchive.hpp.

121  {
122  this->primitive_base_t::save(t);
123  // floats not supported
124  //BOOST_STATIC_ASSERT(false);
125  }
void save(Archive &a, const std::unordered_map< h_key, hval > &x, const boost::serialization::version_type ver)
Here is the call graph for this function:

◆ save() [5/7]

void boost::archive::portable_binary_oarchive::save ( const double &  t)
inline

Definition at line 126 of file portable_binary_oarchive.hpp.

126  {
127  this->primitive_base_t::save(t);
128  // doubles not supported
129  //BOOST_STATIC_ASSERT(false);
130  }
void save(Archive &a, const std::unordered_map< h_key, hval > &x, const boost::serialization::version_type ver)
Here is the call graph for this function:

◆ save() [6/7]

void boost::archive::portable_binary_oarchive::save ( const char &  t)
inline

Definition at line 131 of file portable_binary_oarchive.hpp.

131  {
132  this->primitive_base_t::save(t);
133  }
void save(Archive &a, const std::unordered_map< h_key, hval > &x, const boost::serialization::version_type ver)
Here is the call graph for this function:

◆ save() [7/7]

void boost::archive::portable_binary_oarchive::save ( const unsigned char &  t)
inline

Definition at line 134 of file portable_binary_oarchive.hpp.

134  {
135  this->primitive_base_t::save(t);
136  }
void save(Archive &a, const std::unordered_map< h_key, hval > &x, const boost::serialization::version_type ver)
Here is the call graph for this function:

◆ save_impl()

void boost::archive::portable_binary_oarchive::save_impl ( const boost::intmax_t  l,
const char  maxsize 
)
inline

Definition at line 229 of file portable_binary_oarchive.hpp.

232  {
233  signed char size = 0;
234 
235  if(l == 0){
236  this->primitive_base_t::save(size);
237  return;
238  }
239 
240  boost::intmax_t ll;
241  bool negative = (l < 0);
242  if(negative)
243  ll = -l;
244  else
245  ll = l;
246 
247  do{
248  ll >>= CHAR_BIT;
249  ++size;
250  }while(ll != 0);
251 
253  static_cast<signed char>(negative ? -size : size)
254  );
255 
256  if(negative)
257  ll = -l;
258  else
259  ll = l;
260  char * cptr = reinterpret_cast<char *>(& ll);
261 #if BOOST_ENDIAN_BIG_BYTE
262  cptr += (sizeof(boost::intmax_t) - size);
263  if(m_flags & endian_little)
264  reverse_bytes(size, cptr);
265 #else
266  if(m_flags & endian_big)
267  reverse_bytes(size, cptr);
268 #endif
269  this->primitive_base_t::save_binary(cptr, size);
270 }
void save(Archive &a, const std::unordered_map< h_key, hval > &x, const boost::serialization::version_type ver)
int64_t intmax_t
Definition: stdint.h:169
void reverse_bytes(signed char size, char *address)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ save_override() [1/3]

template<class T >
void boost::archive::portable_binary_oarchive::save_override ( T t,
int   
)
inline

Definition at line 158 of file portable_binary_oarchive.hpp.

158  {
159  this->detail_common_oarchive::save_override(t, 0);
160  }

◆ save_override() [2/3]

void boost::archive::portable_binary_oarchive::save_override ( const boost::archive::class_name_type &  t,
int   
)
inline

Definition at line 162 of file portable_binary_oarchive.hpp.

162  {
163  const std::string s(t);
164  * this << s;
165  }
::std::string string
Definition: gtest-port.h:1097

◆ save_override() [3/3]

void boost::archive::portable_binary_oarchive::save_override ( const boost::archive::class_id_optional_type &  ,
int   
)
inline

Definition at line 167 of file portable_binary_oarchive.hpp.

169  {}

Member Data Documentation

◆ m_flags

unsigned int boost::archive::portable_binary_oarchive::m_flags

Definition at line 101 of file portable_binary_oarchive.hpp.


The documentation for this class was generated from the following file: