DART  6.7.3
NodeManagerJoiner.hpp
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2011-2019, 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 //==============================================================================
50 template <class Base1>
51 class NodeManagerJoinerForBodyNode<Base1> : public Base1 { };
52 
53 //==============================================================================
58 template <class Base1, class Base2>
59 class NodeManagerJoinerForBodyNode<Base1, Base2> : public Base1, public Base2
60 {
61 public:
62 
65 
68  template <typename Base1Arg, typename... Base2Args>
69  NodeManagerJoinerForBodyNode(Base1Arg&& arg1, Base2Args&&... args2);
70 
73  template <typename Base1Arg>
75 
78  template <typename... Base2Args>
79  NodeManagerJoinerForBodyNode(common::NoArgTag, Base2Args&&... args2);
80 
81  template <class NodeType>
82  std::size_t getNumNodes() const;
83 
84  template <class NodeType>
85  NodeType* getNode(std::size_t index);
86 
87  template <class NodeType>
88  const NodeType* getNode(std::size_t index) const;
89 
90  template <class NodeType>
91  static constexpr bool isSpecializedForNode();
92 
93 };
94 
95 //==============================================================================
98 template <class Base1, class Base2, class... OtherBases>
99 class NodeManagerJoinerForBodyNode<Base1, Base2, OtherBases...> :
100  public NodeManagerJoinerForBodyNode< Base1, NodeManagerJoinerForBodyNode<Base2, OtherBases...> >
101 {
102 public:
103 
105 
106  template <typename... Args>
107  NodeManagerJoinerForBodyNode(Args&&... args);
108 
109 };
110 
111 //==============================================================================
113 template <class... OtherBases>
115 
116 //==============================================================================
118 template <class Base1>
119 class NodeManagerJoinerForSkeleton<Base1> : public Base1 { };
120 
121 //==============================================================================
122 template <class Base1, class Base2>
123 class NodeManagerJoinerForSkeleton<Base1, Base2> :
124  public NodeManagerJoinerForBodyNode<Base1, Base2>
125 {
126 public:
127 
129  using Base::getNumNodes;
130  using Base::getNode;
131  using Base::isSpecializedForNode;
132 
135 
137  template <typename... Args>
138  NodeManagerJoinerForSkeleton(Args&&... args);
139 
142  template <class NodeType>
143  std::size_t getNumNodes(std::size_t treeIndex) const;
144 
147  template <class NodeType>
148  NodeType* getNode(std::size_t treeIndex, std::size_t nodeIndex);
149 
152  template <class NodeType>
153  const NodeType* getNode(std::size_t treeIndex, std::size_t nodeIndex) const;
154 
156  template <class NodeType>
157  NodeType* getNode(const std::string& name);
158 
160  template <class NodeType>
161  const NodeType* getNode(const std::string& name) const;
162 
163 };
164 
165 //==============================================================================
168 template <class Base1, class Base2, class... OtherBases>
169 class NodeManagerJoinerForSkeleton<Base1, Base2, OtherBases...> :
170  public NodeManagerJoinerForSkeleton< Base1, NodeManagerJoinerForSkeleton<Base2, OtherBases...> >
171 {
172 public:
173 
175 
176  template <typename... Args>
177  NodeManagerJoinerForSkeleton(Args&&... args);
178 
179 };
180 
181 } // namespace dynamics
182 } // namespace dart
183 
185 
186 #endif // DART_DYNAMICS_NODEMANAGERJOINER_HPP_
std::string * name
Definition: SkelParser.cpp:1642
std::size_t index
Definition: SkelParser.cpp:1617
NodeManagerJoiner allows classes that inherit from various SpecializedNodeManager types to be inherit...
Definition: NodeManagerJoiner.hpp:60
const NodeType * getNode(std::size_t index) const
Declaration of the variadic template.
Definition: NodeManagerJoiner.hpp:46
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:114
NoArgTag
Used to tag arguments as blank for in variadic joiner classes such as common::CompositeJoiner and dyn...
Definition: Empty.hpp:45
Definition: BulletCollisionDetector.cpp:63