Registry.h
Go to the documentation of this file.
1 #pragma once
2 
4 
5 #include <RobotAPI/interface/armem/mns/MemoryNameSystemInterface.h>
6 #include <RobotAPI/interface/armem/server/ActionsInterface.h>
7 #include <RobotAPI/interface/armem/server/PredictingMemoryInterface.h>
8 #include <RobotAPI/interface/armem/server/ReadingMemoryInterface.h>
9 #include <RobotAPI/interface/armem/server/WritingMemoryInterface.h>
10 
12 
13 #include <map>
14 #include <string>
15 
16 
17 namespace armarx::armem::mns
18 {
19 
20  /**
21  * @brief A registry for memory servers.
22  */
24  {
25  public:
26 
27  Registry(const std::string& logTag = "MemoryNameSystem Registry");
28 
29 
30  /// Indicates whether a server entry for that name exists.
31  bool hasServer(const std::string& memoryName) const;
32 
33 
34  /**
35  * @brief Register a new memory server or update an existing entry.
36  *
37  * Causes threads waiting in `waitForMemory()` to resume if the respective
38  * memory server was added.
39  */
40  virtual dto::RegisterServerResult registerServer(const dto::RegisterServerInput& input);
41  /**
42  * @brief Remove a server entry.
43  */
44  dto::RemoveServerResult removeServer(const dto::RemoveServerInput& input);
45 
46 
47  /**
48  * @brief Gets a server entry, if it is available.
49  */
50  dto::ResolveServerResult resolveServer(const dto::ResolveServerInput& input);
51 
52  dto::GetAllRegisteredServersResult getAllRegisteredServers();
53 
54 
55  public:
56 
57  /// Information about a memory entry.
58  struct ServerInfo
59  {
60  std::string name;
61  mns::dto::MemoryServerInterfaces server;
63  };
64 
65  /// The registered memories.
66  std::map<std::string, ServerInfo> servers;
67 
68  };
69 
70 }
armarx::armem::mns::Registry::resolveServer
dto::ResolveServerResult resolveServer(const dto::ResolveServerInput &input)
Gets a server entry, if it is available.
Definition: Registry.cpp:126
armarx::armem::mns::Registry::ServerInfo
Information about a memory entry.
Definition: Registry.h:58
armarx::armem::mns::Registry
A registry for memory servers.
Definition: Registry.h:23
armarx::armem::mns::Registry::ServerInfo::server
mns::dto::MemoryServerInterfaces server
Definition: Registry.h:61
armarx::armem::mns::Registry::hasServer
bool hasServer(const std::string &memoryName) const
Indicates whether a server entry for that name exists.
Definition: Registry.cpp:16
armarx::armem::mns::Registry::removeServer
dto::RemoveServerResult removeServer(const dto::RemoveServerInput &input)
Remove a server entry.
Definition: Registry.cpp:64
armarx::armem::mns::Registry::getAllRegisteredServers
dto::GetAllRegisteredServersResult getAllRegisteredServers()
Definition: Registry.cpp:108
armarx::armem::mns::Registry::ServerInfo::timeRegistered
Time timeRegistered
Definition: Registry.h:62
armarx::armem::mns::Registry::Registry
Registry(const std::string &logTag="MemoryNameSystem Registry")
Definition: Registry.cpp:10
armarx::aron::input
ReaderT::InputType & input
Definition: rw.h:19
armarx::armem::mns
Definition: MemoryNameSystem.cpp:4
armarx::core::time::DateTime
Represents a point in time.
Definition: DateTime.h:24
armarx::Logging
Base Class for all Logging classes.
Definition: Logging.h:232
armarx::armem::mns::Registry::registerServer
virtual dto::RegisterServerResult registerServer(const dto::RegisterServerInput &input)
Register a new memory server or update an existing entry.
Definition: Registry.cpp:22
armarx::armem::laser_scans::constants::memoryName
const std::string memoryName
Definition: constants.h:28
armarx::armem::mns::Registry::ServerInfo::name
std::string name
Definition: Registry.h:60
Time.h
Logging.h
armarx::armem::mns::Registry::servers
std::map< std::string, ServerInfo > servers
The registered memories.
Definition: Registry.h:66