void OutputStream::writeObjectFields( const osg::Object* obj ) { std::string name = obj->libraryName(); name += std::string("::") + obj->className(); ObjectWrapper* wrapper = Registry::instance()->getObjectWrapperManager()->findWrapper( name ); if ( !wrapper ) { OSG_INFO << "OutputStream::writeObject(): Unsupported wrapper class " << name << std::endl; return; } _fields.push_back( name ); const StringList& associates = wrapper->getAssociates(); for ( StringList::const_iterator itr=associates.begin(); itr!=associates.end(); ++itr ) { const std::string& assocName = *itr; ObjectWrapper* assocWrapper = Registry::instance()->getObjectWrapperManager()->findWrapper(assocName); if ( !assocWrapper ) { OSG_INFO << "OutputStream::writeObject(): Unsupported associated class " << assocName << std::endl; continue; } else if ( _useSchemaData ) { if ( _inbuiltSchemaMap.find(assocName)==_inbuiltSchemaMap.end() ) { StringList properties; std::vector<int> types; assocWrapper->writeSchema( properties, types ); unsigned int size = osg::minimum( properties.size(), types.size() ); if ( size>0 ) { std::stringstream propertiesStream; for ( unsigned int i=0; i<size; ++i ) { propertiesStream << properties[i] << ":" << types[i] << " "; } _inbuiltSchemaMap[assocName] = propertiesStream.str(); } } } _fields.push_back( assocWrapper->getName() ); assocWrapper->write( *this, *obj ); if ( getException() ) return; _fields.pop_back(); } _fields.pop_back(); }
void OutputStream::writeObjectFields( const osg::Object* obj ) { std::string name = obj->libraryName(); name += std::string("::") + obj->className(); ObjectWrapper* wrapper = Registry::instance()->getObjectWrapperManager()->findWrapper( name ); if ( !wrapper ) { OSG_WARN << "OutputStream::writeObject(): Unsupported wrapper class " << name << std::endl; return; } _fields.push_back( name ); const StringList& associates = wrapper->getAssociates(); for ( StringList::const_iterator itr=associates.begin(); itr!=associates.end(); ++itr ) { const std::string& assocName = *itr; ObjectWrapper* assocWrapper = Registry::instance()->getObjectWrapperManager()->findWrapper(assocName); if ( !assocWrapper ) { OSG_WARN << "OutputStream::writeObject(): Unsupported associated class " << assocName << std::endl; continue; } else if ( _useSchemaData ) { if ( _inbuiltSchemaMap.find(assocName)==_inbuiltSchemaMap.end() ) { StringList properties; assocWrapper->writeSchema( properties ); if ( properties.size()>0 ) { std::string propertiesString; for ( StringList::iterator sitr=properties.begin(); sitr!=properties.end(); ++sitr ) { propertiesString += *sitr; propertiesString += ' '; } _inbuiltSchemaMap[assocName] = propertiesString; } } } _fields.push_back( assocWrapper->getName() ); assocWrapper->write( *this, *obj ); if ( getException() ) return; _fields.pop_back(); } _fields.pop_back(); }