コード例 #1
0
FieldContainerUnrecPtr getFieldContainer(const FieldContainerType *szType, const std::string &namestring)
{
    if(szType == NULL)
    {
        SWARNING << "getFieldContainer(): The Field type is not defined." << std::endl;
        return NULL;
    }

    const FieldContainerFactoryBase::ContainerStore &FCStore(	FieldContainerFactory::the()->getFieldContainerStore () );

    FieldContainerFactoryBase::ContainerStore::const_iterator FCStoreIter;
    FieldContainerFactoryBase::ContainerPtr Cont;
    for(FCStoreIter = FCStore.begin() ; FCStoreIter != FCStore.end() ; ++FCStoreIter)
    {
#ifdef OSG_MT_CPTR_ASPECT
        Cont = (*FCStoreIter)->getPtr();
#else
        Cont = *FCStoreIter;
#endif
        if( Cont != NULL && Cont->getType() == (*szType) )
        {
            const Char8 *Name( getName(dynamic_cast<AttachmentContainer*>(Cont)) );
            if(Name != NULL && namestring.compare(Name) == 0)
            {
                return Cont;
            }
        }
    }

    return NULL;
}
コード例 #2
0
FieldContainer *getFieldContainer(const FieldContainerType *pType, 
                                  const std::string        &szName)
{
    if(pType == NULL)
    {
        SWARNING << "getFieldContainer(): The Field type is not defined."
                 << std::endl;

        return NULL;
    }

    const FieldContainerFactoryBase::ContainerStore &oFCStore(
        FieldContainerFactory::the()->getFieldContainerStore());

    FieldContainerFactoryBase::ContainerStore::const_iterator fcStoreIt =
        oFCStore.begin();

    FieldContainerFactoryBase::ContainerPtr                   pCont     = NULL;

    for(; fcStoreIt != oFCStore.end() ; ++fcStoreIt)
    {
#ifdef OSG_MT_CPTR_ASPECT
        pCont = (*fcStoreIt).second->getPtr();
#else
        pCont =  *fcStoreIt .second;
#endif

        if(pCont != NULL && pCont->getType() == (*pType))
        {
            const Char8 *szCntName = 
                getName(dynamic_cast<AttachmentContainer *>(pCont));

            if(szCntName != NULL && szName.compare(szCntName) == 0)
            {
                return pCont;
            }
        }
    }

    return NULL;
}
コード例 #3
0
std::vector<FieldContainerUnrecPtr> getAllContainersByDerivedType(const FieldContainerType *szType)
{
    std::vector<FieldContainerUnrecPtr> Result;

    const FieldContainerFactoryBase::ContainerStore &FCStore(	FieldContainerFactory::the()->getFieldContainerStore () );

    FieldContainerFactoryBase::ContainerStore::const_iterator FCStoreIter;
    FieldContainerFactoryBase::ContainerPtr Cont;
    for(FCStoreIter = FCStore.begin() ; FCStoreIter != FCStore.end() ; ++FCStoreIter)
    {
#ifdef OSG_MT_CPTR_ASPECT
        Cont = (*FCStoreIter)->getPtr();
#else
        Cont = *FCStoreIter;
#endif
        if( Cont != NULL && Cont->getType().isDerivedFrom(*szType) )
        {
            Result.push_back(Cont);
        }
    }
    return Result;
}
コード例 #4
0
std::vector<FieldContainer *> getAllContainersByDerivedType(
    const FieldContainerType *pType)
{
    std::vector<FieldContainer *> vResult;

    const FieldContainerFactoryBase::ContainerStore &oFCStore = 
        FieldContainerFactory::the()->getFieldContainerStore();

    FieldContainerFactoryBase::ContainerStore::const_iterator fcStoreIt = 
        oFCStore.begin();

    FieldContainerFactoryBase::ContainerPtr                   pCont     =
        NULL;

    for(;fcStoreIt != oFCStore.end() ; ++fcStoreIt)
    {
        if((*fcStoreIt).second != NULL)
        {
#ifdef OSG_MT_CPTR_ASPECT
            pCont = (*fcStoreIt).second->getPtr();
#else
            pCont =  *fcStoreIt .second;
#endif
        }
        else
        {
            pCont = NULL;
        }
        if(pCont != NULL && pCont->getType().isDerivedFrom(*pType))
        {
            vResult.push_back(pCont);
        }
    }

    return vResult;
}