Hi Rafa,
I'm just merging your changes but feel that we need to add some
doxygen comments to clarify what the set*Iterator(..) and start(..)
methods relate to. My first bash at these comments follows:
/// set an input iterator, used directly when not using
InputStream with a traditional file releated stream.
void setInputIterator( InputIterator* ii ) { _in = ii; }
/// start reading from InputStream treating it as a traditional
file releated stream, handles headers and versioning
ReadType start( InputIterator* );
And
/// set an output iterator, used directly when not using
OutputStream with a traditional file releated stream.
void setOutputIterator( OutputIterator* oi ) { _out = oi; }
/// start writing to OutputStream treating it as a traditional
file releated stream, handles headers and versioning
void start( OutputIterator* outIterator, WriteType type );
Does this make sense? Feel free to suggest better wording.
Cheers,
Robert.
On Sat, May 7, 2011 at 9:12 AM, Rafa Gaitan <[email protected]> wrote:
> Hi Robert,
>
> I've been playing around with serializers in order to use it as a
> "generic" property mechanism for osg::Object.
>
> The main problem I have found is that InputStream and OutputStream
> only takes the stream when you call start method, and in that case it
> attaches to the stream buffer some stuff, useful for files but not for
> runtime/gui usage. I have added a simple setInputIterator and
> setOutputIterator to the classes so now you can easily serialize
> values without version and other stuff.
>
> Writing matrix:
> osgDB::OutputStream os(0);
> std::stringstream sstream;
> os.setOutputIterator(new AsciiOutputIterator(&sstream));
> os << matrix;
> std::string value = sstream.str();
>
> Reading matrix:
> osgDB::InputStream is(0);
> std::stringstream sstream(value);
> is.setInputIterator(new AsciiInputIterator(&sstream));
> osg::Matrixf mat2;
> is >> mat2;
>
> Maybe this can be used with the Metadata mechanism that is in
> discussion in the osg-user list, so generic values can be read by a
> GUI in a string like format, or even generic properties of objects.
>
> Cheers,
> Rafa.
>
>
> --
> Rafael Gaitán Linares
> Instituto de Automática e Informática Industrial http://www.ai2.upv.es
> http://gvsig3d.blogspot.com
> Ciudad Politécnica de la Innovación
> Universidad Politécnica de Valencia
>
> _______________________________________________
> osg-submissions mailing list
> [email protected]
> http://lists.openscenegraph.org/listinfo.cgi/osg-submissions-openscenegraph.org
>
>
_______________________________________________
osg-submissions mailing list
[email protected]
http://lists.openscenegraph.org/listinfo.cgi/osg-submissions-openscenegraph.org