DART  6.7.3
CompositeNode.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_DETAIL_COMPOSITENODE_HPP_
34 #define DART_DYNAMICS_DETAIL_COMPOSITENODE_HPP_
35 
37 
38 namespace dart {
39 namespace dynamics {
40 
41 //==============================================================================
42 template <class Base>
44 {
45  common::Composite::setCompositeState(static_cast<const State&>(otherState));
46 }
47 
48 //==============================================================================
49 template <class Base>
50 std::unique_ptr<Node::State> CompositeStateNode<Base>::getNodeState() const
51 {
52  return common::make_unique<State>(common::Composite::getCompositeState());
53 }
54 
55 //==============================================================================
56 template <class Base>
58  std::unique_ptr<Node::State>& outputState) const
59 {
60  common::Composite::copyCompositeStateTo(static_cast<State&>(*outputState));
61 }
62 
63 //==============================================================================
64 template <class Base>
66  const Node::Properties& otherProperties)
67 {
69  static_cast<const Properties&>(otherProperties));
70 }
71 
72 //==============================================================================
73 template <class Base>
74 std::unique_ptr<Node::Properties>
76 {
77  return common::make_unique<Properties>(
79 }
80 
81 //==============================================================================
82 template <class Base>
84  std::unique_ptr<Node::Properties>& outputProperties) const
85 {
87  static_cast<Properties&>(*outputProperties));
88 }
89 
90 } // namespace dynamics
91 } // namespace dart
92 
93 #endif // DART_DYNAMICS_DETAIL_COMPOSITENODE_HPP_
State getCompositeState() const
Get the states of the aspects inside of this Composite.
Definition: Composite.cpp:154
void copyCompositeStateTo(State &outgoingStates) const
Fill outgoingStates with the states of the aspects inside this Composite.
Definition: Composite.cpp:163
Properties getCompositeProperties() const
Get the properties of the aspects inside of this Composite.
Definition: Composite.cpp:179
void setCompositeProperties(const Properties &newProperties)
Set the properties of the aspects in this Composite based on the given Composite::Properties.
Definition: Composite.cpp:171
void copyCompositePropertiesTo(Properties &outgoingProperties) const
Fill outgoingProperties with the properties of the aspects inside this Composite.
Definition: Composite.cpp:188
void setCompositeState(const State &newStates)
Set the states of the aspects in this Composite based on the given Composite::State.
Definition: Composite.cpp:147
The MakeCloneable class is used to easily create an Cloneable (such as Node::State) which simply take...
Definition: Cloneable.hpp:85
void setNodeProperties(const Node::Properties &otherProperties) override final
Definition: CompositeNode.hpp:65
std::unique_ptr< Node::Properties > getNodeProperties() const override final
Definition: CompositeNode.hpp:75
void copyNodePropertiesTo(std::unique_ptr< Node::Properties > &outputProperties) const override final
Definition: CompositeNode.hpp:83
void copyNodeStateTo(std::unique_ptr< Node::State > &outputState) const override final
Definition: CompositeNode.hpp:57
void setNodeState(const Node::State &otherState) override final
Definition: CompositeNode.hpp:43
std::unique_ptr< Node::State > getNodeState() const override final
Definition: CompositeNode.hpp:50
If your Node has a Properties class, then that Properties class should inherit this Node::Properties ...
Definition: Node.hpp:124
If your Node has a State class, then that State class should inherit this Node::State class.
Definition: Node.hpp:105
Definition: BulletCollisionDetector.cpp:63