SimpleReaderBase.cpp
Go to the documentation of this file.
1#include "SimpleReaderBase.h"
2
5
7{
8
12
13 void
15 {
16 ARMARX_DEBUG << "Writer: registerPropertyDefinitions";
17
18 const std::string prefix = propertyPrefix();
19
20 if (not props.has_value())
21 {
22 props = defaultProperties();
23 }
24
25 def->optional(props->memoryName, prefix + "Memory");
26 def->optional(props->coreSegmentName, prefix + "CoreSegment");
27 }
28
29 void
31 {
32 // Wait for the memory to become available and add it as dependency.
33 ARMARX_IMPORTANT << "SimpleReaderBase: Waiting for memory '" << properties().memoryName
34 << "' (prefix: '" << propertyPrefix() << "') ...";
35 try
36 {
37 memoryReaderClient = mns.useReader(MemoryID().withMemoryName(properties().memoryName));
38 ARMARX_IMPORTANT << "SimpleReaderBase: Connected to memory '" << properties().memoryName
39 << "'";
40 }
42 {
43 ARMARX_ERROR << e.what();
44 return;
45 }
46 }
47
50 {
51 return memoryReaderClient;
52 }
53
56 {
57 if (not props.has_value())
58 {
59 const_cast<std::optional<Properties>&>(props) = defaultProperties();
60 }
61 return props.value();
62 }
63
64 void
66 {
67 props = p;
68 }
69
70} // namespace armarx::armem::client::util
The memory name system (MNS) client.
Reads data from a memory server.
Definition Reader.h:25
const armem::client::Reader & memoryReader() const
virtual Properties defaultProperties() const =0
virtual std::string propertyPrefix() const =0
virtual void connect(armarx::armem::client::MemoryNameSystem &mns)
void registerPropertyDefinitions(armarx::PropertyDefinitionsPtr &def)
Indicates that a query to the Memory Name System failed.
Definition mns.h:25
#define ARMARX_IMPORTANT
The logging level for always important information, but expected behaviour (in contrast to ARMARX_WAR...
Definition Logging.h:190
#define ARMARX_ERROR
The logging level for unexpected behaviour, that must be fixed.
Definition Logging.h:196
#define ARMARX_DEBUG
The logging level for output that is only interesting while debugging.
Definition Logging.h:184
IceUtil::Handle< class PropertyDefinitionContainer > PropertyDefinitionsPtr
PropertyDefinitions smart pointer type.