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 namespace armarx
26 {
28  std::string prefix) :
30  {
31  defineOptionalProperty<std::string>(
32  "SemanticGraphTopicName",
33  "SemanticGraphTopic",
34  "Name of the topic on which attributed graphs are reported");
35  }
36 
37  std::string
39  {
40  return "SemanticGraphStorage";
41  }
42 
43  void
45  {
46  usingTopicFromProperty("SemanticGraphTopicName");
47  }
48 
49  void
51  {
52  }
53 
54  void
56  {
57  }
58 
59  void
61  {
62  }
63 
64  semantic::data::GraphMap
66  {
67  std::unique_lock<std::mutex> lock(graphsMutex);
68 
69  return graphs;
70  }
71 
72  void
73  SemanticGraphStorage::remove(const std::string& id, const Ice::Current&)
74  {
75  std::unique_lock<std::mutex> lock(graphsMutex);
76 
77  graphs.erase(id);
78  }
79 
80  void
81  SemanticGraphStorage::removeAll(const Ice::Current&)
82  {
83  std::unique_lock<std::mutex> lock(graphsMutex);
84 
85  graphs.clear();
86  }
87 
88  void
89  SemanticGraphStorage::reportGraph(std::string const& id,
90  semantic::data::Graph const& graph,
91  const Ice::Current&)
92  {
93  ARMARX_INFO << "Got graph with ID: " << id;
94 
95  std::unique_lock<std::mutex> lock(graphsMutex);
96 
97  graphs[id] = graph;
98  }
99 
102  {
105  }
106 } // namespace armarx
armarx::SemanticGraphStorage::remove
void remove(const std::string &id, const Ice::Current &) override
Definition: SemanticGraphStorage.cpp:73
armarx::SemanticGraphStoragePropertyDefinitions::SemanticGraphStoragePropertyDefinitions
SemanticGraphStoragePropertyDefinitions(std::string prefix)
Definition: SemanticGraphStorage.cpp:27
armarx::SemanticGraphStorage::onExitComponent
virtual void onExitComponent() override
Definition: SemanticGraphStorage.cpp:60
armarx::SemanticGraphStorage::createPropertyDefinitions
virtual armarx::PropertyDefinitionsPtr createPropertyDefinitions() override
Definition: SemanticGraphStorage.cpp:101
armarx::SemanticGraphStorage::getAll
semantic::data::GraphMap getAll(const Ice::Current &) override
Definition: SemanticGraphStorage.cpp:65
armarx::SemanticGraphStorage::onInitComponent
virtual void onInitComponent() override
Definition: SemanticGraphStorage.cpp:44
armarx::SemanticGraphStorage::onConnectComponent
virtual void onConnectComponent() override
Definition: SemanticGraphStorage.cpp:50
armarx::SemanticGraphStorage::onDisconnectComponent
virtual void onDisconnectComponent() override
Definition: SemanticGraphStorage.cpp:55
SemanticGraphStorage.h
armarx::SemanticGraphStorage::reportGraph
void reportGraph(std::string const &id, semantic::data::Graph const &graph, const Ice::Current &) override
Definition: SemanticGraphStorage.cpp:89
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:165
armarx::Graph
boost::subgraph< CloudGraph > Graph
Definition: Common.h:58
armarx::Component::getConfigIdentifier
std::string getConfigIdentifier()
Retrieve config identifier for this component as set in constructor.
Definition: Component.cpp:79
armarx::ComponentPropertyDefinitions
Default component property definition container.
Definition: Component.h:69
ARMARX_INFO
#define ARMARX_INFO
Definition: Logging.h:181
IceUtil::Handle< class PropertyDefinitionContainer >
armarx::SemanticGraphStorage::getDefaultName
virtual std::string getDefaultName() const override
Definition: SemanticGraphStorage.cpp:38
armarx::PropertyDefinitionsPtr
IceUtil::Handle< class PropertyDefinitionContainer > PropertyDefinitionsPtr
PropertyDefinitions smart pointer type.
Definition: forward_declarations.h:35
armarx::SemanticGraphStoragePropertyDefinitions
Definition: SemanticGraphStorage.h:39
armarx::SemanticGraphStorage::removeAll
void removeAll(const Ice::Current &) override
Definition: SemanticGraphStorage.cpp:81
armarx
This file offers overloads of toIce() and fromIce() functions for STL container types.
Definition: ArmarXTimeserver.cpp:27