33 #ifndef DART_DYNAMICS_DETAIL_SPECIALIZEDNODEMANAGER_HPP_
34 #define DART_DYNAMICS_DETAIL_SPECIALIZEDNODEMANAGER_HPP_
44 #ifdef DART_UNITTEST_SPECIALIZED_NODE_ACCESS
45 bool usedSpecializedNodeAccess;
49 template <
class SpecNode>
52 mNodeMap[
typeid( SpecNode )] = std::vector<Node*>();
53 mSpecNodeIterator = mNodeMap.find(
typeid( SpecNode ));
57 template <
class SpecNode>
58 template <
class NodeType>
65 template <
class SpecNode>
66 template <
class NodeType>
73 template <
class SpecNode>
74 template <
class NodeType>
82 template <
class SpecNode>
83 template <
class NodeType>
90 template <
class SpecNode>
91 template <
class NodeType>
94 return detail::BasicNodeManagerForBodyNode::getNumNodes<NodeType>();
98 template <
class SpecNode>
101 #ifdef DART_UNITTEST_SPECIALIZED_NODE_ACCESS
102 usedSpecializedNodeAccess =
true;
105 return mSpecNodeIterator->second.size();
109 template <
class SpecNode>
110 template <
class NodeType>
113 return detail::BasicNodeManagerForBodyNode::getNode<NodeType>(
index);
117 template <
class SpecNode>
120 #ifdef DART_UNITTEST_SPECIALIZED_NODE_ACCESS
121 usedSpecializedNodeAccess =
true;
124 return static_cast<SpecNode*
>(
129 template <
class SpecNode>
130 template <
class NodeType>
137 template <
class SpecNode>
144 template <
class SpecNode>
147 mSpecializedTreeNodes[
typeid( SpecNode )] = &mTreeSpecNodeIterators;
150 mSpecNodeNameMgrIterator = mNodeNameMgrMap.find(
typeid( SpecNode ));
154 template <
class SpecNode>
155 template <
class NodeType>
157 std::size_t treeIndex)
const
163 template <
class SpecNode>
164 template <
class NodeType>
166 std::size_t treeIndex, std::size_t nodeIndex)
172 template <
class SpecNode>
173 template <
class NodeType>
175 std::size_t treeIndex, std::size_t nodeIndex)
const
182 template <
class SpecNode>
183 template <
class NodeType>
185 const std::string&
name)
191 template <
class SpecNode>
192 template <
class NodeType>
194 const std::string&
name)
const
201 template <
class SpecNode>
202 template <
class NodeType>
209 template <
class SpecNode>
210 template <
class NodeType>
214 return detail::BasicNodeManagerForSkeleton::getNumNodes<NodeType>(treeIndex);
218 template <
class SpecNode>
222 #ifdef DART_UNITTEST_SPECIALIZED_NODE_ACCESS
223 usedSpecializedNodeAccess =
true;
226 if(treeIndex >= mTreeNodeMaps.size())
228 dterr <<
"[Skeleton::getNumNodes<" <<
typeid(SpecNode).
name() <<
">] "
229 <<
"Requested tree index (" << treeIndex <<
"), but there are only ("
230 << mTreeNodeMaps.size() <<
") trees available\n";
235 return mTreeSpecNodeIterators[treeIndex]->second.size();
239 template <
class SpecNode>
240 template <
class NodeType>
244 return detail::BasicNodeManagerForSkeleton::getNode<NodeType>(
245 treeIndex, nodeIndex);
249 template <
class SpecNode>
253 #ifdef DART_UNITTEST_SPECIALIZED_NODE_ACCESS
254 usedSpecializedNodeAccess =
true;
257 if(treeIndex >= mTreeNodeMaps.size())
259 dterr <<
"[Skeleton::getNode<" <<
typeid(SpecNode).
name() <<
">] "
260 <<
"Requested tree index (" << treeIndex <<
"), but there are only ("
261 << mTreeNodeMaps.size() <<
") trees available\n";
268 if(nodeIndex >= it->second.size())
270 dterr <<
"[Skeleton::getNode<" <<
typeid(SpecNode).
name() <<
">] "
271 <<
"Requested index (" << nodeIndex <<
") within tree (" << treeIndex
272 <<
"), but there are only (" << it->second.size() <<
") Nodes of the "
273 <<
"requested type within that tree\n";
278 return static_cast<SpecNode*
>(it->second[nodeIndex]);
282 template <
class SpecNode>
283 template <
class NodeType>
287 return detail::BasicNodeManagerForSkeleton::getNode<NodeType>(
name);
291 template <
class SpecNode>
295 #ifdef DART_UNITTEST_SPECIALIZED_NODE_ACCESS
296 usedSpecializedNodeAccess =
true;
299 return static_cast<SpecNode*
>(
300 mSpecNodeNameMgrIterator->second.getObject(
name));
304 template <
class SpecNode>
305 template <
class NodeType>
313 template <
class SpecNode>
#define dterr
Output an error message.
Definition: Console.hpp:49
std::string * name
Definition: SkelParser.cpp:1642
std::size_t index
Definition: SkelParser.cpp:1617
class NameManager
Definition: NameManager.hpp:62
BodyNodeSpecializedFor allows classes that inherit BodyNode to have constant-time access to a specifi...
Definition: SpecializedNodeManager.hpp:57
Declaration of the variadic template.
Definition: SpecializedNodeManager.hpp:49
SkeletonSpecializedForNode allows classes that inherit Skeleton to have constant-time access to a spe...
Definition: SpecializedNodeManager.hpp:129
Declaration of the variadic template.
Definition: SpecializedNodeManager.hpp:120
static T getVectorObjectIfAvailable(std::size_t index, const std::vector< T > &vec)
Definition: StlHelpers.hpp:51
std::multimap< dart::dynamics::Shape *, SimpleFrameShapeDnD * >::iterator iterator
Definition: Viewer.cpp:622
Definition: BulletCollisionDetector.cpp:63
Definition: BasicNodeManager.hpp:82