JsonStorage.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 ArmarXCore::ArmarXObjects::JsonStorage
17  * @author Fabian Paus ( fabian dot paus at kit dot edu )
18  * @date 2020
19  * @copyright http://www.gnu.org/licenses/gpl-2.0.txt
20  * GNU General Public License
21  */
22 
23 #pragma once
24 
25 
27 #include <ArmarXCore/interface/components/JsonStorageInterface.h>
28 
29 #include <mutex>
30 #include <map>
31 
32 namespace armarx
33 {
34 
35  struct JsonStorage
36  : virtual armarx::Component
37  , virtual armarx::JsonStorageInterface
38  {
39  std::string getDefaultName() const override;
40  void onInitComponent() override;
41  void onConnectComponent() override;
42  void onDisconnectComponent() override;
43  void onExitComponent() override;
45 
46  void storeJsonValue(const JsonStoreValue& value, const Ice::Current&) override;
47  JsonRetrieveValue retrieveValue(const std::string& key, const Ice::Current&) override;
48 
49 
50  std::mutex mutex;
51  std::map<std::string, JsonRetrieveValue> data;
52  long revision = 0;
53  };
54 }
armarx::JsonStorage::createPropertyDefinitions
armarx::PropertyDefinitionsPtr createPropertyDefinitions() override
Creates the property definition container.
Definition: JsonStorage.cpp:74
armarx::JsonStorage
Definition: JsonStorage.h:35
armarx::JsonStorage::onInitComponent
void onInitComponent() override
Pure virtual hook for the subclass.
Definition: JsonStorage.cpp:51
armarx::JsonStorage::mutex
std::mutex mutex
Definition: JsonStorage.h:50
armarx::JsonStorage::storeJsonValue
void storeJsonValue(const JsonStoreValue &value, const Ice::Current &) override
Definition: JsonStorage.cpp:80
cxxopts::value
std::shared_ptr< Value > value()
Definition: cxxopts.hpp:926
armarx::JsonStorage::getDefaultName
std::string getDefaultName() const override
Retrieve default name of component.
Definition: JsonStorage.cpp:45
armarx::JsonStorage::retrieveValue
JsonRetrieveValue retrieveValue(const std::string &key, const Ice::Current &) override
Definition: JsonStorage.cpp:96
Component.h
armarx::Component
Baseclass for all ArmarX ManagedIceObjects requiring properties.
Definition: Component.h:95
armarx::JsonStorage::onDisconnectComponent
void onDisconnectComponent() override
Hook for subclass.
Definition: JsonStorage.cpp:63
armarx::JsonStorage::data
std::map< std::string, JsonRetrieveValue > data
Definition: JsonStorage.h:51
armarx::JsonStorage::revision
long revision
Definition: JsonStorage.h:52
IceUtil::Handle< class PropertyDefinitionContainer >
armarx::JsonStorage::onExitComponent
void onExitComponent() override
Hook for subclass.
Definition: JsonStorage.cpp:69
armarx::JsonStorage::onConnectComponent
void onConnectComponent() override
Pure virtual hook for the subclass.
Definition: JsonStorage.cpp:57
armarx
This file offers overloads of toIce() and fromIce() functions for STL container types.
Definition: ArmarXTimeserver.cpp:28