StreamSerializer Class Reference

StreamSerializer Class Referenceabstract

#include <adskDataStreamSerializer.h>

Class Description

Class handling the definition of the format for serialization of data streams.

The adsk::Data::Stream class manages stream definitions. They are persisted using a serialization format implemented through the adsk::Data::StreamSerializer hierarchy. The base class defines the interface and manages the list of available stream serialization formats.

+ Examples:

Public Member Functions

 StreamSerializer ()
 Default constructor, does nothing.
 
virtual ~StreamSerializer ()
 Default destructor, does nothing.
 
virtual Streamread (std::istream &cSrc, std::string &errors) const =0
 Implement this to parse the serialized form of an adsk::Data::Stream object. More...
 
virtual int write (const Stream &dataToWrite, std::ostream &cDst, std::string &errors) const =0
 Implement this to output the adsk::Data::Stream definition in your serialization format. More...
 
virtual void getFormatDescription (std::ostream &info) const =0
 Implement this to provide a description of your adsk::Data::Stream serialization format. More...
 

Member Function Documentation

Stream * read ( std::istream &  cSrc,
std::string &  errors 
) const
pure virtual

Implement this to parse the serialized form of an adsk::Data::Stream object.

Given an input stream containing your serialization of an adsk::Data::Stream object parse the data and create the adsk::Data::Stream object it describes.

If there are any problems the detailed error information should be returned in the errors string.

The adsk::Data::Stream parsing should also recursively populate any data within the adsk::Data::Stream. This method should be capable of understanding any data which your adsk::Data::StreamSerializer::write method can provide.

Parameters
[in]cSrcInput stream containing serialization of the adsk::Data::Stream
[out]errorsString containing description of parse errors
Returns
Pointer to the newly created adsk::Data::Stream object
int write ( const Stream dataToWrite,
std::ostream &  cDst,
std::string &  errors 
) const
pure virtual

Implement this to output the adsk::Data::Stream definition in your serialization format.

Given an adsk::Data::Stream object and an output stream as destination write out enough information so that you can recreate the adsk::Data::Stream from data in the output stream using your adsk::Data::StreamSerializer::read() method.

This serialization should include all data values within the adsk::Data::Stream obejct.

Parameters
[in]dataToWriteadsk::Data::Stream to be serialized
[out]cDststream to which the object is to be serialized
[out]errorsString containing description of write errors
Returns
number of errors found during write (0 means success)
void getFormatDescription ( std::ostream &  info) const
pure virtual

Implement this to provide a description of your adsk::Data::Stream serialization format.

Output a textual description of your serialization format into the given stream.

Parameters
[out]infostream in which to output your serialization format description

The documentation for this class was generated from the following files:
  • adskDataStreamSerializer.h
  • adskDataStreamSerializer.cpp