DART  6.10.1
NodeManagerJoiner.hpp
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2011-2021, The DART development contributors
3  * All rights reserved.
4  *
5  * The list of contributors can be found at:
6  * https://github.com/dartsim/dart/blob/master/LICENSE
7  *
8  * This file is provided under the following "BSD-style" License:
9  * Redistribution and use in source and binary forms, with or
10  * without modification, are permitted provided that the following
11  * conditions are met:
12  * * Redistributions of source code must retain the above copyright
13  * notice, this list of conditions and the following disclaimer.
14  * * Redistributions in binary form must reproduce the above
15  * copyright notice, this list of conditions and the following
16  * disclaimer in the documentation and/or other materials provided
17  * with the distribution.
18  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
19  * CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
20  * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
21  * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
22  * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
23  * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
24  * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
25  * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
26  * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
27  * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
28  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
29  * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
30  * POSSIBILITY OF SUCH DAMAGE.
31  */
32 
33 #ifndef DART_DYNAMICS_NODEMANAGERJOINER_HPP_
34 #define DART_DYNAMICS_NODEMANAGERJOINER_HPP_
35 
36 #include <string>
37 
38 #include "dart/common/Empty.hpp"
39 
40 namespace dart {
41 namespace dynamics {
42 
43 //==============================================================================
45 template <class... OtherBases>
47 {
48 };
49 
50 //==============================================================================
52 template <class Base1>
53 class NodeManagerJoinerForBodyNode<Base1> : public Base1
54 {
55 };
56 
57 //==============================================================================
62 template <class Base1, class Base2>
63 class NodeManagerJoinerForBodyNode<Base1, Base2> : public Base1, public Base2
64 {
65 public:
68 
71  template <typename Base1Arg, typename... Base2Args>
72  NodeManagerJoinerForBodyNode(Base1Arg&& arg1, Base2Args&&... args2);
73 
76  template <typename Base1Arg>
78 
81  template <typename... Base2Args>
82  NodeManagerJoinerForBodyNode(common::NoArgTag, Base2Args&&... args2);
83 
84  template <class NodeType>
85  std::size_t getNumNodes() const;
86 
87  template <class NodeType>
88  NodeType* getNode(std::size_t index);
89 
90  template <class NodeType>
91  const NodeType* getNode(std::size_t index) const;
92 
93  template <class NodeType>
94  static constexpr bool isSpecializedForNode();
95 };
96 
97 //==============================================================================
100 template <class Base1, class Base2, class... OtherBases>
101 class NodeManagerJoinerForBodyNode<Base1, Base2, OtherBases...>
103  Base1,
104  NodeManagerJoinerForBodyNode<Base2, OtherBases...> >
105 {
106 public:
108 
109  template <typename... Args>
110  NodeManagerJoinerForBodyNode(Args&&... args);
111 };
112 
113 //==============================================================================
115 template <class... OtherBases>
117 {
118 };
119 
120 //==============================================================================
122 template <class Base1>
123 class NodeManagerJoinerForSkeleton<Base1> : public Base1
124 {
125 };
126 
127 //==============================================================================
128 template <class Base1, class Base2>
129 class NodeManagerJoinerForSkeleton<Base1, Base2>
130  : public NodeManagerJoinerForBodyNode<Base1, Base2>
131 {
132 public:
134  using Base::getNode;
135  using Base::getNumNodes;
136  using Base::isSpecializedForNode;
137 
140 
142  template <typename... Args>
143  NodeManagerJoinerForSkeleton(Args&&... args);
144 
147  template <class NodeType>
148  std::size_t getNumNodes(std::size_t treeIndex) const;
149 
152  template <class NodeType>
153  NodeType* getNode(std::size_t treeIndex, std::size_t nodeIndex);
154 
157  template <class NodeType>
158  const NodeType* getNode(std::size_t treeIndex, std::size_t nodeIndex) const;
159 
161  template <class NodeType>
162  NodeType* getNode(const std::string& name);
163 
165  template <class NodeType>
166  const NodeType* getNode(const std::string& name) const;
167 };
168 
169 //==============================================================================
172 template <class Base1, class Base2, class... OtherBases>
173 class NodeManagerJoinerForSkeleton<Base1, Base2, OtherBases...>
175  Base1,
176  NodeManagerJoinerForSkeleton<Base2, OtherBases...> >
177 {
178 public:
180 
181  template <typename... Args>
182  NodeManagerJoinerForSkeleton(Args&&... args);
183 };
184 
185 } // namespace dynamics
186 } // namespace dart
187 
189 
190 #endif // DART_DYNAMICS_NODEMANAGERJOINER_HPP_
std::string * name
Definition: SkelParser.cpp:1697
std::size_t index
Definition: SkelParser.cpp:1672
NodeManagerJoiner allows classes that inherit from various SpecializedNodeManager types to be inherit...
Definition: NodeManagerJoiner.hpp:64
const NodeType * getNode(std::size_t index) const
Declaration of the variadic template.
Definition: NodeManagerJoiner.hpp:47
NodeType * getNode(const std::string &name)
Get the Node of the specified type with the given name.
NodeType * getNode(std::size_t treeIndex, std::size_t nodeIndex)
Get the nodeIndexth Node of the specified type within the tree of treeIndex.
const NodeType * getNode(const std::string &name) const
Get the Node of the specified type with the given name.
const NodeType * getNode(std::size_t treeIndex, std::size_t nodeIndex) const
Get the nodeIndexth Node of the specified type within the tree of treeIndex.
Declaration of variadic template.
Definition: NodeManagerJoiner.hpp:117
NoArgTag
Used to tag arguments as blank for in variadic joiner classes such as common::CompositeJoiner and dyn...
Definition: Empty.hpp:48
Definition: BulletCollisionDetector.cpp:65