Configurator.h
Go to the documentation of this file.
1 #pragma once
2 
3 #include <string>
4 
5 #include <RobotAPI/interface/armem/server/ConfiguringMemoryInterface.h>
6 
7 namespace armarx::armem::client
8 {
9 
10  /**
11  * @brief Configure a memory server
12  *
13  * Set the persistence strategy for the ltm of a memory server:
14  * Currently available: REST and DISK
15  * TODO: MongoDB
16  */
18  {
19 
20  public:
21  /**
22  * @brief Construct a memory reader.
23  * @param memory The memory proxy.
24  */
25  Configurator(const Configurator&) = default;
26  Configurator(server::ConfiguringMemoryInterfacePrx configuringMemory = nullptr) :
27  configurationPrx(configuringMemory)
28  {
29 
30  }
31 
32  /**
33  * @brief Use a rest server as LTM persistence sink
34  * @param identifier LTM identifier that should be unique and is used as <i>origin</i> when any new instances are commited to the wm.
35  * @param exportName Export name of the LTM at the rest server (e.g. http:://host:port/exportName/...)
36  * @param host ip to the rest server (e.g. localhost or a specific ip)
37  * @param port network port on which the server is accessible (e.g. 8080)
38  * @param overwritePrevStrategy if true, the newly defined strategy overwrites the current strategy resulting in a single strategy.
39  * If false, the newly defined strategy is appened to the current stategies (@see RedundantPersistenceStrategy).
40  */
41  void useRestPersistenceStrategy(const std::string& identifier, const std::string& exportName, const std::string& host, int port, bool overwritePrevStrategy);
42 
43  /**
44  * @brief Use the disk as LTM persistence sink
45  * @param identifier LTM identifier that should be unique and is used as <i>origin</i> when any new instances are commited to the wm.
46  * @param exportName Export name of the LTM on the disk (e.g. /exportPath/exportName/...)
47  * @param exportPath Base path of the ltm export
48  * @param overwritePrevStrategy if true, the newly defined strategy overwrites the current strategy resulting in a single strategy.
49  * If false, the newly defined strategy is appened to the current stategies (@see RedundantPersistenceStrategy).
50  */
51  void useDiskPersistenceStrategy(const std::string& identifier, const std::string& exportName, const std::string& exportPath, bool overwritePrevStrategy);
52 
53  void setConfiguringMemory(server::ConfiguringMemoryInterfacePrx configuringMemory);
54 
55 
56  inline
57  operator bool() const
58  {
59  return bool(configurationPrx);
60  }
61 
62  private:
63 
64  public:
65  server::ConfiguringMemoryInterfacePrx configurationPrx;
66  };
67 
68 } // namespace armarx::armem::client
armarx::armem::client::Configurator::configurationPrx
server::ConfiguringMemoryInterfacePrx configurationPrx
Definition: Configurator.h:65
armarx::armem::client::Configurator::Configurator
Configurator(server::ConfiguringMemoryInterfacePrx configuringMemory=nullptr)
Definition: Configurator.h:26
armarx::armem::client::Configurator::useDiskPersistenceStrategy
void useDiskPersistenceStrategy(const std::string &identifier, const std::string &exportName, const std::string &exportPath, bool overwritePrevStrategy)
Use the disk as LTM persistence sink.
Definition: Configurator.cpp:14
armarx::armem::client
This file is part of ArmarX.
Definition: Configurator.cpp:5
armarx::armem::client::Configurator::Configurator
Configurator(const Configurator &)=default
Construct a memory reader.
armarx::armem::client::Configurator::useRestPersistenceStrategy
void useRestPersistenceStrategy(const std::string &identifier, const std::string &exportName, const std::string &host, int port, bool overwritePrevStrategy)
Use a rest server as LTM persistence sink.
Definition: Configurator.cpp:7
armarx::armem::client::Configurator
Configure a memory server.
Definition: Configurator.h:17
armarx::armem::client::Configurator::setConfiguringMemory
void setConfiguringMemory(server::ConfiguringMemoryInterfacePrx configuringMemory)