Hi,
Well, I have defined my wrapper for my testclass and it compiles, unfortunately
it is not serialized.
My testcall is:
Code:
dataIO_transportContainer* test = new dataIO_transportContainer();
test->setFrameID( 22 );
std::ofstream myOstream("test.txt" );
osgDB::ReaderWriter* rw =
osgDB::Registry::instance()->getReaderWriterForExtension("osgt");
if ( rw )
{
OSG_NOTIFY( osg::ALWAYS ) << "Save testnode." << std::endl;
osgDB::ReaderWriter::WriteResult wr = rw->writeNode( *test,
myOstream, new osgDB::Options("Ascii") );
if (wr.success() )
OSG_NOTIFY( osg::ALWAYS ) << "Save successful." <<
std::endl;
else
OSG_NOTIFY( osg::ALWAYS ) << "Save failed." <<
std::endl;
}
else
OSG_NOTIFY( osg::ALWAYS ) << "error getting readerWriter for
osgt" << std::endl;
myOstream.flush();
myOstream.close();
The outputfile contains:
Code:
#Ascii Scene
#Version 2
#Generator OpenSceneGraph 2.9.7
osg::Group {
UniqueID 1
}
The headerfile of the transport container is:
Code:
#pragma once
#include <osg/Group>
#include <osg/Matrixd>
#include "dataIO_executer.h"
#include "dataIO_slotContainer.h"
#include <vector>
class dataIO_transportContainer : public osg::Group
{
public:
dataIO_transportContainer(){}
virtual ~dataIO_transportContainer(){}
typedef std::vector<osg::ref_ptr<dataIO_executer> > executerList;
typedef std::vector<osg::ref_ptr<dataIO_slotContainer> > slotList;
private:
int frameID;
osg::Matrixd viewMatrix;
executerList executer;
slotList ioSlots;
// Access functions for Serializer
public:
int getFrameID() const {return frameID;}
void setFrameID(int frameID_ ){frameID=frameID_;}
void setViewMatrix(const osg::Matrixd&
viewMatrix_){viewMatrix=viewMatrix_;}
const osg::Matrixd& getViewMatrix() const {return viewMatrix;}
void setExecuter(const executerList& executer_) {executer=executer_;}
const executerList& getExecuter() const {return executer;}
void setIOSlots(const slotList& ioSlots_) {ioSlots=ioSlots_;}
const slotList& getIOSlots() const {return ioSlots;}
};
.. and the wrapper definition is:
Code:
#include "dataIO_transportContainer.h"
#include <osgDB/ObjectWrapper>
#include <osgDB/InputStream>
#include <osgDB/OutputStream>
REGISTER_OBJECT_WRAPPER( dataIO_transportContainer, // The
unique wrapper name
new dataIO_transportContainer, // The proto
dataIO_transportContainer, // The
class typename
"osg::Object osg::Node
osg::Group std::dataIO_transportContainer" ) // The inheritance relations
{
ADD_INT_SERIALIZER( FrameID, 0 );
ADD_MATRIXD_SERIALIZER( ViewMatrix, osg::Matrixd() );
ADD_LIST_SERIALIZER( Executer, dataIO_transportContainer::executerList
);
ADD_LIST_SERIALIZER( IOSlots, dataIO_transportContainer::slotList );
}
Why does serializer stop after defining the origin of this class? he onlsy
write down that this class is inherited from osg::Group.
Why does the serializer not dive into my class and serialzes all defined
elements?
Thank you for your help,
Torben
------------------
Read this topic online here:
http://forum.openscenegraph.org/viewtopic.php?p=24136#24136
_______________________________________________
osg-users mailing list
[email protected]
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org