vpr::ObjectWriter Class Reference

Interface used to write object data to a stream. More...

#include <vpr/IO/ObjectWriter.h>

Inheritance diagram for vpr::ObjectWriter:

Inheritance graph
[legend]
Collaboration diagram for vpr::ObjectWriter:

Collaboration graph
[legend]
List of all members.

Public Member Functions

virtual ~ObjectWriter ()
bool isBinary ()
 Returns true if the writer is using a binary based format.
virtual vpr::ReturnStatus writeUint8 (vpr::Uint8 val)=0
virtual vpr::ReturnStatus writeUint16 (vpr::Uint16 val)=0
virtual vpr::ReturnStatus writeUint32 (vpr::Uint32 val)=0
virtual vpr::ReturnStatus writeUint64 (vpr::Uint64 val)=0
virtual vpr::ReturnStatus writeFloat (float val)=0
virtual vpr::ReturnStatus writeDouble (double val)=0
virtual vpr::ReturnStatus writeString (std::string val)=0
virtual vpr::ReturnStatus writeBool (bool val)=0
Tag and attribute handling.
ObjectReader and ObjectWriter support an interface that allows for using tags and attributes in the written output data.

This allows support for formats such as XML where there is a logical grouping of the data.

Tags are similar to the XML concept of elements. They are used to deliniate a hierarchical group in the structure of the data. Attributes are similar to XML attributes in that they are properties of the most recently started tag.

The structure looks something like the following (based on XML):

<tag1>
   <tag2 attrib1="XXX">
   </tag2>
</tag1>


virtual vpr::ReturnStatus beginTag (const std::string &tagName)=0
 Starts a new section/element of name tagName.
virtual vpr::ReturnStatus endTag ()=0
 Ends the most recently named tag.
virtual vpr::ReturnStatus beginAttribute (const std::string &attributeName)=0
 Starts an attribute of the name attributeName.
virtual vpr::ReturnStatus endAttribute ()=0
 Ends the most recently named attribute.

Protected Member Functions

 ObjectWriter ()
 ObjectWriter (const ObjectWriter &o)

Protected Attributes

bool mIsBinary
 Is this a binary serializer?

Detailed Description

Interface used to write object data to a stream.

Todo:
Add smart buffering for type sizes.

Definition at line 61 of file ObjectWriter.h.


Constructor & Destructor Documentation

vpr::ObjectWriter::ObjectWriter (  )  [protected]

Definition at line 50 of file ObjectWriter.cpp.

00051    : mIsBinary(false)
00052 {
00053    ;
00054 }

vpr::ObjectWriter::ObjectWriter ( const ObjectWriter o  )  [protected]

Definition at line 56 of file ObjectWriter.cpp.

00057    : AttributeMapBase(o)
00058    , mIsBinary(false)
00059 {
00060    ;
00061 }

vpr::ObjectWriter::~ObjectWriter (  )  [virtual]

Definition at line 63 of file ObjectWriter.cpp.

00064 {
00065    ;
00066 }


Member Function Documentation

bool vpr::ObjectWriter::isBinary (  )  [inline]

Returns true if the writer is using a binary based format.

This can be used to choose whether to use human-readable forms of serialization.

Definition at line 76 of file ObjectWriter.h.

00077    {
00078       return mIsBinary;
00079    }

virtual vpr::ReturnStatus vpr::ObjectWriter::beginTag ( const std::string &  tagName  )  [pure virtual]

Starts a new section/element of name tagName.

Implemented in vpr::BufferObjectWriter, and vpr::XMLObjectWriter.

virtual vpr::ReturnStatus vpr::ObjectWriter::endTag (  )  [pure virtual]

Ends the most recently named tag.

Implemented in vpr::BufferObjectWriter, and vpr::XMLObjectWriter.

virtual vpr::ReturnStatus vpr::ObjectWriter::beginAttribute ( const std::string &  attributeName  )  [pure virtual]

Starts an attribute of the name attributeName.

Implemented in vpr::BufferObjectWriter, and vpr::XMLObjectWriter.

virtual vpr::ReturnStatus vpr::ObjectWriter::endAttribute (  )  [pure virtual]

Ends the most recently named attribute.

Implemented in vpr::BufferObjectWriter, and vpr::XMLObjectWriter.

virtual vpr::ReturnStatus vpr::ObjectWriter::writeUint8 ( vpr::Uint8  val  )  [pure virtual]

Implemented in vpr::BufferObjectWriter, and vpr::XMLObjectWriter.

Referenced by vpr::GUID::writeObject().

virtual vpr::ReturnStatus vpr::ObjectWriter::writeUint16 ( vpr::Uint16  val  )  [pure virtual]

Implemented in vpr::BufferObjectWriter, and vpr::XMLObjectWriter.

Referenced by vpr::GUID::writeObject().

virtual vpr::ReturnStatus vpr::ObjectWriter::writeUint32 ( vpr::Uint32  val  )  [pure virtual]

Implemented in vpr::BufferObjectWriter, and vpr::XMLObjectWriter.

Referenced by vpr::GUID::writeObject().

virtual vpr::ReturnStatus vpr::ObjectWriter::writeUint64 ( vpr::Uint64  val  )  [pure virtual]

Implemented in vpr::BufferObjectWriter, and vpr::XMLObjectWriter.

virtual vpr::ReturnStatus vpr::ObjectWriter::writeFloat ( float  val  )  [pure virtual]

Implemented in vpr::BufferObjectWriter, and vpr::XMLObjectWriter.

virtual vpr::ReturnStatus vpr::ObjectWriter::writeDouble ( double  val  )  [pure virtual]

Implemented in vpr::BufferObjectWriter, and vpr::XMLObjectWriter.

virtual vpr::ReturnStatus vpr::ObjectWriter::writeString ( std::string  val  )  [pure virtual]

Implemented in vpr::BufferObjectWriter, and vpr::XMLObjectWriter.

virtual vpr::ReturnStatus vpr::ObjectWriter::writeBool ( bool  val  )  [pure virtual]

Implemented in vpr::BufferObjectWriter, and vpr::XMLObjectWriter.


Member Data Documentation

bool vpr::ObjectWriter::mIsBinary [protected]

Is this a binary serializer?

Definition at line 126 of file ObjectWriter.h.

Referenced by vpr::BufferObjectWriter::BufferObjectWriter().


The documentation for this class was generated from the following files:
Generated on Thu Jan 4 10:55:08 2007 for VR Juggler Portable Runtime by  doxygen 1.5.1