GraphMemorySegment.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
23#pragma once
24
26
28#include <MemoryX/interface/components/PriorKnowledgeInterface.h>
29#include <MemoryX/interface/memorytypes/MemoryEntities.h>
30#include <MemoryX/interface/memorytypes/MemorySegments.h>
31
32namespace memoryx
33{
34
35 /**
36 * @class GraphMemorySegment
37 *
38 * @brief The Graph Memory Segment contains directed graphs. The graph consists of nodes with poses and edges between them.
39 * The poses in the nodes and the edges are used for platform navigation. Additionally, thee nodes are used for symbolic planning.
40 * One segment can contain multiple graphs. They distinguished by their *scene*-name.
41 * See Slice API documentation for GraphMemorySegmentBase.
42 */
44 virtual public PersistentEntitySegment,
45 virtual public GraphMemorySegmentBase
46 {
47 public:
48 GraphMemorySegment(CollectionInterfacePrx entityCollection,
50 bool useMongoIds = true);
51
52 ~GraphMemorySegment() override;
53
54 Ice::StringSeq getScenes(const Ice::Current& c = Ice::emptyCurrent) const override;
55
56 memoryx::GraphNodeBaseList
57 getNodesByScene(const std::string& sceneName,
58 const Ice::Current& c = Ice::emptyCurrent) override;
59 memoryx::GraphNodeBasePtr getNodeById(const std::string& entityId,
60 const Ice::Current& c = Ice::emptyCurrent) override;
61 memoryx::GraphNodeBasePtr getNodeByName(const std::string& entityName,
62 const Ice::Current& c = Ice::emptyCurrent) override;
63 memoryx::GraphNodeBaseList getAllNodes(const Ice::Current& c = Ice::emptyCurrent) override;
64
65 void clearScene(const std::string& sceneName,
66 const Ice::Current& c = Ice::emptyCurrent) override;
67
68 bool removeNode(const std::string&, const Ice::Current&) override;
69 bool removeEdge(const std::string& startNodeId,
70 const std::string& endNodeId,
71 const Ice::Current&) override;
72
73 std::string addNode(const memoryx::GraphNodeBasePtr& node,
74 const Ice::Current& c = Ice::emptyCurrent) override;
75 bool addEdge(const std::string& fromId,
76 const std::string& toId,
77 const Ice::Current& c = Ice::emptyCurrent) override;
78
79 bool hasScene(const ::std::string& sceneName,
80 const ::Ice::Current& c = Ice::emptyCurrent) override;
81 bool hasNodeWithName(const ::std::string& sceneName,
82 const ::std::string& nodeName,
83 const ::Ice::Current& = Ice::emptyCurrent) override;
84
85 ::memoryx::GraphNodeBasePtr
86 getNodeFromSceneByName(const ::std::string& sceneName,
87 const ::std::string& nodeName,
88 const ::Ice::Current& = Ice::emptyCurrent) override;
89 // virtual std::string getIdOfNearestNode(const ::std::string& sceneName, ::Ice::Float x, ::Ice::Float y, const ::Ice::Current& = Ice::emptyCurrent);
90
91 ::memoryx::GraphNodeBaseList aStar(const ::std::string& idFrom,
92 const ::std::string& idTo,
93 const ::Ice::Current& = Ice::emptyCurrent) override;
94
95 private:
96 memoryx::GraphNodeBasePtr getNodeById(const std::string& entityId,
97 const Ice::Current& c = Ice::emptyCurrent) const;
98 };
99
101} // namespace memoryx
#define ARMARXCOMPONENT_IMPORT_EXPORT
constexpr T c
memoryx::GraphNodeBaseList getNodesByScene(const std::string &sceneName, const Ice::Current &c=Ice::emptyCurrent) override
bool addEdge(const std::string &fromId, const std::string &toId, const Ice::Current &c=Ice::emptyCurrent) override
memoryx::GraphNodeBaseList getAllNodes(const Ice::Current &c=Ice::emptyCurrent) override
::memoryx::GraphNodeBaseList aStar(const ::std::string &idFrom, const ::std::string &idTo, const ::Ice::Current &=Ice::emptyCurrent) override
Ice::StringSeq getScenes(const Ice::Current &c=Ice::emptyCurrent) const override
::memoryx::GraphNodeBasePtr getNodeFromSceneByName(const ::std::string &sceneName, const ::std::string &nodeName, const ::Ice::Current &=Ice::emptyCurrent) override
GraphMemorySegment(CollectionInterfacePrx entityCollection, Ice::CommunicatorPtr ic, bool useMongoIds=true)
bool hasScene(const ::std::string &sceneName, const ::Ice::Current &c=Ice::emptyCurrent) override
bool hasNodeWithName(const ::std::string &sceneName, const ::std::string &nodeName, const ::Ice::Current &=Ice::emptyCurrent) override
bool removeNode(const std::string &, const Ice::Current &) override
memoryx::GraphNodeBasePtr getNodeByName(const std::string &entityName, const Ice::Current &c=Ice::emptyCurrent) override
void clearScene(const std::string &sceneName, const Ice::Current &c=Ice::emptyCurrent) override
std::string addNode(const memoryx::GraphNodeBasePtr &node, const Ice::Current &c=Ice::emptyCurrent) override
memoryx::GraphNodeBasePtr getNodeById(const std::string &entityId, const Ice::Current &c=Ice::emptyCurrent) override
bool removeEdge(const std::string &startNodeId, const std::string &endNodeId, const Ice::Current &) override
PersistentEntitySegment(CollectionInterfacePrx entityCollection, Ice::CommunicatorPtr ic, bool useMongoIds=true)
::IceInternal::Handle<::Ice::Communicator > CommunicatorPtr
Definition IceManager.h:49
VirtualRobot headers.
IceInternal::Handle< GraphMemorySegment > GraphMemorySegmentPtr