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>
76 std::size_t
index)
const
83 template <
class SpecNode>
84 template <
class NodeType>
91 template <
class SpecNode>
92 template <
class NodeType>
95 return detail::BasicNodeManagerForBodyNode::getNumNodes<NodeType>();
99 template <
class SpecNode>
102 #ifdef DART_UNITTEST_SPECIALIZED_NODE_ACCESS
103 usedSpecializedNodeAccess =
true;
106 return mSpecNodeIterator->second.size();
110 template <
class SpecNode>
111 template <
class NodeType>
115 return detail::BasicNodeManagerForBodyNode::getNode<NodeType>(
index);
119 template <
class SpecNode>
123 #ifdef DART_UNITTEST_SPECIALIZED_NODE_ACCESS
124 usedSpecializedNodeAccess =
true;
127 return static_cast<SpecNode*
>(
132 template <
class SpecNode>
133 template <
class NodeType>
141 template <
class SpecNode>
149 template <
class SpecNode>
152 mSpecializedTreeNodes[
typeid(SpecNode)] = &mTreeSpecNodeIterators;
155 mSpecNodeNameMgrIterator = mNodeNameMgrMap.find(
typeid(SpecNode));
159 template <
class SpecNode>
160 template <
class NodeType>
162 std::size_t treeIndex)
const
168 template <
class SpecNode>
169 template <
class NodeType>
171 std::size_t treeIndex, std::size_t nodeIndex)
177 template <
class SpecNode>
178 template <
class NodeType>
180 std::size_t treeIndex, std::size_t nodeIndex)
const
187 template <
class SpecNode>
188 template <
class NodeType>
195 template <
class SpecNode>
196 template <
class NodeType>
198 const std::string&
name)
const
205 template <
class SpecNode>
206 template <
class NodeType>
213 template <
class SpecNode>
214 template <
class NodeType>
218 return detail::BasicNodeManagerForSkeleton::getNumNodes<NodeType>(treeIndex);
222 template <
class SpecNode>
226 #ifdef DART_UNITTEST_SPECIALIZED_NODE_ACCESS
227 usedSpecializedNodeAccess =
true;
230 if (treeIndex >= mTreeNodeMaps.size())
232 dterr <<
"[Skeleton::getNumNodes<" <<
typeid(SpecNode).
name() <<
">] "
233 <<
"Requested tree index (" << treeIndex <<
"), but there are only ("
234 << mTreeNodeMaps.size() <<
") trees available\n";
239 return mTreeSpecNodeIterators[treeIndex]->second.size();
243 template <
class SpecNode>
244 template <
class NodeType>
248 return detail::BasicNodeManagerForSkeleton::getNode<NodeType>(
249 treeIndex, nodeIndex);
253 template <
class SpecNode>
257 #ifdef DART_UNITTEST_SPECIALIZED_NODE_ACCESS
258 usedSpecializedNodeAccess =
true;
261 if (treeIndex >= mTreeNodeMaps.size())
263 dterr <<
"[Skeleton::getNode<" <<
typeid(SpecNode).
name() <<
">] "
264 <<
"Requested tree index (" << treeIndex <<
"), but there are only ("
265 << mTreeNodeMaps.size() <<
") trees available\n";
272 if (nodeIndex >= it->second.size())
274 dterr <<
"[Skeleton::getNode<" <<
typeid(SpecNode).
name() <<
">] "
275 <<
"Requested index (" << nodeIndex <<
") within tree (" << treeIndex
276 <<
"), but there are only (" << it->second.size() <<
") Nodes of the "
277 <<
"requested type within that tree\n";
282 return static_cast<SpecNode*
>(it->second[nodeIndex]);
286 template <
class SpecNode>
287 template <
class NodeType>
291 return detail::BasicNodeManagerForSkeleton::getNode<NodeType>(
name);
295 template <
class SpecNode>
299 #ifdef DART_UNITTEST_SPECIALIZED_NODE_ACCESS
300 usedSpecializedNodeAccess =
true;
303 return static_cast<SpecNode*
>(
304 mSpecNodeNameMgrIterator->second.getObject(
name));
308 template <
class SpecNode>
309 template <
class NodeType>
317 template <
class SpecNode>
#define dterr
Output an error message.
Definition: Console.hpp:49
std::string * name
Definition: SkelParser.cpp:1697
std::size_t index
Definition: SkelParser.cpp:1672
class NameManager
Definition: NameManager.hpp:62
BodyNodeSpecializedFor allows classes that inherit BodyNode to have constant-time access to a specifi...
Definition: SpecializedNodeManager.hpp:60
Declaration of the variadic template.
Definition: SpecializedNodeManager.hpp:50
SkeletonSpecializedForNode allows classes that inherit Skeleton to have constant-time access to a spe...
Definition: SpecializedNodeManager.hpp:135
Declaration of the variadic template.
Definition: SpecializedNodeManager.hpp:124
static T getVectorObjectIfAvailable(std::size_t index, const std::vector< T > &vec)
Definition: StlHelpers.hpp:55
std::multimap< dart::dynamics::Shape *, SimpleFrameShapeDnD * >::iterator iterator
Definition: Viewer.cpp:620
Definition: BulletCollisionDetector.cpp:65
Definition: BasicNodeManager.hpp:85