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


C++ ObjectVector类代码示例

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


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

示例1: GetObjectListByName

//-----------------------------------------------------------------------------------------
void OgitorsRoot::GetObjectListByName(unsigned int type, const Ogre::String& nameregexp, bool inverse, ObjectVector& list)
{
    list.clear();

    try
    {
        const boost::regex e(nameregexp.c_str());

        NameObjectPairList::iterator list_st, list_ed;

        if(type == 0)
        {
            list_st = mNameList.begin();
            list_ed = mNameList.end();
        }
        else
        {
            list_st = mNamesByType[type].begin();
            list_ed = mNamesByType[type].end();
        }

        while(list_st != list_ed)
        {
            if(regex_match(list_st->first.c_str(), e) != inverse)
            {
                list.push_back(list_st->second);
            }
            list_st++;
        }
    }
    catch(...)
    {
        list.clear();
    }
}
开发者ID:EternalWind,项目名称:Ogitor-Facade,代码行数:36,代码来源:OgitorsRootRegExp.cpp

示例2: RegExpByProperty

//-----------------------------------------------------------------------------------------
void OgitorsRoot::RegExpByProperty(const Ogre::String& nameregexp, bool inverse, const ObjectVector& list_in, ObjectVector& list_out)
{
    list_out.clear();

    try
    {
        const boost::regex e(nameregexp.c_str());

        OgitorsPropertyVector pvec;

        for(unsigned int i = 0;i < list_in.size();i++)   
        {
            pvec = list_in[i]->getProperties()->getPropertyVector();

            bool add_list = false;
            
            for(unsigned int k = 0;k < pvec.size();k++)
            {
                if(regex_match(pvec[k]->getName().c_str(), e))
                {
                    add_list = true;
                    break;
                }
            }
            
            if(add_list != inverse)
                list_out.push_back(list_in[i]);
        }
    }
    catch(...)
    {
        list_out.clear();
    }
}    
开发者ID:EternalWind,项目名称:Ogitor-Facade,代码行数:35,代码来源:OgitorsRootRegExp.cpp

示例3: new

AABBTreeUnpacked::AABBTreeUnpacked(ObjectVector& objects)
{
    m_numNodes = 0;
    m_maxDepth = 0;
    m_twoChildNodes = 0;
    m_leafNodes = 0;

    // Find the total AABB of all the objects
    root = new(_mm_malloc(sizeof(Node),16)) Node();
    root->aabb = Surround(objects,0,objects.size());
    if(objects.size() == 1)
    {
        m_maxDepth = 0;
        m_numNodes = 1;
        m_leafNodes = 1;
        root->obj = objects[0].obj;
        root->children[0] = NULL;
        root->children[1] = NULL;
    }
    else
    {
        root->obj = NULL;
        ++m_numNodes;
        ++m_twoChildNodes;
        BuildTreeRecursive(
            objects,
            root,
            0,
            (uint32_t)objects.size(),
            1);
    }

    //assert(m_numNodes == m_leafNodes + m_twoChildNodes);
}
开发者ID:Antialiased,项目名称:Phozon,代码行数:34,代码来源:aabb_tree.cpp

示例4: getSelection

//--------------------------------------------------------------------------------
void CMultiSelEditor::getSelection(ObjectVector& list)
{
    list.clear();

    NameObjectPairList::const_iterator it = mSelectedObjects.begin();
    while(it != mSelectedObjects.end())
    {
        list.push_back(it->second);
        it++;
    }
}
开发者ID:jacmoe,项目名称:ogitor,代码行数:12,代码来源:MultiSelEditor.cpp

示例5: vectorFromIds

ObjectVector STM::vectorFromIds(const std::vector<std::string>& ids)
{
    ObjectVector vector;
    std::vector<std::string>::const_iterator id;

    for (id = ids.begin(); id != ids.end(); ++id)
    {
        vector.push_back(get(*id));
    }

    return vector;
}
开发者ID:naderman,项目名称:spoac,代码行数:12,代码来源:STM.cpp

示例6: GetObjectListByCustomProperty

//-----------------------------------------------------------------------------------------
void OgitorsRoot::GetObjectListByCustomProperty(unsigned int type, const Ogre::String& nameregexp, bool inverse, ObjectVector& list)
{
    list.clear();

    try
    {
        const boost::regex e(nameregexp.c_str());

        NameObjectPairList::iterator list_st, list_ed;

        if(type == 0)
        {
            list_st = mNameList.begin();
            list_ed = mNameList.end();
        }
        else
        {
            list_st = mNamesByType[type].begin();
            list_ed = mNamesByType[type].end();
        }

        OgitorsPropertyVector pvec;

        while(list_st != list_ed)
        {
            pvec = list_st->second->getCustomProperties()->getPropertyVector();
            bool add_list = false;
            for(unsigned int k = 0;k < pvec.size();k++)
            {
                if(regex_match(pvec[k]->getName().c_str(), e))
                {
                    add_list = true;
                    break;
                }
            }
            
            if(add_list != inverse)
                list.push_back(list_st->second);
            
            list_st++;
        }
    }
    catch(...)
    {
        list.clear();
    }
}
开发者ID:EternalWind,项目名称:Ogitor-Facade,代码行数:48,代码来源:OgitorsRootRegExp.cpp

示例7: _writeFile

//-----------------------------------------------------------------------------
int COFSSceneSerializer::_writeFile(Ogre::String exportfile, const bool forceSave)
{
    if (exportfile.empty())
        return SCF_ERRUNKNOWN;

    OgitorsRoot *ogRoot = OgitorsRoot::getSingletonPtr();
    // Open a stream to output our XML Content and write the general headercopyFile
    std::stringstream outfile;

    outfile << "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n";
    outfile << "<OGITORSCENE version=\"" << Globals::OGSCENE_FORMAT_VERSION << "\">\n";

    PROJECTOPTIONS *pOpt = ogRoot->GetProjectOptions();
    pOpt->CameraSpeed = ogRoot->GetViewport()->GetCameraSpeed();

    ogRoot->WriteProjectOptions(outfile, pOpt);

    ObjectVector ObjectList;
    OgitorsPropertyValueMap theList;
    OgitorsPropertyValueMap::iterator ni;

    // Start from 1, since 0 means all objects
    for(unsigned int i = 1; i < LAST_EDITOR; i++)
    {
        ogRoot->GetObjectList(i, ObjectList);
        for(unsigned int ob = 0; ob < ObjectList.size(); ob++)
        {
            /// If Object does not have a parent, then it is not part of the scene
            if(ObjectList[ob]->getParent())
            {
                ObjectList[ob]->onSave(forceSave);
                if(ObjectList[ob]->isSerializable())
                {
                    outfile << OgitorsUtils::GetObjectSaveStringV2(ObjectList[ob], 2, true, true).c_str();
                    outfile << "\n";
                }
            }
        }
    }
    outfile << "</OGITORSCENE>\n";

    if (OgitorsUtils::SaveStreamOfs(outfile, exportfile)) {
        return SCF_OK;
    }

    return SCF_ERRFILE;
}
开发者ID:jacmoe,项目名称:ogitor,代码行数:48,代码来源:OFSSceneSerializer.cpp

示例8: add

//--------------------------------------------------------------------------------
void CMultiSelEditor::add(const ObjectVector& newselection)
{
    if(mDeletionInProgress)
        return;

    if(newselection.size() == 0)
        return;

    for(unsigned int i = 0;i < newselection.size();i++)
    {
        if(newselection[i] && (newselection[i] != this) && (mSelectedObjects.find(newselection[i]->getName()) == mSelectedObjects.end()))
        {
            mSelectedObjects.insert(NameObjectPairList::value_type(newselection[i]->getName(), newselection[i]));

            newselection[i]->setSelected(true);
        }
    }

    _createModifyList();
}
开发者ID:jacmoe,项目名称:ogitor,代码行数:21,代码来源:MultiSelEditor.cpp

示例9: RegExpByName

//-----------------------------------------------------------------------------------------
void OgitorsRoot::RegExpByName(const Ogre::String& nameregexp, bool inverse, const ObjectVector& list_in, ObjectVector& list_out)
{
    list_out.clear();
    
    try
    {
        const boost::regex e(nameregexp.c_str());

        for(unsigned int i = 0;i < list_in.size();i++)   
        {
            if(regex_match(list_in[i]->getName().c_str(), e) != inverse)
            {
                list_out.push_back(list_in[i]);
            }
        }
    }
    catch(...)
    {
        list_out.clear();
    }
}
开发者ID:EternalWind,项目名称:Ogitor-Facade,代码行数:22,代码来源:OgitorsRootRegExp.cpp

示例10: assert

void AABBTreeUnpacked::Partition(
    ObjectVector& objects,
    uint32_t beginIndex,
    uint32_t endIndex,
    uint32_t axis,
    float val,
    uint32_t& finalRightIdx)
{
    assert(endIndex > beginIndex);
    assert(endIndex <= objects.size());
    assert(axis < 3);

    ObjectVector sos(endIndex-beginIndex);

    // Indices which we use to track the number of aabbs in the left and right lists.
    uint32_t rightIdxObj = endIndex;

    uint32_t leftIdxSOS = 0;
    uint32_t rightIdxSOS = endIndex - beginIndex - 1;

    for(uint32_t i = beginIndex; i < endIndex; ++i)
    {
        Vector3 centroid = objects[i].aabb.GetCentroid();

        if(centroid.GetComponent(axis) >= val)
        {
            sos[rightIdxSOS--] = objects[i];
            --rightIdxObj;
        }
        else
        {
            sos[leftIdxSOS++] = objects[i];
        }
    }

    // Make sure we have actually found a place for all the AABBs
    assert(leftIdxSOS == rightIdxSOS+1);

    // Copy the partitioned list back to the correct part of the object vector.

    uint32_t it = 0;
    for(uint32_t i = beginIndex; i < endIndex; ++i)
    {
        objects[i] = sos[it++];
    }

    finalRightIdx = rightIdxObj;

    // Make sure we always have at least one object in each list. This prevents dangling
    // leaf nodes from being created, as well as solving certain infinite recursion situations.
    if(finalRightIdx == beginIndex) finalRightIdx = beginIndex + 1;
    if(finalRightIdx == endIndex) finalRightIdx = endIndex - 1;
}
开发者ID:Antialiased,项目名称:Phozon,代码行数:53,代码来源:aabb_tree.cpp

示例11: remove

//--------------------------------------------------------------------------------
void CMultiSelEditor::remove(const ObjectVector& newselection)
{
    if(mDeletionInProgress)
        return;

    if(newselection.size() == 0)
        return;

    NameObjectPairList::iterator it;

    for(unsigned int i = 0;i < newselection.size();i++)
    {
        if(newselection[i] && ((it = mSelectedObjects.find(newselection[i]->getName())) != mSelectedObjects.end()))
        {
            mSelectedObjects.erase(it);

            newselection[i]->setSelected(false);
        }
    }

    _createModifyList();
}
开发者ID:jacmoe,项目名称:ogitor,代码行数:23,代码来源:MultiSelEditor.cpp

示例12: Surround

AABBTreeUnpacked::AABB AABBTreeUnpacked::Surround(ObjectVector& ov, size_t beginIdx, size_t endIdx)
{
    assert(endIdx >= beginIdx);
    assert(endIdx <= ov.size());

    if(endIdx == beginIdx)
    {
        return AABB(Vector3(0.0f),Vector3(0.0f));
    }

    AABB aabb = ov[beginIdx].aabb;
    if(beginIdx == endIdx - 1) return aabb;
    for(size_t i = beginIdx + 1; i < endIdx; ++i)
    {
        aabb = Union(aabb,ov[i].aabb);
    }
    return aabb;
}
开发者ID:Antialiased,项目名称:Phozon,代码行数:18,代码来源:aabb_tree.cpp

示例13: setSelection

//--------------------------------------------------------------------------------
void CMultiSelEditor::setSelection(const ObjectVector& list)
{
    if(mDeletionInProgress)
        return;

    _clearSelection();

    for(unsigned int i = 0;i < list.size();i++)
    {
        if(list[i])
        {
            list[i]->setSelected(true);
            mSelectedObjects.insert(NameObjectPairList::value_type(list[i]->getName(), list[i]));
        }
    }

    _createModifyList();

    SelectionChangeEvent evt(this);
    EventManager::getSingletonPtr()->sendEvent(this, 0, &evt);
}
开发者ID:jacmoe,项目名称:ogitor,代码行数:22,代码来源:MultiSelEditor.cpp

示例14: switch

//
// BinaryTokenPPACS::make_tokens
//
void BinaryTokenPPACS::make_tokens
(ObjectVector const &objects, std::vector<BinaryTokenPPACS> *instructions)
{
   static ObjectExpression::Pointer const fracbits =
      ObjectExpression::CreateValueINT(16, SourcePosition::builtin());

   static std::vector<std::string> const nolabels;

   std::vector<ObjectExpression::Pointer> args;

   ObjectVector::const_iterator object;
   for (object = objects.begin(); object != objects.end(); ++object)
   {
   SourcePosition const &pos = object->pos;

   std::vector<std::string> const *labels = &object->labels;

   switch (object->code)
   {
   BINTOKACS_TOKENS_MAP_ALL();
   BINTOKACS_TOKENS_TRAN_ALL();

   //
   // Operators
   //
   CASE_REMAP(ADD_AUTO_I,   ADD_AUTO);
   CASE_REMAP(ADD_AUTO_U,   ADD_AUTO);
   CASE_REMAP(ADD_AUTO_X,   ADD_AUTO);
   CASE_REMAP(ADD_PTR_I,    ADD_PTR);
   CASE_REMAP(ADD_PTR_U,    ADD_PTR);
   CASE_REMAP(ADD_PTR_X,    ADD_PTR);
   CASE_REMAP(ADD_STATIC_I, ADD_STATIC);
   CASE_REMAP(ADD_STATIC_U, ADD_STATIC);
   CASE_REMAP(ADD_STATIC_X, ADD_STATIC);

   CASE_REMAP(AND_AUTO_I,   AND_AUTO);
   CASE_REMAP(AND_AUTO_U,   AND_AUTO);
   CASE_REMAP(AND_AUTO_X,   AND_AUTO);
   CASE_REMAP(AND_PTR_I,    AND_PTR);
   CASE_REMAP(AND_PTR_U,    AND_PTR);
   CASE_REMAP(AND_PTR_X,    AND_PTR);
   CASE_REMAP(AND_STATIC_I, AND_STATIC);
   CASE_REMAP(AND_STATIC_U, AND_STATIC);
   CASE_REMAP(AND_STATIC_X, AND_STATIC);

   CASE_REMAP(DEC_AUTO_I,   DEC_AUTO);
   CASE_REMAP(DEC_AUTO_U,   DEC_AUTO);
   CASE_REMAP(DEC_PTR_I,    DEC_PTR);
   CASE_REMAP(DEC_PTR_U,    DEC_PTR);
   CASE_REMAP(DEC_STATIC_I, DEC_STATIC);
   CASE_REMAP(DEC_STATIC_U, DEC_STATIC);

   CASE_REMAP(DIV_STK_X,    DIV_STK_X);
   CASE_REMAP(DIV_AUTO_I,   DIV_AUTO);
   CASE_REMAP(DIV_PTR_I,    DIV_PTR);
   CASE_REMAP(DIV_STATIC_I, DIV_STATIC);

   CASE_REMAP(INC_AUTO_I,   INC_AUTO);
   CASE_REMAP(INC_AUTO_U,   INC_AUTO);
   CASE_REMAP(INC_PTR_I,    INC_PTR);
   CASE_REMAP(INC_PTR_U,    INC_PTR);
   CASE_REMAP(INC_STATIC_I, INC_STATIC);
   CASE_REMAP(INC_STATIC_U, INC_STATIC);

   CASE_REMAP(IOR_AUTO_I,   IOR_AUTO);
   CASE_REMAP(IOR_AUTO_U,   IOR_AUTO);
   CASE_REMAP(IOR_AUTO_X,   IOR_AUTO);
   CASE_REMAP(IOR_PTR_I,    IOR_PTR);
   CASE_REMAP(IOR_PTR_U,    IOR_PTR);
   CASE_REMAP(IOR_PTR_X,    IOR_PTR);
   CASE_REMAP(IOR_STATIC_I, IOR_STATIC);
   CASE_REMAP(IOR_STATIC_U, IOR_STATIC);
   CASE_REMAP(IOR_STATIC_X, IOR_STATIC);

   CASE_REMAP(LSH_AUTO_I,   LSH_AUTO);
   CASE_REMAP(LSH_AUTO_U,   LSH_AUTO);
   CASE_REMAP(LSH_AUTO_X,   LSH_AUTO);
   CASE_REMAP(LSH_PTR_I,    LSH_PTR);
   CASE_REMAP(LSH_PTR_U,    LSH_PTR);
   CASE_REMAP(LSH_PTR_X,    LSH_PTR);
   CASE_REMAP(LSH_STATIC_I, LSH_STATIC);
   CASE_REMAP(LSH_STATIC_U, LSH_STATIC);
   CASE_REMAP(LSH_STATIC_X, LSH_STATIC);

   CASE_REMAP(MOD_AUTO_I,   MOD_AUTO);
   CASE_REMAP(MOD_AUTO_X,   MOD_AUTO);
   CASE_REMAP(MOD_PTR_I,    MOD_PTR);
   CASE_REMAP(MOD_PTR_X,    MOD_PTR);
   CASE_REMAP(MOD_STATIC_I, MOD_STATIC);
   CASE_REMAP(MOD_STATIC_X, MOD_STATIC);

   CASE_REMAP(MUL_STK_X,    MUL_STK_X);
   CASE_REMAP(MUL_AUTO_I,   MUL_AUTO);
   CASE_REMAP(MUL_AUTO_U,   MUL_AUTO);
   CASE_REMAP(MUL_PTR_I,    MUL_PTR);
   CASE_REMAP(MUL_PTR_U,    MUL_PTR);
   CASE_REMAP(MUL_STATIC_I, MUL_STATIC);
//.........这里部分代码省略.........
开发者ID:DavidPH,项目名称:DH-acc,代码行数:101,代码来源:make_tokens.cpp


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