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
24
25namespace armarx
26{
28 std::string prefix) :
30 {
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
53
54 void
58
59 void
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
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
106} // namespace armarx
ComponentPropertyDefinitions(std::string prefix, bool hasObjectNameParameter=true)
Definition Component.cpp:46
void usingTopicFromProperty(const std::string &propertyName, bool orderedPublishing=false)
Use a topic whose name is specified by the given property.
std::string getConfigIdentifier()
Retrieve config identifier for this component as set in constructor.
Definition Component.cpp:90
std::string prefix
Prefix of the properties such as namespace, domain, component name, etc.
PropertyDefinition< PropertyType > & defineOptionalProperty(const std::string &name, PropertyType defaultValue, const std::string &description="", PropertyDefinitionBase::PropertyConstness constness=PropertyDefinitionBase::eConstant)
virtual void onInitComponent() override
void remove(const std::string &id, const Ice::Current &) override
void reportGraph(std::string const &id, semantic::data::Graph const &graph, const Ice::Current &) override
virtual void onDisconnectComponent() override
virtual armarx::PropertyDefinitionsPtr createPropertyDefinitions() override
void removeAll(const Ice::Current &) override
virtual void onConnectComponent() override
semantic::data::GraphMap getAll(const Ice::Current &) override
virtual void onExitComponent() override
virtual std::string getDefaultName() const override
#define ARMARX_INFO
The normal logging level.
Definition Logging.h:181
This file offers overloads of toIce() and fromIce() functions for STL container types.
IceUtil::Handle< class PropertyDefinitionContainer > PropertyDefinitionsPtr
PropertyDefinitions smart pointer type.