Hi Robert,

Yes, it make sense to me. I didn't want to change too much that class
to maintain compatibility, that's why I added that methods. Maybe Wang
Rui can comment more about this, he is the master of the serializers!
:).

I'm also thinking about the possibility of add methods to request
"properties" or "serializers" of an osg::Object class and "read" and
"write" that values. So it can be exported to a gui easily. What do
you think? Maybe a helper method in osgDB::Serializer?,
osgDB::Registry.

Greets,
Rafa.


2011/5/12 Robert Osfield <[email protected]>:
> 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
>



-- 
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

Reply via email to