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>
33
35
37{
38
40 {
41 public:
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
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).
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
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
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
The query::Builder class provides a fluent-style specification of hierarchical queries.
Definition Builder.h:22
Properties defaultProperties() const override
Definition Reader.cpp:73
std::string propertyPrefix() const override
Definition Reader.cpp:67
::armarx::armem::client::query::Builder buildQuery(const Query &query) const
Definition Reader.cpp:27
armem::server::ReadingMemoryInterfacePrx readingPrx() const
The proxy of the memory server this reader is connected to.
Definition Reader.cpp:61
Result query(const Query &query) const
Definition Reader.cpp:109
armarx::core::time::DateTime Time
A room together with the memory ID of the entity instance it was read from.
Definition Reader.h:54
armarx::navigation::algorithms::Room room
Definition Reader.h:57
armem::MemoryID instanceID
The full ID of the entity instance (including provider segment and entity name).
Definition Reader.h:56
std::vector< Entry > entries
The same rooms as in rooms, but with their memory IDs attached.
Definition Reader.h:65
std::vector< armarx::navigation::algorithms::Room > rooms
Definition Reader.h:62
enum armarx::navigation::memory::client::rooms::Reader::Result::Status status