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

serial File Reference


Detailed Description

Object serialization.

#include <nmstl/internal.h>
#include <nmstl/io>
#include <iostream>
#include <string>
#include <vector>
#include <map>
#include <set>
#include <nmstl/ntime>

Compounds

class  iserial
 An iserial is analogous to an ObjectInputStream in Java. More...

class  iserialdata
class  iserialstring
class  oserial
 An oserial is analogous to an ObjectOutputStream in Java. More...

class  oserialstream
class  oserialstring

Defines

#define NMSTL_SERIALIZABLE(T)
 Declares a class T as serializable.

#define NMSTL_NO_FIELDS
#define NMSTL_SIMPLE_SERIALIZATION(fields)
#define NMSTL_SIMPLE_VIRTUAL_SERIALIZATION(fields)
#define NMSTL_SIMPLE_VIRTUAL_SERIALIZATION_SUPER(Super, fields)
#define NMSTL_TYPEID(T, keytype)
#define NMSTL_BASE_CLASS(T, keytype)
#define NMSTL_SERIAL(T, fields)   public: NMSTL_SERIALIZABLE(T) NMSTL_SIMPLE_SERIALIZATION(fields)
 Declares a class as T as simply serializable, i.e., specifies that T can be read or written simply by reading or writing a set of instance variables.

#define NMSTL_SIMPLY_SERIALIZABLE(T, fields)   public: NMSTL_SERIALIZABLE(T) NMSTL_SIMPLE_SERIALIZATION(fields)
#define NMSTL_SIMPLY_SERIALIZABLE_BASE_CLASS(T, fields)
#define NMSTL_SIMPLY_SERIALIZABLE_SUBCLASS(T, Super, fields)
#define NMSTL_SIMPLY_SERIALIZABLE_BASE_CLASS_WITH_ID(T, keytype, fields)
#define NMSTL_SIMPLY_SERIALIZABLE_SUBCLASS_WITH_ID(T, Super, fields)
#define NMSTL_SERIAL_BASE(T, keytype, fields)   NMSTL_SIMPLY_SERIALIZABLE_BASE_CLASS_WITH_ID(T, keytype, fields)
#define NMSTL_SERIAL_SUBCLASS(T, Super, fields)   NMSTL_SIMPLY_SERIALIZABLE_SUBCLASS_WITH_ID(T, Super, fields)
#define NMSTL_SERIAL_DEFINE(T, key)

Functions

void freeze (oserial &out, const ntime &m)
void unfreeze (iserial &in, ntime &m)

Variables

 NMSTL_NAMESPACE_BEGIN
 NMSTL_NAMESPACE_END


Define Documentation

#define NMSTL_BASE_CLASS T,
keytype   
 

Value:

NMSTL_TYPEID(T, keytype) \
static iserial::reg<keytype, T>& __nmstl_serialreg() { static iserial::reg<keytype, T> r; return r; } \
static string typename_for_typeid(keytype id) { return __nmstl_serialreg().typename_for_typeid(id); }

#define NMSTL_NO_FIELDS
 

#define NMSTL_SERIAL T,
fields       public: NMSTL_SERIALIZABLE(T) NMSTL_SIMPLE_SERIALIZATION(fields)
 

Declares a class as T as simply serializable, i.e., specifies that T can be read or written simply by reading or writing a set of instance variables.

Should be included inside a class declaration. The second argument should be the list of variables to be read/written, each prefixed with the << operator (see the oserial documentation for usage).

For base classes, you should use NMSTL_SIMPLY_SERIALIZABLE_BASE_CLASS instead of this macro. For subclasses, use NMSTL_SIMPLY_SERIALIZABLE_SUBCLASS instead.

#define NMSTL_SERIAL_BASE T,
keytype,
fields       NMSTL_SIMPLY_SERIALIZABLE_BASE_CLASS_WITH_ID(T, keytype, fields)
 

#define NMSTL_SERIAL_DEFINE T,
key   
 

Value:

const bool T::__nmstl_serial_registered = T::__nmstl_serial_register(); \
const T::typeid_type T::__nmstl_serial_class_typeid = key;

#define NMSTL_SERIAL_SUBCLASS T,
Super,
fields       NMSTL_SIMPLY_SERIALIZABLE_SUBCLASS_WITH_ID(T, Super, fields)
 

#define NMSTL_SERIALIZABLE  
 

Value:

friend inline void freeze(::nmstl::oserial &out, const T& m) { out.begin_container(m); m.freeze(out); out.end_container(m); } \
friend inline void unfreeze(::nmstl::iserial &in, T& m) { in.begin_container<T>(); if (in) m.unfreeze(in); in.end_container<T>(); }
Declares a class T as serializable.

Should be included inside T's class declaration (see the oserial documentation for usage).

#define NMSTL_SIMPLE_SERIALIZATION fields   
 

Value:

void freeze(::nmstl::oserial& out) const { if (out fields) ; } \
void unfreeze(::nmstl::iserial& in) { (*::nmstl::__iserial_adaptor(in)) fields; }

#define NMSTL_SIMPLE_VIRTUAL_SERIALIZATION fields   
 

Value:

virtual void freeze(::nmstl::oserial& out) const { if (out fields) ; } \
virtual void unfreeze(::nmstl::iserial& in) { (*::nmstl::__iserial_adaptor(in)) fields; }

#define NMSTL_SIMPLE_VIRTUAL_SERIALIZATION_SUPER Super,
fields   
 

Value:

virtual void freeze(::nmstl::oserial& out) const { Super::freeze(out); if (out fields) ; } \
virtual void unfreeze(::nmstl::iserial& in) { Super::unfreeze(in); (*::nmstl::__iserial_adaptor(in)) fields; }

#define NMSTL_SIMPLY_SERIALIZABLE T,
fields       public: NMSTL_SERIALIZABLE(T) NMSTL_SIMPLE_SERIALIZATION(fields)
 

#define NMSTL_SIMPLY_SERIALIZABLE_BASE_CLASS T,
fields   
 

Value:

public: NMSTL_SERIALIZABLE(T) NMSTL_SIMPLE_VIRTUAL_SERIALIZATION(fields) \
          NMSTL_BASE_CLASS(T, string, typeid(T).name())

#define NMSTL_SIMPLY_SERIALIZABLE_BASE_CLASS_WITH_ID T,
keytype,
fields   
 

Value:

#define NMSTL_SIMPLY_SERIALIZABLE_SUBCLASS T,
Super,
fields   
 

Value:

public: NMSTL_SERIALIZABLE(T) NMSTL_SIMPLE_VIRTUAL_SERIALIZATION_SUPER(Super, fields) \
          NMSTL_TYPEID(T, string, typeid(T).name())

#define NMSTL_SIMPLY_SERIALIZABLE_SUBCLASS_WITH_ID T,
Super,
fields   
 

Value:

public: NMSTL_SERIALIZABLE(T) NMSTL_SIMPLE_VIRTUAL_SERIALIZATION_SUPER(Super, fields) \
          NMSTL_TYPEID(T, Super::typeid_type)

#define NMSTL_TYPEID T,
keytype   
 

Value:

typedef keytype typeid_type; \
static const typeid_type __nmstl_serial_class_typeid; \
virtual typeid_type get_typeid() const { return __nmstl_serial_class_typeid; } \
virtual string get_typename() const { return #T; } \
static typeid_type class_typeid() { return __nmstl_serial_class_typeid; } \
static string class_typename() { return #T; } \
static bool __nmstl_serial_register() { return __nmstl_serialreg().add<T>(#T); } \
static const bool __nmstl_serial_registered;


Function Documentation

void freeze oserial   out,
const ntime   m
 

void unfreeze iserial   in,
ntime   m
 


Variable Documentation

NMSTL_NAMESPACE_BEGIN
 

NMSTL_NAMESPACE_END
 


Generated on Fri Dec 20 13:35:10 2002 for NMSTL