Reader.h
Go to the documentation of this file.
1
/*
2
* This file is part of ArmarX.
3
*
4
* ArmarX is free software; you can redistribute it and/or modify
5
* it under the terms of the GNU General Public License version 2 as
6
* published by the Free Software Foundation.
7
*
8
* ArmarX is distributed in the hope that it will be useful, but
9
* WITHOUT ANY WARRANTY; without even the implied warranty of
10
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11
* GNU General Public License for more details.
12
*
13
* You should have received a copy of the GNU General Public License
14
* along with this program. If not, see <http://www.gnu.org/licenses/>.
15
*
16
* @author Fabian Reister ( fabian dot reister at kit dot edu )
17
* @date 2021
18
* @copyright http://www.gnu.org/licenses/gpl-2.0.txt
19
* GNU General Public License
20
*/
21
22
#pragma once
23
24
#include <optional>
25
#include <string>
26
#include <vector>
27
28
#include <RobotAPI/interface/armem/server/MemoryInterface.h>
29
#include <
RobotAPI/libraries/armem/client/query/Builder.h
>
30
#include <
RobotAPI/libraries/armem/client/util/SimpleReaderBase.h
>
31
#include <
RobotAPI/libraries/armem/core/MemoryID.h
>
32
#include <
RobotAPI/libraries/armem/core/forward_declarations.h
>
33
34
#include <
armarx/navigation/algorithms/Room.h
>
35
36
namespace
armarx::navigation::memory::client::rooms
37
{
38
39
class
Reader
:
virtual
public
armarx::armem::client::util::SimpleReaderBase
40
{
41
public
:
42
using
armarx::armem::client::util::SimpleReaderBase::SimpleReaderBase
;
43
~Reader
()
override
;
44
45
struct
Query
46
{
47
std::optional<std::string>
providerName
= std::nullopt;
48
std::optional<std::string>
name
= std::nullopt;
// this is the room name
49
armem::Time
timestamp
;
50
};
51
52
/// A room together with the memory ID of the entity instance it was read from.
53
struct
Entry
54
{
55
/// The full ID of the entity instance (including provider segment and entity name).
56
armem::MemoryID
instanceID
;
57
armarx::navigation::algorithms::Room
room
;
58
};
59
60
struct
Result
61
{
62
std::vector<armarx::navigation::algorithms::Room>
rooms
;
63
64
/// The same rooms as in `rooms`, but with their memory IDs attached.
65
std::vector<Entry>
entries
;
66
67
enum
Status
68
{
69
Success
,
70
NoData
,
71
Error
72
}
status
;
73
74
std::string
errorMessage
=
""
;
75
76
operator
bool() const noexcept
77
{
78
return
status
==
Status::Success
;
79
}
80
};
81
82
Result
query
(
const
Query&
query
)
const
;
83
84
::armarx::armem::client::query::Builder
buildQuery
(
const
Query&
query
)
const
;
85
86
/**
87
* @brief The proxy of the memory server this reader is connected to.
88
*
89
* Can be cast to a more specific interface (e.g. the `NavigationMemoryInterface`)
90
* to access memory-specific functionality such as exporting to disk.
91
*/
92
armem::server::ReadingMemoryInterfacePrx
readingPrx
()
const
;
93
94
protected
:
95
std::string
propertyPrefix
()
const override
;
96
Properties
defaultProperties
()
const override
;
97
};
98
99
}
// namespace armarx::navigation::memory::client::rooms
Builder.h
MemoryID.h
forward_declarations.h
Room.h
SimpleReaderBase.h
armarx::armem::MemoryID
A memory ID.
Definition
MemoryID.h:48
armarx::armem::client::query::Builder
The query::Builder class provides a fluent-style specification of hierarchical queries.
Definition
Builder.h:22
armarx::armem::client::util::SimpleReaderBase
Definition
SimpleReaderBase.h:39
armarx::armem::client::util::SimpleReaderBase::SimpleReaderBase
SimpleReaderBase()
Definition
SimpleReaderBase.cpp:9
armarx::navigation::memory::client::rooms::Reader
Definition
Reader.h:40
armarx::navigation::memory::client::rooms::Reader::defaultProperties
Properties defaultProperties() const override
Definition
Reader.cpp:73
armarx::navigation::memory::client::rooms::Reader::propertyPrefix
std::string propertyPrefix() const override
Definition
Reader.cpp:67
armarx::navigation::memory::client::rooms::Reader::buildQuery
::armarx::armem::client::query::Builder buildQuery(const Query &query) const
Definition
Reader.cpp:27
armarx::navigation::memory::client::rooms::Reader::~Reader
~Reader() override
armarx::navigation::memory::client::rooms::Reader::readingPrx
armem::server::ReadingMemoryInterfacePrx readingPrx() const
The proxy of the memory server this reader is connected to.
Definition
Reader.cpp:61
armarx::navigation::memory::client::rooms::Reader::query
Result query(const Query &query) const
Definition
Reader.cpp:109
armarx::armem::Time
armarx::core::time::DateTime Time
Definition
forward_declarations.h:13
armarx::navigation::memory::client::rooms
Definition
Reader.cpp:23
armarx::status
status
Definition
FiniteStateMachine.h:245
armarx::navigation::algorithms::Room
Definition
Room.h:34
armarx::navigation::memory::client::rooms::Reader::Entry
A room together with the memory ID of the entity instance it was read from.
Definition
Reader.h:54
armarx::navigation::memory::client::rooms::Reader::Entry::room
armarx::navigation::algorithms::Room room
Definition
Reader.h:57
armarx::navigation::memory::client::rooms::Reader::Entry::instanceID
armem::MemoryID instanceID
The full ID of the entity instance (including provider segment and entity name).
Definition
Reader.h:56
armarx::navigation::memory::client::rooms::Reader::Query
Definition
Reader.h:46
armarx::navigation::memory::client::rooms::Reader::Query::name
std::optional< std::string > name
Definition
Reader.h:48
armarx::navigation::memory::client::rooms::Reader::Query::timestamp
armem::Time timestamp
Definition
Reader.h:49
armarx::navigation::memory::client::rooms::Reader::Query::providerName
std::optional< std::string > providerName
Definition
Reader.h:47
armarx::navigation::memory::client::rooms::Reader::Result
Definition
Reader.h:61
armarx::navigation::memory::client::rooms::Reader::Result::entries
std::vector< Entry > entries
The same rooms as in rooms, but with their memory IDs attached.
Definition
Reader.h:65
armarx::navigation::memory::client::rooms::Reader::Result::errorMessage
std::string errorMessage
Definition
Reader.h:74
armarx::navigation::memory::client::rooms::Reader::Result::Status
Status
Definition
Reader.h:68
armarx::navigation::memory::client::rooms::Reader::Result::Error
@ Error
Definition
Reader.h:71
armarx::navigation::memory::client::rooms::Reader::Result::NoData
@ NoData
Definition
Reader.h:70
armarx::navigation::memory::client::rooms::Reader::Result::Success
@ Success
Definition
Reader.h:69
armarx::navigation::memory::client::rooms::Reader::Result::rooms
std::vector< armarx::navigation::algorithms::Room > rooms
Definition
Reader.h:62
armarx::navigation::memory::client::rooms::Reader::Result::status
enum armarx::navigation::memory::client::rooms::Reader::Result::Status status
armarx
navigation
memory
client
rooms
Reader.h
Generated by
1.13.2