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
26
27namespace armarx
28{
30 std::string prefix) :
32 {
34 "SemanticGraphTopicName",
35 "SemanticGraphTopic",
36 "Name of the topic on which attributed graphs are reported");
37 }
38
39 std::string
41 {
42 return "SemanticGraphStorage";
43 }
44
45 std::string
50
51 void
53 {
54 usingTopicFromProperty("SemanticGraphTopicName");
55 }
56
57 void
61
62 void
66
67 void
71
72 semantic::data::GraphMap
74 {
75 std::unique_lock<std::mutex> lock(graphsMutex);
76
77 return graphs;
78 }
79
80 void
81 SemanticGraphStorage::remove(const std::string& id, const Ice::Current&)
82 {
83 std::unique_lock<std::mutex> lock(graphsMutex);
84
85 graphs.erase(id);
86 }
87
88 void
90 {
91 std::unique_lock<std::mutex> lock(graphsMutex);
92
93 graphs.clear();
94 }
95
96 void
97 SemanticGraphStorage::reportGraph(std::string const& id,
98 semantic::data::Graph const& graph,
99 const Ice::Current&)
100 {
101 ARMARX_INFO << "Got graph with ID: " << id;
102
103 std::unique_lock<std::mutex> lock(graphsMutex);
104
105 graphs[id] = graph;
106 }
107
114
116} // namespace armarx
#define ARMARX_REGISTER_COMPONENT_EXECUTABLE(ComponentT, applicationName)
Definition Decoupled.h:29
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)
Brief description of class SemanticGraphStorage.
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
std::string getDefaultName() const override
Retrieve default name of component.
#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.