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
32namespace armarx
34 template <class IceBaseClass, class DerivedClass>
35 class GenericFactory;
36}
37
39{
41 armarx::Variant::addTypeName("::memoryx::GraphNodeBase");
42}
43
44namespace 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>
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
constexpr T c
static VariantTypeId addTypeName(const std::string &typeName)
Register a new type for the use in a Variant.
Definition Variant.cpp:869
Entity(const Entity &source)
Definition Entity.cpp:34
Implementation of the ice interface GraphNodeBase.
Definition GraphNode.h:53
static const std::string GRAPH_NODE_ATTR_SCENE
Definition GraphNode.h:33
memoryx::GraphNodeBaseList getAdjacentNodes(const Ice::Current &c=Ice::emptyCurrent) override
GraphNode(const ::armarx::FramedPoseBasePtr pose, const std::string &nodeName, const std::string &scene)
void setScene(const std::string &scene, const ::Ice::Current &=Ice::emptyCurrent) override
Definition GraphNode.cpp:98
::memoryx::EntityRefBasePtr getAdjacentNodeById(const std::string &nodeId, const Ice::Current &c=Ice::emptyCurrent) override
void clearAdjacentNodes(const ::Ice::Current &=Ice::emptyCurrent) override
::armarx::FramedPoseBasePtr getPose(const ::Ice::Current &=Ice::emptyCurrent) const override
Definition GraphNode.cpp:80
bool removeAdjacentNode(const std::string &nodeId, const Ice::Current &) override
GraphNodePtr clone(const Ice::Current &=Ice::emptyCurrent) const
Ice::ObjectPtr ice_clone() const override
friend class armarx::GenericFactory
Definition GraphNode.h:55
int getOutdegree(const ::Ice::Current &=Ice::emptyCurrent) const override
float getYawAngle() const
~GraphNode() override
Definition GraphNode.cpp:75
void addAdjacentNode(const ::memoryx::EntityRefBasePtr &newAdjacentNode, const ::Ice::Current &c=Ice::emptyCurrent) override
::std::string getScene(const ::Ice::Current &=Ice::emptyCurrent) const override
Definition GraphNode.cpp:92
void setPose(const ::armarx::FramedPoseBasePtr &pose, const ::Ice::Current &=Ice::emptyCurrent) override
Definition GraphNode.cpp:86
::memoryx::EntityRefBasePtr getAdjacentNode(::Ice::Int i, const ::Ice::Current &=Ice::emptyCurrent) override
This file offers overloads of toIce() and fromIce() functions for STL container types.
Ice::Int VariantTypeId
Definition Variant.h:43
const armarx::VariantTypeId GraphNode
Definition GraphNode.h:40
VirtualRobot headers.
IceInternal::Handle< GraphNode > GraphNodePtr
Definition GraphNode.h:47