code::AsciiDump< X > Class Template Reference

List of all members.

Detailed Description

template<class X>
class code::AsciiDump< X >

This is a template class whose requirements will be met by classes that wish to provide an ASCII dump of their contents (and to instantiate themselves from that dump).

Any class X that implements the following two functions:

  1. friend AIStream& operator >> ( AIStream& is, X& a )
  2. friend AOStream& operator << ( AOStream& os, const X& a )
  3. A default constructor (with no arguments).
will be able to provide an ASCII dump using createAsciiDump() and will be able to reconstruct itself using createObject().

It is worthwhile, however, to provide the friend functions using InputStream and OutputStream so that the same services can be used both this class and by NetworkFormat.

Author:
: Lakshman
Version:
:
Id
code_AsciiDump.h,v 1.7 2009/06/02 20:17:39 lakshman Exp
See also:
InputStream

OutputStream

NetworkFormat


Static Public Member Functions

static int createAsciiDump (const X &a, std::ostream &os, const std::string &sep_string)
 To get the Ascii dump of this object's contents.
static SmartPtr< X > createObject (std::istream &is, const std::string &sep_string)
 To get an object from its Ascii dump.

Protected Member Functions

 AsciiDump ()
 We are making this private so that no one tries to instantiate this class.
 AsciiDump (const AsciiDump &)
 We are making this private so that no one tries to instantiate this class.
AsciiDumpoperator= (const AsciiDump &)
 We are making this private so that no one tries to instantiate this class.


Constructor & Destructor Documentation

template<class X>
code::AsciiDump< X >::AsciiDump (  )  [protected]

We are making this private so that no one tries to instantiate this class.

template<class X>
code::AsciiDump< X >::AsciiDump ( const AsciiDump< X > &   )  [protected]

We are making this private so that no one tries to instantiate this class.


Member Function Documentation

template<class X>
static int code::AsciiDump< X >::createAsciiDump ( const X &  a,
std::ostream &  os,
const std::string &  sep_string 
) [inline, static]

To get the Ascii dump of this object's contents.

Parameters:
The object whose portable representation is to be obtained.
Returns:
-ve on error, zero on sucess. Error messages are sent to cerr.

template<class X>
static SmartPtr<X> code::AsciiDump< X >::createObject ( std::istream &  is,
const std::string &  sep_string 
) [inline, static]

To get an object from its Ascii dump.

Parameters:
The stream to read from.
Returns:
A SmartPtr to the created object. An error message is sent to cerr and a null pointer is returned on error.

template<class X>
AsciiDump& code::AsciiDump< X >::operator= ( const AsciiDump< X > &   )  [protected]

We are making this private so that no one tries to instantiate this class.


Generated on Fri May 4 13:40:12 2012 for WDSS-IIw2 by  doxygen 1.4.7