GraphNode.h
Go to the documentation of this file.
1 /*
2 * This file is part of ArmarX.
3 *
4 * ArmarX is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License version 2 as
6 * published by the Free Software Foundation.
7 *
8 * ArmarX is distributed in the hope that it will be useful, but
9 * WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
12 *
13 * You should have received a copy of the GNU General Public License
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 *
16 * @package MemoryX::Core
17 * @author Raphael Grimm <raphael dot grimm at kit dot edu>
18 * @date 2014
19 * @copyright http://www.gnu.org/licenses/gpl-2.0.txt
20 * GNU General Public License
21 */
22 #pragma once
23 
24 #include <string>
25 
27 
29 #include <MemoryX/interface/core/EntityBase.h>
30 #include <MemoryX/interface/memorytypes/MemoryEntities.h>
31 
32 namespace armarx
33 {
34  template <class IceBaseClass, class DerivedClass>
35  class GenericFactory;
36 }
37 
38 namespace memoryx::VariantType
39 {
41  armarx::Variant::addTypeName("::memoryx::GraphNodeBase");
42 }
43 
44 namespace memoryx
45 {
46  class GraphNode;
48 
49  /**
50  * @brief Implementation of the ice interface GraphNodeBase
51  */
52  class GraphNode : virtual public GraphNodeBase, virtual public Entity
53  {
54  template <class IceBaseClass, class DerivedClass>
55  friend class armarx::GenericFactory;
56 
57  GraphNode();
58 
59  public:
60  static const std::string GRAPH_NODE_ATTR_SCENE;
61 
62  GraphNode(const ::armarx::FramedPoseBasePtr pose,
63  const std::string& nodeName,
64  const std::string& scene);
65  /**
66  * @brief Convenience constructor for 2D pose with orientation and global frame.
67  * z, roll and pitch will be zero.
68  * @param x X coordinate value
69  * @param y Y coordinate value
70  * @param alpha Rotation around z axis
71  * @param nodeName name of this node
72  * @param scene Name of the scene
73  */
74  GraphNode(float x,
75  float y,
76  float alpha,
77  const std::string& nodeName,
78  const std::string& scene);
79 
80  ~GraphNode() override;
81 
82  //from ice interface
83  ::armarx::FramedPoseBasePtr
84  getPose(const ::Ice::Current& = Ice::emptyCurrent) const override;
85  void setPose(const ::armarx::FramedPoseBasePtr& pose,
86  const ::Ice::Current& = Ice::emptyCurrent) override;
87  ::std::string getScene(const ::Ice::Current& = Ice::emptyCurrent) const override;
88  void setScene(const std::string& scene, const ::Ice::Current& = Ice::emptyCurrent) override;
89 
90  ::memoryx::EntityRefBasePtr
91  getAdjacentNode(::Ice::Int i, const ::Ice::Current& = Ice::emptyCurrent) override;
92  ::memoryx::EntityRefBasePtr
93  getAdjacentNodeById(const std::string& nodeId,
94  const Ice::Current& c = Ice::emptyCurrent) override;
95  memoryx::GraphNodeBaseList
96  getAdjacentNodes(const Ice::Current& c = Ice::emptyCurrent) override;
97 
98  int getOutdegree(const ::Ice::Current& = Ice::emptyCurrent) const override;
99  void addAdjacentNode(const ::memoryx::EntityRefBasePtr& newAdjacentNode,
100  const ::Ice::Current& c = Ice::emptyCurrent) override;
101  void clearAdjacentNodes(const ::Ice::Current& = Ice::emptyCurrent) override;
102  bool removeAdjacentNode(const std::string& nodeId, const Ice::Current&) override;
103  float getYawAngle() const;
104 
105  Ice::ObjectPtr ice_clone() const override;
106  GraphNodePtr clone(const Ice::Current& = Ice::emptyCurrent) const;
107  };
108 } // namespace memoryx
memoryx::GraphNode::addAdjacentNode
void addAdjacentNode(const ::memoryx::EntityRefBasePtr &newAdjacentNode, const ::Ice::Current &c=Ice::emptyCurrent) override
Definition: GraphNode.cpp:157
memoryx::GraphNode
Implementation of the ice interface GraphNodeBase.
Definition: GraphNode.h:52
memoryx::GraphNode::clone
GraphNodePtr clone(const Ice::Current &=Ice::emptyCurrent) const
Definition: GraphNode.cpp:213
memoryx::GraphNode::getAdjacentNodeById
::memoryx::EntityRefBasePtr getAdjacentNodeById(const std::string &nodeId, const Ice::Current &c=Ice::emptyCurrent) override
Definition: GraphNode.cpp:127
memoryx::GraphNode::getOutdegree
int getOutdegree(const ::Ice::Current &=Ice::emptyCurrent) const override
Definition: GraphNode.cpp:104
memoryx::VariantType
Definition: Affordance.h:31
memoryx::GraphNode::getPose
::armarx::FramedPoseBasePtr getPose(const ::Ice::Current &=Ice::emptyCurrent) const override
Definition: GraphNode.cpp:80
memoryx::GraphNode::ice_clone
Ice::ObjectPtr ice_clone() const override
Definition: GraphNode.cpp:207
memoryx::GraphNode::~GraphNode
~GraphNode() override
Definition: GraphNode.cpp:75
memoryx
VirtualRobot headers.
Definition: CommonPlacesTester.cpp:48
c
constexpr T c
Definition: UnscentedKalmanFilterTest.cpp:46
memoryx::GraphNode::getAdjacentNode
::memoryx::EntityRefBasePtr getAdjacentNode(::Ice::Int i, const ::Ice::Current &=Ice::emptyCurrent) override
Definition: GraphNode.cpp:110
IceInternal::Handle< GraphNode >
memoryx::VariantType::GraphNode
const armarx::VariantTypeId GraphNode
Definition: GraphNode.h:40
memoryx::GraphNode::setScene
void setScene(const std::string &scene, const ::Ice::Current &=Ice::emptyCurrent) override
Definition: GraphNode.cpp:98
memoryx::GraphNode::clearAdjacentNodes
void clearAdjacentNodes(const ::Ice::Current &=Ice::emptyCurrent) override
Definition: GraphNode.cpp:176
memoryx::GraphNode::GRAPH_NODE_ATTR_SCENE
static const std::string GRAPH_NODE_ATTR_SCENE
Definition: GraphNode.h:60
memoryx::GraphNode::getAdjacentNodes
memoryx::GraphNodeBaseList getAdjacentNodes(const Ice::Current &c=Ice::emptyCurrent) override
Definition: GraphNode.cpp:142
armarx::VariantTypeId
Ice::Int VariantTypeId
Definition: Variant.h:43
Entity.h
memoryx::GraphNode::getYawAngle
float getYawAngle() const
Definition: GraphNode.cpp:199
armarx::VariantType::Int
const VariantTypeId Int
Definition: Variant.h:917
memoryx::GraphNode::setPose
void setPose(const ::armarx::FramedPoseBasePtr &pose, const ::Ice::Current &=Ice::emptyCurrent) override
Definition: GraphNode.cpp:86
armarx::GenericFactory
Definition: FactoryCollectionBase.h:51
memoryx::GraphNode::removeAdjacentNode
bool removeAdjacentNode(const std::string &nodeId, const Ice::Current &) override
Definition: GraphNode.cpp:183
armarx::aron::type::ObjectPtr
std::shared_ptr< Object > ObjectPtr
Definition: Object.h:36
memoryx::Entity
Definition: Entity.h:245
Variant.h
armarx
This file offers overloads of toIce() and fromIce() functions for STL container types.
Definition: ArmarXTimeserver.cpp:27
armarx::Variant::addTypeName
static VariantTypeId addTypeName(const std::string &typeName)
Register a new type for the use in a Variant.
Definition: Variant.cpp:869
memoryx::GraphNode::getScene
::std::string getScene(const ::Ice::Current &=Ice::emptyCurrent) const override
Definition: GraphNode.cpp:92