UCommon
ost::PersistEngine Class Reference

Stream serialization of persistent classes. More...

#include <persist.h>

Public Types

enum  EngineMode { modeRead , modeWrite }
 These are the modes the Persistence::Engine can work in. More...
 

Public Member Functions

 PersistEngine (std::iostream &stream, EngineMode mode) throw (PersistException)
 Constructs a Persistence::Engine with the specified stream in the given mode.
 
void read (bool &i) throw (PersistException)
 
void read (double &i) throw (PersistException)
 
void read (float &i) throw (PersistException)
 
void read (int16_t &i) throw (PersistException)
 
void read (int32_t &i) throw (PersistException)
 
void read (int8_t &i) throw (PersistException)
 
void read (PersistObject &object) throw (PersistException)
 reads a PersistObject into a reference overwriting the object.
 
void read (PersistObject *&object) throw (PersistException)
 reads a PersistObject into a pointer allocating memory for the object if necessary.
 
void read (std::string &str) throw (PersistException)
 
void read (uint16_t &i) throw (PersistException)
 
void read (uint32_t &i) throw (PersistException)
 
void read (uint8_t &i) throw (PersistException)
 
void readBinary (uint8_t *data, uint32_t size) throw (PersistException)
 
void write (bool i) throw (PersistException)
 
void write (const PersistObject &object) throw (PersistException)
 writes a PersistObject from a reference.
 
void write (const PersistObject *object) throw (PersistException)
 writes a PersistObject from a pointer.
 
void write (const std::string &str) throw (PersistException)
 
void write (double i) throw (PersistException)
 
void write (float i) throw (PersistException)
 
void write (int16_t i) throw (PersistException)
 
void write (int32_t i) throw (PersistException)
 
void write (int8_t i) throw (PersistException)
 
void write (uint16_t i) throw (PersistException)
 
void write (uint32_t i) throw (PersistException)
 
void write (uint8_t i) throw (PersistException)
 
void writeBinary (const uint8_t *data, const uint32_t size) throw (PersistException)
 

Related Symbols

(Note that these are not member symbols.)

PersistEngineoperator<< (PersistEngine &ar, bool ob) throw(PersistException)
 
PersistEngineoperator<< (PersistEngine &ar, double ob) throw(PersistException)
 
PersistEngineoperator<< (PersistEngine &ar, float ob) throw(PersistException)
 
PersistEngineoperator<< (PersistEngine &ar, int16_t ob) throw(PersistException)
 
PersistEngineoperator<< (PersistEngine &ar, int32_t ob) throw(PersistException)
 
PersistEngineoperator<< (PersistEngine &ar, int8_t ob) throw(PersistException)
 
PersistEngineoperator<< (PersistEngine &ar, PersistObject const &ob) throw(PersistException)
 
PersistEngineoperator<< (PersistEngine &ar, PersistObject const *ob) throw(PersistException)
 
template<class x , class y >
PersistEngineoperator<< (PersistEngine &ar, std::pair< x, y > &ob) throw(PersistException)
 serialize a pair of some serializable content to the engine.
 
PersistEngineoperator<< (PersistEngine &ar, std::string ob) throw(PersistException)
 
template<class T >
PersistEngineoperator<< (PersistEngine &ar, typename std::deque< T > const &ob) throw(PersistException)
 serialize a deque of some serializable content to the engine
 
template<class Key , class Value >
PersistEngineoperator<< (PersistEngine &ar, typename std::map< Key, Value > const &ob) throw(PersistException)
 serialize a map with keys/values which both are serializeable to an engine.
 
template<class T >
PersistEngineoperator<< (PersistEngine &ar, typename std::vector< T > const &ob) throw(PersistException)
 The following are template classes.
 
PersistEngineoperator<< (PersistEngine &ar, uint16_t ob) throw(PersistException)
 
PersistEngineoperator<< (PersistEngine &ar, uint32_t ob) throw(PersistException)
 
PersistEngineoperator<< (PersistEngine &ar, uint8_t ob) throw(PersistException)
 
PersistEngineoperator>> (PersistEngine &ar, bool &ob) throw(PersistException)
 
PersistEngineoperator>> (PersistEngine &ar, double &ob) throw(PersistException)
 
PersistEngineoperator>> (PersistEngine &ar, float &ob) throw(PersistException)
 
PersistEngineoperator>> (PersistEngine &ar, int16_t &ob) throw(PersistException)
 
PersistEngineoperator>> (PersistEngine &ar, int32_t &ob) throw(PersistException)
 
PersistEngineoperator>> (PersistEngine &ar, int8_t &ob) throw(PersistException)
 
PersistEngineoperator>> (PersistEngine &ar, PersistObject &ob) throw(PersistException)
 
PersistEngineoperator>> (PersistEngine &ar, PersistObject *&ob) throw(PersistException)
 
template<class x , class y >
PersistEngineoperator>> (PersistEngine &ar, std::pair< x, y > &ob) throw(PersistException)
 deserialize a pair of some serializable content to the engine.
 
PersistEngineoperator>> (PersistEngine &ar, std::string &ob) throw(PersistException)
 
template<class T >
PersistEngineoperator>> (PersistEngine &ar, typename std::deque< T > &ob) throw(PersistException)
 deserialize a deque of deserializable content from an engine.
 
template<class Key , class Value >
PersistEngineoperator>> (PersistEngine &ar, typename std::map< Key, Value > &ob) throw(PersistException)
 deserialize a map with keys/values which both are serializeable from an engine.
 
template<class T >
PersistEngineoperator>> (PersistEngine &ar, typename std::vector< T > &ob) throw(PersistException)
 deserialize a vector of deserializable content from an engine.
 
PersistEngineoperator>> (PersistEngine &ar, uint16_t &ob) throw(PersistException)
 
PersistEngineoperator>> (PersistEngine &ar, uint32_t &ob) throw(PersistException)
 
PersistEngineoperator>> (PersistEngine &ar, uint8_t &ob) throw(PersistException)
 

Detailed Description

Stream serialization of persistent classes.

This class constructs on a standard C++ STL stream and then operates in the mode specified. The stream passed into the constructor must be a binary mode to function properly.

Author
Daniel Silverstone

Definition at line 194 of file persist.h.

Member Enumeration Documentation

◆ EngineMode

These are the modes the Persistence::Engine can work in.

Definition at line 203 of file persist.h.

Constructor & Destructor Documentation

◆ PersistEngine()

ost::PersistEngine::PersistEngine ( std::iostream & stream,
EngineMode mode )
throw (PersistException )

Constructs a Persistence::Engine with the specified stream in the given mode.

The stream must be initialized properly prior to this call or problems will ensue.

Member Function Documentation

◆ read() [1/9]

void ost::PersistEngine::read ( bool & i)
throw (PersistException )
inline

Definition at line 272 of file persist.h.

◆ read() [2/9]

void ost::PersistEngine::read ( double & i)
throw (PersistException )
inline

Definition at line 271 of file persist.h.

◆ read() [3/9]

void ost::PersistEngine::read ( float & i)
throw (PersistException )
inline

Definition at line 270 of file persist.h.

◆ read() [4/9]

void ost::PersistEngine::read ( int16_t & i)
throw (PersistException )
inline

Definition at line 266 of file persist.h.

◆ read() [5/9]

void ost::PersistEngine::read ( int32_t & i)
throw (PersistException )
inline

Definition at line 268 of file persist.h.

◆ read() [6/9]

void ost::PersistEngine::read ( int8_t & i)
throw (PersistException )
inline

Definition at line 264 of file persist.h.

◆ read() [7/9]

void ost::PersistEngine::read ( uint16_t & i)
throw (PersistException )
inline

Definition at line 267 of file persist.h.

◆ read() [8/9]

void ost::PersistEngine::read ( uint32_t & i)
throw (PersistException )
inline

Definition at line 269 of file persist.h.

◆ read() [9/9]

void ost::PersistEngine::read ( uint8_t & i)
throw (PersistException )
inline

Definition at line 265 of file persist.h.

◆ write() [1/10]

void ost::PersistEngine::write ( bool i)
throw (PersistException )
inline

Definition at line 241 of file persist.h.

◆ write() [2/10]

void ost::PersistEngine::write ( const PersistObject & object)
throw (PersistException )
inline

writes a PersistObject from a reference.

Definition at line 222 of file persist.h.

◆ write() [3/10]

void ost::PersistEngine::write ( double i)
throw (PersistException )
inline

Definition at line 240 of file persist.h.

◆ write() [4/10]

void ost::PersistEngine::write ( float i)
throw (PersistException )
inline

Definition at line 239 of file persist.h.

◆ write() [5/10]

void ost::PersistEngine::write ( int16_t i)
throw (PersistException )
inline

Definition at line 235 of file persist.h.

◆ write() [6/10]

void ost::PersistEngine::write ( int32_t i)
throw (PersistException )
inline

Definition at line 237 of file persist.h.

◆ write() [7/10]

void ost::PersistEngine::write ( int8_t i)
throw (PersistException )
inline

Definition at line 233 of file persist.h.

◆ write() [8/10]

void ost::PersistEngine::write ( uint16_t i)
throw (PersistException )
inline

Definition at line 236 of file persist.h.

◆ write() [9/10]

void ost::PersistEngine::write ( uint32_t i)
throw (PersistException )
inline

Definition at line 238 of file persist.h.

◆ write() [10/10]

void ost::PersistEngine::write ( uint8_t i)
throw (PersistException )
inline

Definition at line 234 of file persist.h.

Friends And Related Symbol Documentation

◆ operator<<() [1/16]

PersistEngine & operator<< ( PersistEngine & ar,
bool ob )
throw(PersistException )
related

Definition at line 378 of file persist.h.

◆ operator<<() [2/16]

PersistEngine & operator<< ( PersistEngine & ar,
double ob )
throw(PersistException )
related

Definition at line 368 of file persist.h.

◆ operator<<() [3/16]

PersistEngine & operator<< ( PersistEngine & ar,
float ob )
throw(PersistException )
related

Definition at line 363 of file persist.h.

◆ operator<<() [4/16]

PersistEngine & operator<< ( PersistEngine & ar,
int16_t ob )
throw(PersistException )
related

Definition at line 343 of file persist.h.

◆ operator<<() [5/16]

PersistEngine & operator<< ( PersistEngine & ar,
int32_t ob )
throw(PersistException )
related

Definition at line 353 of file persist.h.

◆ operator<<() [6/16]

PersistEngine & operator<< ( PersistEngine & ar,
int8_t ob )
throw(PersistException )
related

Definition at line 333 of file persist.h.

◆ operator<<() [7/16]

PersistEngine & operator<< ( PersistEngine & ar,
PersistObject const & ob )
throw(PersistException )
related

Definition at line 326 of file persist.h.

◆ operator<<() [8/16]

PersistEngine & operator<< ( PersistEngine & ar,
PersistObject const * ob )
throw(PersistException )
related

Definition at line 328 of file persist.h.

◆ operator<<() [9/16]

template<class x , class y >
PersistEngine & operator<< ( PersistEngine & ar,
std::pair< x, y > & ob )
throw(PersistException )
related

serialize a pair of some serializable content to the engine.

Definition at line 491 of file persist.h.

◆ operator<<() [10/16]

PersistEngine & operator<< ( PersistEngine & ar,
std::string ob )
throw(PersistException )
related

Definition at line 373 of file persist.h.

◆ operator<<() [11/16]

template<class T >
PersistEngine & operator<< ( PersistEngine & ar,
typename std::deque< T > const & ob )
throw(PersistException )
related

serialize a deque of some serializable content to the engine

Definition at line 424 of file persist.h.

◆ operator<<() [12/16]

template<class Key , class Value >
PersistEngine & operator<< ( PersistEngine & ar,
typename std::map< Key, Value > const & ob )
throw(PersistException )
related

serialize a map with keys/values which both are serializeable to an engine.

Definition at line 459 of file persist.h.

◆ operator<<() [13/16]

template<class T >
PersistEngine & operator<< ( PersistEngine & ar,
typename std::vector< T > const & ob )
throw(PersistException )
related

The following are template classes.

serialize a vector of some serializable content to the engine

Definition at line 393 of file persist.h.

◆ operator<<() [14/16]

PersistEngine & operator<< ( PersistEngine & ar,
uint16_t ob )
throw(PersistException )
related

Definition at line 348 of file persist.h.

◆ operator<<() [15/16]

PersistEngine & operator<< ( PersistEngine & ar,
uint32_t ob )
throw(PersistException )
related

Definition at line 358 of file persist.h.

◆ operator<<() [16/16]

PersistEngine & operator<< ( PersistEngine & ar,
uint8_t ob )
throw(PersistException )
related

Definition at line 338 of file persist.h.

◆ operator>>() [1/16]

PersistEngine & operator>> ( PersistEngine & ar,
bool & ob )
throw(PersistException )
related

Definition at line 376 of file persist.h.

◆ operator>>() [2/16]

PersistEngine & operator>> ( PersistEngine & ar,
double & ob )
throw(PersistException )
related

Definition at line 366 of file persist.h.

◆ operator>>() [3/16]

PersistEngine & operator>> ( PersistEngine & ar,
float & ob )
throw(PersistException )
related

Definition at line 361 of file persist.h.

◆ operator>>() [4/16]

PersistEngine & operator>> ( PersistEngine & ar,
int16_t & ob )
throw(PersistException )
related

Definition at line 341 of file persist.h.

◆ operator>>() [5/16]

PersistEngine & operator>> ( PersistEngine & ar,
int32_t & ob )
throw(PersistException )
related

Definition at line 351 of file persist.h.

◆ operator>>() [6/16]

PersistEngine & operator>> ( PersistEngine & ar,
int8_t & ob )
throw(PersistException )
related

Definition at line 331 of file persist.h.

◆ operator>>() [7/16]

PersistEngine & operator>> ( PersistEngine & ar,
PersistObject & ob )
throw(PersistException )
related

Definition at line 322 of file persist.h.

◆ operator>>() [8/16]

PersistEngine & operator>> ( PersistEngine & ar,
PersistObject *& ob )
throw(PersistException )
related

Definition at line 324 of file persist.h.

◆ operator>>() [9/16]

template<class x , class y >
PersistEngine & operator>> ( PersistEngine & ar,
std::pair< x, y > & ob )
throw(PersistException )
related

deserialize a pair of some serializable content to the engine.

Definition at line 502 of file persist.h.

◆ operator>>() [10/16]

PersistEngine & operator>> ( PersistEngine & ar,
std::string & ob )
throw(PersistException )
related

Definition at line 371 of file persist.h.

◆ operator>>() [11/16]

template<class T >
PersistEngine & operator>> ( PersistEngine & ar,
typename std::deque< T > & ob )
throw(PersistException )
related

deserialize a deque of deserializable content from an engine.

Definition at line 438 of file persist.h.

◆ operator>>() [12/16]

template<class Key , class Value >
PersistEngine & operator>> ( PersistEngine & ar,
typename std::map< Key, Value > & ob )
throw(PersistException )
related

deserialize a map with keys/values which both are serializeable from an engine.

Definition at line 473 of file persist.h.

◆ operator>>() [13/16]

template<class T >
PersistEngine & operator>> ( PersistEngine & ar,
typename std::vector< T > & ob )
throw(PersistException )
related

deserialize a vector of deserializable content from an engine.

Definition at line 407 of file persist.h.

◆ operator>>() [14/16]

PersistEngine & operator>> ( PersistEngine & ar,
uint16_t & ob )
throw(PersistException )
related

Definition at line 346 of file persist.h.

◆ operator>>() [15/16]

PersistEngine & operator>> ( PersistEngine & ar,
uint32_t & ob )
throw(PersistException )
related

Definition at line 356 of file persist.h.

◆ operator>>() [16/16]

PersistEngine & operator>> ( PersistEngine & ar,
uint8_t & ob )
throw(PersistException )
related

Definition at line 336 of file persist.h.


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