Go to the documentation of this file.
3 #include <SimoxUtility/json.h>
71 const std::string& exportName,
72 const std::string& host,
74 bool disableIfNotAvailable =
false) :
77 client_ = std::make_shared<httplib::Client>(host, port);
81 if (disableIfNotAvailable && !available)
101 std::vector<unsigned char>&
data)
override;
104 std::string key)
override;
107 const std::string& prefix)
override;
116 std::shared_ptr<httplib::Client> client_;
118 std::string host_ =
"localhost";
142 const std::vector<unsigned char>&
data);
146 nlohmann::json& jsonData);
151 const std::vector<unsigned char>&
data);
155 void setPort(
int port);
159 void setHost(std::string& host);
161 std::string getHost();
168 std::string getMimeType(
DataType type);
Persistence strategy that uses a rest server as its data sink.
Abstract memory persistence strategy (resp.
RestPersistence(const std::string &identifier, const std::string &exportName)
std::vector< std::string > getItemKeys(const armarx::armem::MemoryID &id) override
Keys of the actual items containing data stored for the memory id.
bool containsItem(const armarx::armem::MemoryID &id, std::string key) override
std::vector< unsigned char > retrieveItem(const armarx::armem::MemoryID &id, std::string key) override
Retrieve the actual data of an item stored for the memory id.
const static int DEFAULT_PORT
const static std::string DEFAULT_HOST
bool containsContainer(const armarx::armem::MemoryID &id, std::string key) override
bool checkConnection()
Checks if the server is up.
std::vector< std::string > getContainerKeys(const armarx::armem::MemoryID &id) override
Returns keys that allow use to move a step further in the hierarchy (e.g.
void createPropertyDefinitions(PropertyDefinitionsPtr &defs, const std::string &prefix) override
void storeItem(const armarx::armem::MemoryID &id, std::string key, std::vector< unsigned char > &data) override
Stores an item containing actual data for the current memory id.
RestPersistence(const std::string &identifier, const std::string &exportName, const std::string &host, int port, bool disableIfNotAvailable=false)