Main Page   Class Hierarchy   Compound List   File List   Compound Members   File Members  

iserial Class Reference

Inherited by iserialdata, and iserialstring.

List of all members.


Detailed Description

An iserial is analogous to an ObjectInputStream in Java.

To deserialize objects:

  1. Create an istream object.
  2. Create an iserial object pointing to that ostream.
  3. Read objects from the oserial object using the >> operator.
Please refer to the oserial documentation for a more in-depth description and example.


Public Types

enum  {
  typesafe, readable, binary, compact,
  automatic
}

Public Methods

 iserial (int mode=automatic)
 Constructor.

virtual ~iserial ()
void init ()
 operator const void * () const
 Returns a null value if an error has occured, or a non-null value if deserialization has succeeded.

status stat ()
 Returns an error description if some aspect of serialization has failed.

void set_error (const string &s)
 Indicates that an aspect of serialization has failed and sets the error description.

template<class T> iserial & operator>> (T &t)
 Deserializes a T.

template<class T> iserial & insert_into (T &t)
 Deserializes all remaining elements in the stream, inserting them into into t.

template<class T> iserial & push_back_into (T &t)
 Deserializes all remaining elements in the stream, appending them into into t.


Protected Methods

 iserial (const iserial &)
iserial & operator= (const iserial &)
virtual int peek ()=0
virtual int get ()=0
virtual bool get (char *ch, unsigned int len)=0
template<typename T> void default_unfreeze (ptr< T > &t)
template<typename T> void default_unfreeze (T &t)
void default_unfreeze (string &s)
void default_unfreeze (dynbuf &s)
template<typename T, typename U> void default_unfreeze (pair< T, U > &p)
template<typename Container, typename Data> void default_unfreeze_container (Container &c)
template<typename T> void default_unfreeze (vector< T > &t)
template<typename T, typename U> void default_unfreeze (map< T, U > &t)
template<typename T> void default_unfreeze (set< T > &t)
template<typename T> void read_compact_signed (T &out)
template<typename T> void read_compact_unsigned (T &out)
iserial & check_type (const char *type)
iserial & check_type (const char *type, unsigned int &actual_length)
string read_string (unsigned int length)
template<class T> T read_scalar (unsigned int length)

Protected Attributes

status st
int mode

Static Protected Attributes

const int eof = -1


Member Enumeration Documentation

anonymous enum
 

Enumeration values:
typesafe 
readable 
binary 
compact 
automatic 


Constructor & Destructor Documentation

iserial::iserial const iserial &    [protected]
 

iserial::iserial int    mode = automatic
 

Constructor.

Note that iserial automatically figures out the mode with which the stream was serialized, so there is no need to specify the mode (i.e., typesafe, binary, or compact).

virtual iserial::~iserial   [virtual]
 


Member Function Documentation

iserial& iserial::check_type const char *    type,
unsigned int &    actual_length
[protected]
 

iserial& iserial::check_type const char *    type [protected]
 

template<typename T>
void iserial::default_unfreeze set< T > &    t [protected]
 

template<typename T, typename U>
void iserial::default_unfreeze map< T, U > &    t [protected]
 

template<typename T>
void iserial::default_unfreeze vector< T > &    t [protected]
 

template<typename T, typename U>
void iserial::default_unfreeze pair< T, U > &    p [protected]
 

void iserial::default_unfreeze dynbuf   s [protected]
 

void iserial::default_unfreeze string &    s [protected]
 

template<typename T>
void iserial::default_unfreeze T &    t [protected]
 

template<typename T>
void iserial::default_unfreeze ptr< T > &    t [protected]
 

template<typename Container, typename Data>
void iserial::default_unfreeze_container Container &    c [protected]
 

virtual bool iserial::get char *    ch,
unsigned int    len
[protected, pure virtual]
 

Implemented in iserialdata, and iserialstring.

virtual int iserial::get   [protected, pure virtual]
 

Implemented in iserialdata, and iserialstring.

void iserial::init  
 

template<class T>
iserial& iserial::insert_into T &    t
 

Deserializes all remaining elements in the stream, inserting them into into t.

T must be a container type with a single-argument insert defined (e.g., map) and T::value_type must be defined (as in STL container types).

iserial::operator const void *   const
 

Returns a null value if an error has occured, or a non-null value if deserialization has succeeded.

Exists to facilitate the "if (my_iserial) { ... }" metaphor to test whether an error has occurred on my_iserial.

iserial& iserial::operator= const iserial &    [protected]
 

template<class T>
iserial& iserial::operator>> T &    t
 

Deserializes a T.

virtual int iserial::peek   [protected, pure virtual]
 

Implemented in iserialdata, and iserialstring.

template<class T>
iserial& iserial::push_back_into T &    t
 

Deserializes all remaining elements in the stream, appending them into into t.

T must be a container type with push_back defined (e.g., vector) and T::value_type must be defined (as in STL container types).

template<typename T>
void iserial::read_compact_signed T &    out [protected]
 

template<typename T>
void iserial::read_compact_unsigned T &    out [protected]
 

template<class T>
T iserial::read_scalar unsigned int    length [protected]
 

string iserial::read_string unsigned int    length [protected]
 

void iserial::set_error const string &    s
 

Indicates that an aspect of serialization has failed and sets the error description.

status iserial::stat  
 

Returns an error description if some aspect of serialization has failed.


Member Data Documentation

const int iserial::eof = -1 [static, protected]
 

int iserial::mode [protected]
 

status iserial::st [protected]
 


The documentation for this class was generated from the following file:
Generated on Fri Dec 20 13:35:10 2002 for NMSTL