SimpleReaderBase.cpp
Go to the documentation of this file.
1
#include "
SimpleReaderBase.h
"
2
3
#include <
RobotAPI/libraries/armem/client/MemoryNameSystem.h
>
4
#include <
RobotAPI/libraries/armem/core/error.h
>
5
6
namespace
armarx::armem::client::util
7
{
8
9
SimpleReaderBase::SimpleReaderBase
()
10
{
11
}
12
13
void
14
SimpleReaderBase::registerPropertyDefinitions
(
armarx::PropertyDefinitionsPtr
& def)
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
30
SimpleReaderBase::connect
(
armarx::armem::client::MemoryNameSystem
& mns)
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
}
41
catch
(
const
armem::error::CouldNotResolveMemoryServer
& e)
42
{
43
ARMARX_ERROR
<< e.what();
44
return
;
45
}
46
}
47
48
const
armem::client::Reader
&
49
SimpleReaderBase::memoryReader
()
const
50
{
51
return
memoryReaderClient;
52
}
53
54
const
SimpleReaderBase::Properties
&
55
SimpleReaderBase::properties
()
const
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
65
SimpleReaderBase::setProperties
(
const
Properties
& p)
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
RobotAPI
libraries
armem
client
util
SimpleReaderBase.cpp
Generated on Sat Oct 12 2024 09:14:08 for armarx_documentation by
1.8.17