SimpleReaderBase.cpp
Go to the documentation of this file.
1 #include "SimpleReaderBase.h"
2 
5 
7 {
8 
10  {
11  }
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  << "' ...";
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
armarx::armem::client::Reader
Reads data from a memory server.
Definition: Reader.h:24
armarx::armem::client::util::SimpleReaderBase::properties
const Properties & properties() const
Definition: SimpleReaderBase.cpp:55
armarx::armem::client::util::SimpleReaderBase::defaultProperties
virtual Properties defaultProperties() const =0
ARMARX_IMPORTANT
#define ARMARX_IMPORTANT
Definition: Logging.h:183
armarx::armem::client::util::SimpleReaderBase::setProperties
void setProperties(const Properties &p)
Definition: SimpleReaderBase.cpp:65
armarx::armem::client::util::SimpleReaderBase::registerPropertyDefinitions
void registerPropertyDefinitions(armarx::PropertyDefinitionsPtr &def)
Definition: SimpleReaderBase.cpp:14
armarx::armem::client::util::SimpleReaderBase::Properties::memoryName
std::string memoryName
Definition: SimpleReaderBase.h:45
ARMARX_DEBUG
#define ARMARX_DEBUG
Definition: Logging.h:177
armarx::armem::client::util::SimpleReaderBase::connect
virtual void connect(armarx::armem::client::MemoryNameSystem &mns)
Definition: SimpleReaderBase.cpp:30
error.h
armarx::armem::client::MemoryNameSystem::useReader
Reader useReader(const MemoryID &memoryID)
Use a memory server and get a reader for it.
Definition: MemoryNameSystem.cpp:184
armarx::armem::client::util::SimpleReaderBase::propertyPrefix
virtual std::string propertyPrefix() const =0
armarx::armem::client::util::SimpleReaderBase::memoryReader
const armem::client::Reader & memoryReader() const
Definition: SimpleReaderBase.cpp:49
ARMARX_ERROR
#define ARMARX_ERROR
Definition: Logging.h:189
armarx::armem::client::util::SimpleReaderBase::Properties
Definition: SimpleReaderBase.h:43
armarx::armem::laser_scans::constants::memoryName
const std::string memoryName
Definition: constants.h:28
IceUtil::Handle< class PropertyDefinitionContainer >
armarx::armem::client::util
Definition: MemoryListener.cpp:13
armarx::armem::client::MemoryNameSystem
The memory name system (MNS) client.
Definition: MemoryNameSystem.h:69
armarx::armem::client::util::SimpleReaderBase::SimpleReaderBase
SimpleReaderBase()
Definition: SimpleReaderBase.cpp:9
armarx::armem::error::CouldNotResolveMemoryServer
Indicates that a query to the Memory Name System failed.
Definition: mns.h:26
MemoryNameSystem.h
SimpleReaderBase.h
armarx::human::MemoryID
const armem::MemoryID MemoryID
Definition: memory_ids.cpp:29