当前位置: 首页>>代码示例>>C++>>正文


C++ ObjectWrapper::getAssociates方法代码示例

本文整理汇总了C++中ObjectWrapper::getAssociates方法的典型用法代码示例。如果您正苦于以下问题:C++ ObjectWrapper::getAssociates方法的具体用法?C++ ObjectWrapper::getAssociates怎么用?C++ ObjectWrapper::getAssociates使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在ObjectWrapper的用法示例。


在下文中一共展示了ObjectWrapper::getAssociates方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: writeObjectFields

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();

}
开发者ID:Stupeflix,项目名称:osg,代码行数:55,代码来源:OutputStream.cpp

示例2: writeObjectFields

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();

}
开发者ID:nsmoooose,项目名称:osg,代码行数:53,代码来源:OutputStream.cpp


注:本文中的ObjectWrapper::getAssociates方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。