X3D libraries
The libraries to work with X3D dataset

x3dio::Writer Class Reference

The writer interface, implemented by any object which can convert a tree of x3d nodes to write it to a stream. More...

#include <io.h>

Inheritance diagram for x3dio::Writer:

Inheritance graph
[legend]
List of all members.

Public Member Functions

virtual bool Save (Stream *stream, const x3d::SFNode *node, ErrorCallback *callback=0)=0
 Save the specified (root) node in the output stream.
virtual ~Writer ()
 The writer destructor needs to be defined since it is virtual.

Detailed Description

The writer interface, implemented by any object which can convert a tree of x3d nodes to write it to a stream.

The Writer interface is expected to be derived from a class which can implement the Save() function.

Note that it is wise to create a separate class for the Writer and the Reader. This is so because then a player can just and only link with the reader and then avoid the unnecessary writer code (it can not only be for size, but also for security. The reader should just never write to a stream!) There should also be no real reason why you would need to have both since they both do quite different things.

You are expected to instantiate writers yourself since you should know in what format you want to save your data in.

Later I may provide a funtion which returns a writer given a MIME type. At time of writing only XML is supported anyway...


Constructor & Destructor Documentation

x3dio::Writer::~Writer  )  [virtual]
 

The writer destructor needs to be defined since it is virtual.

Cleans up the writer class. Since this is just an interface, it does nothing.


Member Function Documentation

bool x3dio::Writer::Save Stream stream,
const x3d::SFNode *  node,
ErrorCallback callback = 0
[pure virtual]
 

Save the specified (root) node in the output stream.

This function is expected to be implemented by different libraries supporting different file formats (such as XML, VRML, OBJ, RAW, etc.)

The node is always expected to be a root node (i.e. an X3D node). If the node is not of the right type, the function should fail (thought some implementations may be capable of saving just a shape or some other X3D object).

The user can specify an error callback object. In this case, any error generated in the writer will be reported to the caller. Please, see the reference about the x3dio::ErrorCallback for more information on how messages are forwarded.

Note:
The writer can only write to the stream. Some writer's may need support for the x3dio::Stream::Seek() instruction. Please, see the reference of each writer for more information about that writer.

Implemented in x3dxml::XMLWriter.


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