version 3.3

VRS::Document Class Reference

Class for the actual use of the VRS serialization mechanism. More...

#include <vrs/io/document.h>

Inheritance diagram for VRS::Document:

VRS::SerializationManager VRS::SharedObj VRS::Visitable

List of all members.

Public Types

enum  DocMode { Reading, Writing, Scanning, Reserved }

Public Member Functions

 Document (const std::string &creator="unknown")
 Constructs an empty document.
virtual ~Document ()
const std::string & creator () const
 Returns the creator string.
const std::string & creationDate () const
 Returns the creation date as string.
unsigned int versionMajor () const
 Returns the major version number of the document format (only for debugging).
unsigned int versionMinor () const
 Returns the minor version number of the document format (only for debugging).
bool isVersion (unsigned int major, unsigned int minor) const
 Returns if the read/written document is at least of this version.
bool addObject (SharedObj *obj)
 Adds an object to the document.
bool addObject (SharedObj *obj, const std::string &name)
 Adds an object to the document with an explicitly given name.
bool removeObject (SharedObj *obj)
 Removes an object.
bool removeObject (const std::string &name)
 Removes an object by its name.
void clearObjects ()
 Removes all objects from the document.
SharedObjobject (const std::string &name) const
 Returns an object by its name.
int objects () const
 Returns the number of objects stored.
Iterator< SO< SharedObj > > * objectIterator () const
 Returns an iterator for all explicitely added objects.
Iterator< SO< SharedObj > > * scanObjects ()
 Find those objects, that are implicitely given by the held ones.
void writeDocument (std::ostream &)
 Writes the document to the given stream.
void writeDocument (const std::string &filename)
 Writes the document to the given file.
std::ostream & output ()
 Returns the stream the document is written to.
void readDocument (std::istream &, const unsigned int &size=0)
 Reads the document from a given stream.
void readDocument (const std::string &filename)
 Reads the document from a given file.
std::istream & input ()
 Returns the stream the document is read from.
 VRS_SERIALIZABLE_CLASS_ENUM (DocMode)
DocMode mode () const
 Returns the operation mode.
virtual bool isReading () const
virtual bool skipDefaultValues () const
virtual void startClass (const std::string &classID, const std::string &attributeName)
virtual void endClass (const std::string &classID, const std::string &attributeName)
virtual void classVersion (UINT8 &version)
virtual void serialize (const std::string &attributeName, bool &attributeValue)
virtual void serialize (const std::string &attributeName, UINT8 &attributeValue)
virtual void serialize (const std::string &attributeName, INT8 &attributeValue)
virtual void serialize (const std::string &attributeName, UINT16 &attributeValue)
virtual void serialize (const std::string &attributeName, INT16 &attributeValue)
virtual void serialize (const std::string &attributeName, UINT32 &attributeValue)
virtual void serialize (const std::string &attributeName, INT32 &attributeValue)
virtual void serialize (const std::string &attributeName, UINT64 &attributeValue)
virtual void serialize (const std::string &attributeName, INT64 &attributeValue)
virtual void serialize (const std::string &attributeName, float &attributeValue)
virtual void serialize (const std::string &attributeName, double &attributeValue)
virtual void serialize (const std::string &attributeName, std::string &attributeValue)
virtual void serialize (const std::string &attributeName, ID &attributeValue)
virtual void serialize (const std::string &attributeName, Color &attributeValue)
virtual void serialize (const std::string &attributeName, Vector &attributeValue)
virtual void serialize (const std::string &attributeName, SharedObj *&attributeValue, const std::string &knownType)
virtual void serialize (const std::string &attributeName, void *pointer, unsigned int bytes)
 VRS_TYPEINFO (Document, SerializationManager)


Detailed Description

Class for the actual use of the VRS serialization mechanism.

A Document collects objects. It can store them to a file or read them from a file. Each document contains a creator-string, which identifies the producer. There are document specific exceptions: DocFormatError and DocStreamError. They are defined in exception.h


Member Enumeration Documentation

Enumerator:
Reading 
Writing 
Scanning 
Reserved 


Constructor & Destructor Documentation

VRS::Document::Document ( const std::string &  creator = "unknown"  ) 

Constructs an empty document.

virtual VRS::Document::~Document (  )  [virtual]


Member Function Documentation

const std::string& VRS::Document::creator (  )  const

Returns the creator string.

const std::string& VRS::Document::creationDate (  )  const

Returns the creation date as string.

unsigned int VRS::Document::versionMajor (  )  const

Returns the major version number of the document format (only for debugging).

unsigned int VRS::Document::versionMinor (  )  const

Returns the minor version number of the document format (only for debugging).

bool VRS::Document::isVersion ( unsigned int  major,
unsigned int  minor 
) const

Returns if the read/written document is at least of this version.

bool VRS::Document::addObject ( SharedObj obj  ) 

Adds an object to the document.

The object must have a name set (see Sharedobj).

bool VRS::Document::addObject ( SharedObj obj,
const std::string &  name 
)

Adds an object to the document with an explicitly given name.

The object does not need to have a name set (see Sharedobj).

bool VRS::Document::removeObject ( SharedObj obj  ) 

Removes an object.

Objects cannot be removed during read or write operations. The object must have a name set (see Sharedobj).

bool VRS::Document::removeObject ( const std::string &  name  ) 

Removes an object by its name.

Objects cannot be removed during read or write operations.

void VRS::Document::clearObjects (  ) 

Removes all objects from the document.

Object cannot be removed during read or write operations.

SharedObj* VRS::Document::object ( const std::string &  name  )  const

Returns an object by its name.

int VRS::Document::objects (  )  const

Returns the number of objects stored.

Iterator<SO<SharedObj> >* VRS::Document::objectIterator (  )  const

Returns an iterator for all explicitely added objects.

Iterator<SO<SharedObj> >* VRS::Document::scanObjects (  ) 

Find those objects, that are implicitely given by the held ones.

void VRS::Document::writeDocument ( std::ostream &   ) 

Writes the document to the given stream.

void VRS::Document::writeDocument ( const std::string &  filename  ) 

Writes the document to the given file.

std::ostream& VRS::Document::output (  ) 

Returns the stream the document is written to.

It can only be requested while writing the document. It is needed by the objects when serializing.

void VRS::Document::readDocument ( std::istream &  ,
const unsigned int &  size = 0 
)

Reads the document from a given stream.

If known, the size can be given for exact progress information.

void VRS::Document::readDocument ( const std::string &  filename  ) 

Reads the document from a given file.

std::istream& VRS::Document::input (  ) 

Returns the stream the document is read from.

It can only be requested while reading the document. It is needed by the objects when deserializing.

VRS::Document::VRS_SERIALIZABLE_CLASS_ENUM ( DocMode   ) 

DocMode VRS::Document::mode (  )  const

Returns the operation mode.

virtual bool VRS::Document::isReading (  )  const [virtual]

virtual bool VRS::Document::skipDefaultValues (  )  const [virtual]

virtual void VRS::Document::startClass ( const std::string &  classID,
const std::string &  attributeName 
) [virtual]

virtual void VRS::Document::endClass ( const std::string &  classID,
const std::string &  attributeName 
) [virtual]

virtual void VRS::Document::classVersion ( UINT8 version  )  [virtual]

virtual void VRS::Document::serialize ( const std::string &  attributeName,
bool &  attributeValue 
) [virtual]

virtual void VRS::Document::serialize ( const std::string &  attributeName,
UINT8 attributeValue 
) [virtual]

virtual void VRS::Document::serialize ( const std::string &  attributeName,
INT8 attributeValue 
) [virtual]

virtual void VRS::Document::serialize ( const std::string &  attributeName,
UINT16 attributeValue 
) [virtual]

virtual void VRS::Document::serialize ( const std::string &  attributeName,
INT16 attributeValue 
) [virtual]

virtual void VRS::Document::serialize ( const std::string &  attributeName,
UINT32 attributeValue 
) [virtual]

virtual void VRS::Document::serialize ( const std::string &  attributeName,
INT32 attributeValue 
) [virtual]

virtual void VRS::Document::serialize ( const std::string &  attributeName,
UINT64 attributeValue 
) [virtual]

virtual void VRS::Document::serialize ( const std::string &  attributeName,
INT64 attributeValue 
) [virtual]

virtual void VRS::Document::serialize ( const std::string &  attributeName,
float &  attributeValue 
) [virtual]

virtual void VRS::Document::serialize ( const std::string &  attributeName,
double &  attributeValue 
) [virtual]

virtual void VRS::Document::serialize ( const std::string &  attributeName,
std::string &  attributeValue 
) [virtual]

virtual void VRS::Document::serialize ( const std::string &  attributeName,
ID attributeValue 
) [virtual]

virtual void VRS::Document::serialize ( const std::string &  attributeName,
Color attributeValue 
) [virtual]

virtual void VRS::Document::serialize ( const std::string &  attributeName,
Vector attributeValue 
) [virtual]

virtual void VRS::Document::serialize ( const std::string &  attributeName,
SharedObj *&  attributeValue,
const std::string &  knownType 
) [virtual]

virtual void VRS::Document::serialize ( const std::string &  attributeName,
void *  pointer,
unsigned int  bytes 
) [virtual]

VRS::Document::VRS_TYPEINFO ( Document  ,
SerializationManager   
)


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

Generated on Mon May 21 06:00:18 2012 by Doxygen 1.5.6
© 2001-2010 Hasso-Plattner-Institut | Impressum | Contact