fixed: auto_ptr -> unique_ptr
[opensg.git] / Source / System / NodeCores / Groups / Base / OSGMultiCore.inl
blobacf2f29bbd4f2b37e44615ae62936bd4bc5a486d
1 /*---------------------------------------------------------------------------*\
2  *                                OpenSG                                     *
3  *                                                                           *
4  *                                                                           *
5  *               Copyright (C) 2000-2006 by the OpenSG Forum                 *
6  *                                                                           *
7  *   contact: dirk@opensg.org, gerrit.voss@vossg.org, jbehr@zgdv.de          *
8  *                                                                           *
9 \*---------------------------------------------------------------------------*/
10 /*---------------------------------------------------------------------------*\
11  *                                License                                    *
12  *                                                                           *
13  * This library is free software; you can redistribute it and/or modify it   *
14  * under the terms of the GNU Library General Public License as published    *
15  * by the Free Software Foundation, version 2.                               *
16  *                                                                           *
17  * This library is distributed in the hope that it will be useful, but       *
18  * WITHOUT ANY WARRANTY; without even the implied warranty of                *
19  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU         *
20  * Library General Public License for more details.                          *
21  *                                                                           *
22  * You should have received a copy of the GNU Library General Public         *
23  * License along with this library; if not, write to the Free Software       *
24  * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.                 *
25  *                                                                           *
26 \*---------------------------------------------------------------------------*/
27 /*---------------------------------------------------------------------------*\
28  *                                Changes                                    *
29  *                                                                           *
30  *                                                                           *
31  *                                                                           *
32  *                                                                           *
33  *                                                                           *
34  *                                                                           *
35 \*---------------------------------------------------------------------------*/
37 //---------------------------------------------------------------------------
38 //  Includes
39 //---------------------------------------------------------------------------
41 OSG_BEGIN_NAMESPACE
43 inline
44 UInt32 MultiCore::getNCores(void) const
46     return _mfCores.size32();
49 inline
50 Int32 MultiCore::findCore(NodeCore * const pCore) const
52     return _mfCores.findIndex(pCore);
55 inline
56 void MultiCore::insertCore(UInt32           coreIdx, 
57                            NodeCore * const coreP  )
59     MultiCore *pMCore = dynamic_cast<MultiCore *>(coreP);
61     if(pMCore != NULL)
62     {
63         FWARNING(("Can not insert multi-core into multi-core, ignored\n"));
64         return;
65     }
67     editMField(CoresFieldMask, _mfCores);
69     MFCoresType::iterator cIt = _mfCores.begin_nc();
71     cIt += coreIdx;
73     _mfCores.insert(cIt, coreP);
76 inline
77 const MFUnrecChildNodeCorePtr *MultiCore::getMFCores(void) const
79     return Inherited::getMFCores();
82 inline
83 NodeCore *MultiCore::getCores(const UInt32 index) const
85     return Inherited::getCores(index);
88 inline
89 void MultiCore::addCore(NodeCore * const value)
91     MultiCore *pMCore = dynamic_cast<MultiCore *>(value);
93     if(pMCore != NULL)
94     {
95         FWARNING(("Can not insert multi-core into multi-core, ignored\n"));
96         return;
97     }
99     Inherited::addCore(value);
102 inline
103 void MultiCore::assignCoresFrom(const MFUnrecChildNodeCorePtr &value)
105     MFUnrecChildNodeCorePtr::const_iterator vIt  = value.begin();
106     MFUnrecChildNodeCorePtr::const_iterator vEnd = value.end  ();
108     for(; vIt != vEnd; ++vIt)
109     {
110         MultiCore *pMCore = dynamic_cast<MultiCore *>(*vIt);
112         if(pMCore != NULL)
113         {
114             FWARNING(("Can not insert multi-core into multi-core, ignored\n"));
115             return;
116         }
117     }
118     
119     Inherited::assignCoresFrom(value);
122 inline
123 void MultiCore::subCore(UInt32 uiIndex)
125     Inherited::subCore(uiIndex);
128 inline
129 void MultiCore::subCoreByObj(NodeCore * const value)
131     Inherited::subCoreByObj(value);
134 inline
135 void MultiCore::clearCores(void)
137     Inherited::clearCores();
140 template <class ObjectT> inline
141 void addCoreToNode(Node                *pNode,
142                    TransitPtr<ObjectT>  pCore)
144     addCoreToNode(pCore.get(), pNode);
147 OSG_END_NAMESPACE