SemanticGraphStorage.cpp
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 VisionX::ArmarXObjects::SemanticGraphStorage
17  * @author Fabian Paus ( fabian dot paus at kit dot edu )
18  * @date 2019
19  * @copyright http://www.gnu.org/licenses/gpl-2.0.txt
20  * GNU General Public License
21  */
22 
23 #include "SemanticGraphStorage.h"
24 
25 
26 namespace armarx
27 {
30  {
31  defineOptionalProperty<std::string>("SemanticGraphTopicName", "SemanticGraphTopic", "Name of the topic on which attributed graphs are reported");
32  }
33 
34 
36  {
37  return "SemanticGraphStorage";
38  }
39 
40 
42  {
43  usingTopicFromProperty("SemanticGraphTopicName");
44  }
45 
46 
48  {
49  }
50 
51 
53  {
54 
55  }
56 
57 
59  {
60 
61  }
62 
63  semantic::data::GraphMap armarx::SemanticGraphStorage::getAll(const Ice::Current&)
64  {
65  std::unique_lock<std::mutex> lock(graphsMutex);
66 
67  return graphs;
68  }
69 
70  void SemanticGraphStorage::remove(const std::string& id, const Ice::Current&)
71  {
72  std::unique_lock<std::mutex> lock(graphsMutex);
73 
74  graphs.erase(id);
75  }
76 
77  void SemanticGraphStorage::removeAll(const Ice::Current&)
78  {
79  std::unique_lock<std::mutex> lock(graphsMutex);
80 
81  graphs.clear();
82  }
83 
84  void SemanticGraphStorage::reportGraph(std::string const& id, semantic::data::Graph const& graph, const Ice::Current&)
85  {
86  ARMARX_INFO << "Got graph with ID: " << id;
87 
88  std::unique_lock<std::mutex> lock(graphsMutex);
89 
90  graphs[id] = graph;
91  }
92 
93 
95  {
98  }
99 }
100 
101 
armarx::SemanticGraphStorage::remove
void remove(const std::string &id, const Ice::Current &) override
Definition: SemanticGraphStorage.cpp:70
armarx::SemanticGraphStoragePropertyDefinitions::SemanticGraphStoragePropertyDefinitions
SemanticGraphStoragePropertyDefinitions(std::string prefix)
Definition: SemanticGraphStorage.cpp:28
armarx::SemanticGraphStorage::onExitComponent
virtual void onExitComponent() override
Definition: SemanticGraphStorage.cpp:58
armarx::SemanticGraphStorage::createPropertyDefinitions
virtual armarx::PropertyDefinitionsPtr createPropertyDefinitions() override
Definition: SemanticGraphStorage.cpp:94
armarx::SemanticGraphStorage::getAll
semantic::data::GraphMap getAll(const Ice::Current &) override
Definition: SemanticGraphStorage.cpp:63
armarx::SemanticGraphStorage::onInitComponent
virtual void onInitComponent() override
Definition: SemanticGraphStorage.cpp:41
armarx::SemanticGraphStorage::onConnectComponent
virtual void onConnectComponent() override
Definition: SemanticGraphStorage.cpp:47
armarx::SemanticGraphStorage::onDisconnectComponent
virtual void onDisconnectComponent() override
Definition: SemanticGraphStorage.cpp:52
SemanticGraphStorage.h
armarx::SemanticGraphStorage::reportGraph
void reportGraph(std::string const &id, semantic::data::Graph const &graph, const Ice::Current &) override
Definition: SemanticGraphStorage.cpp:84
armarx::Component::usingTopicFromProperty
void usingTopicFromProperty(const std::string &propertyName, bool orderedPublishing=false)
Use a topic whose name is specified by the given property.
Definition: Component.cpp:160
armarx::Graph
boost::subgraph< CloudGraph > Graph
Definition: Common.h:54
armarx::Component::getConfigIdentifier
std::string getConfigIdentifier()
Retrieve config identifier for this component as set in constructor.
Definition: Component.cpp:74
armarx::ComponentPropertyDefinitions
Default component property definition container.
Definition: Component.h:70
ARMARX_INFO
#define ARMARX_INFO
Definition: Logging.h:174
IceUtil::Handle< class PropertyDefinitionContainer >
armarx::SemanticGraphStorage::getDefaultName
virtual std::string getDefaultName() const override
Definition: SemanticGraphStorage.cpp:35
armarx::PropertyDefinitionsPtr
IceUtil::Handle< class PropertyDefinitionContainer > PropertyDefinitionsPtr
PropertyDefinitions smart pointer type.
Definition: forward_declarations.h:34
armarx::SemanticGraphStoragePropertyDefinitions
Definition: SemanticGraphStorage.h:39
armarx::SemanticGraphStorage::removeAll
void removeAll(const Ice::Current &) override
Definition: SemanticGraphStorage.cpp:77
armarx
This file offers overloads of toIce() and fromIce() functions for STL container types.
Definition: ArmarXTimeserver.cpp:28