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> class GenericFactory;
35 }
36 
37 namespace memoryx::VariantType
38 {
39  const armarx::VariantTypeId GraphNode = armarx::Variant::addTypeName("::memoryx::GraphNodeBase");
40 }
41 
42 namespace memoryx
43 {
44  class GraphNode;
46 
47  /**
48  * @brief Implementation of the ice interface GraphNodeBase
49  */
50  class GraphNode:
51  virtual public GraphNodeBase,
52  virtual public Entity
53  {
54  template <class IceBaseClass, class DerivedClass>
55  friend class armarx::GenericFactory;
56 
57  GraphNode();
58  public:
59  static const std::string GRAPH_NODE_ATTR_SCENE;
60 
61  GraphNode(const ::armarx::FramedPoseBasePtr pose, const std::string& nodeName, const std::string& scene);
62  /**
63  * @brief Convenience constructor for 2D pose with orientation and global frame.
64  * z, roll and pitch will be zero.
65  * @param x X coordinate value
66  * @param y Y coordinate value
67  * @param alpha Rotation around z axis
68  * @param nodeName name of this node
69  * @param scene Name of the scene
70  */
71  GraphNode(float x, float y, float alpha, const std::string& nodeName, const std::string& scene);
72 
73  ~GraphNode() override;
74 
75  //from ice interface
76  ::armarx::FramedPoseBasePtr getPose(const ::Ice::Current& = Ice::emptyCurrent) const override;
77  void setPose(const ::armarx::FramedPoseBasePtr& pose, const ::Ice::Current& = Ice::emptyCurrent) override;
78  ::std::string getScene(const ::Ice::Current& = Ice::emptyCurrent) const override;
79  void setScene(const std::string& scene, const ::Ice::Current& = Ice::emptyCurrent) override;
80 
81  ::memoryx::EntityRefBasePtr getAdjacentNode(::Ice::Int i, const ::Ice::Current& = Ice::emptyCurrent) override;
82  ::memoryx::EntityRefBasePtr getAdjacentNodeById(const std::string& nodeId, const Ice::Current& c = Ice::emptyCurrent) override;
83  memoryx::GraphNodeBaseList getAdjacentNodes(const Ice::Current& c = Ice::emptyCurrent) override;
84 
85  int getOutdegree(const ::Ice::Current& = Ice::emptyCurrent) const override;
86  void addAdjacentNode(const ::memoryx::EntityRefBasePtr& newAdjacentNode, const ::Ice::Current& c = Ice::emptyCurrent) override;
87  void clearAdjacentNodes(const ::Ice::Current& = Ice::emptyCurrent) override;
88  bool removeAdjacentNode(const std::string& nodeId, const Ice::Current&) override;
89  float getYawAngle() const;
90 
91  Ice::ObjectPtr ice_clone() const override;
92  GraphNodePtr clone(const Ice::Current& = Ice::emptyCurrent) const;
93 
94  };
95 }
96 
memoryx::GraphNode::addAdjacentNode
void addAdjacentNode(const ::memoryx::EntityRefBasePtr &newAdjacentNode, const ::Ice::Current &c=Ice::emptyCurrent) override
Definition: GraphNode.cpp:145
memoryx::GraphNode
Implementation of the ice interface GraphNodeBase.
Definition: GraphNode.h:50
memoryx::GraphNode::clone
GraphNodePtr clone(const Ice::Current &=Ice::emptyCurrent) const
Definition: GraphNode.cpp:193
memoryx::GraphNode::getAdjacentNodeById
::memoryx::EntityRefBasePtr getAdjacentNodeById(const std::string &nodeId, const Ice::Current &c=Ice::emptyCurrent) override
Definition: GraphNode.cpp:117
memoryx::GraphNode::getOutdegree
int getOutdegree(const ::Ice::Current &=Ice::emptyCurrent) const override
Definition: GraphNode.cpp:98
memoryx::VariantType
Definition: Affordance.h:32
memoryx::GraphNode::getPose
::armarx::FramedPoseBasePtr getPose(const ::Ice::Current &=Ice::emptyCurrent) const override
Definition: GraphNode.cpp:78
memoryx::GraphNode::ice_clone
Ice::ObjectPtr ice_clone() const override
Definition: GraphNode.cpp:188
memoryx::GraphNode::~GraphNode
~GraphNode() override
Definition: GraphNode.cpp:74
memoryx
VirtualRobot headers.
Definition: CommonPlacesTester.cpp:48
c
constexpr T c
Definition: UnscentedKalmanFilterTest.cpp:43
memoryx::GraphNode::getAdjacentNode
::memoryx::EntityRefBasePtr getAdjacentNode(::Ice::Int i, const ::Ice::Current &=Ice::emptyCurrent) override
Definition: GraphNode.cpp:103
IceInternal::Handle< GraphNode >
memoryx::VariantType::GraphNode
const armarx::VariantTypeId GraphNode
Definition: GraphNode.h:39
memoryx::GraphNode::setScene
void setScene(const std::string &scene, const ::Ice::Current &=Ice::emptyCurrent) override
Definition: GraphNode.cpp:93
memoryx::GraphNode::clearAdjacentNodes
void clearAdjacentNodes(const ::Ice::Current &=Ice::emptyCurrent) override
Definition: GraphNode.cpp:161
memoryx::GraphNode::GRAPH_NODE_ATTR_SCENE
static const std::string GRAPH_NODE_ATTR_SCENE
Definition: GraphNode.h:59
memoryx::GraphNode::getAdjacentNodes
memoryx::GraphNodeBaseList getAdjacentNodes(const Ice::Current &c=Ice::emptyCurrent) override
Definition: GraphNode.cpp:131
armarx::VariantTypeId
Ice::Int VariantTypeId
Definition: Variant.h:44
Entity.h
memoryx::GraphNode::getYawAngle
float getYawAngle() const
Definition: GraphNode.cpp:181
armarx::VariantType::Int
const VariantTypeId Int
Definition: Variant.h:916
memoryx::GraphNode::setPose
void setPose(const ::armarx::FramedPoseBasePtr &pose, const ::Ice::Current &=Ice::emptyCurrent) override
Definition: GraphNode.cpp:83
armarx::GenericFactory
Definition: FactoryCollectionBase.h:51
memoryx::GraphNode::removeAdjacentNode
bool removeAdjacentNode(const std::string &nodeId, const Ice::Current &) override
Definition: GraphNode.cpp:166
armarx::aron::type::ObjectPtr
std::shared_ptr< Object > ObjectPtr
Definition: Object.h:36
memoryx::Entity
Definition: Entity.h:246
Variant.h
armarx
This file offers overloads of toIce() and fromIce() functions for STL container types.
Definition: ArmarXTimeserver.cpp:28
armarx::Variant::addTypeName
static VariantTypeId addTypeName(const std::string &typeName)
Register a new type for the use in a Variant.
Definition: Variant.cpp:751
memoryx::GraphNode::getScene
::std::string getScene(const ::Ice::Current &=Ice::emptyCurrent) const override
Definition: GraphNode.cpp:88