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 <cstdint>
25 #include <string>
26 #include <vector>
27 
29 
35 
36 namespace armarx
37 {
38  class ManagedIceObject;
39 }
40 
42 {
43 
44  struct TimeRange
45  {
48  };
49 
50  /**
51  * @defgroup Component-ExampleClient ExampleClient
52  * @ingroup RobotAPI-Components
53  * A description of the component ExampleClient.
54  *
55  * @class ExampleClient
56  * @ingroup Component-ExampleClient
57  * @brief Brief description of class ExampleClient.
58  *
59  * Detailed description of class ExampleClient.
60  */
61  class Reader
62  {
63  public:
64  Reader();
65  virtual ~Reader();
66 
67  void connect(armem::client::MemoryNameSystem& memoryNameSystem);
68 
69  struct Query
70  {
71  std::string agent;
72 
73  // if not provided, only latest is queried
74  std::optional<TimeRange> timeRange;
75 
76  // if empty, all sensors will be queried
77  std::vector<std::string> sensorList;
78  };
79 
80  struct Result
81  {
82 
83  std::vector<LaserScanStamped> laserScans;
84 
85  std::vector<std::string> sensors;
86 
87  enum Status
88  {
91  } status;
92 
93  std::string errorMessage;
94  };
95 
96  Result queryData(const Query& query) const;
97 
99 
101 
102  private:
103  armem::client::Reader memoryReader;
104 
105  // Properties
106  struct Properties
107  {
108  } properties;
109 
110  const std::string propertyPrefix = "mem.vision.laser_scans.";
111  };
112 
113 } // namespace armarx::armem::laser_scans::client
armarx::armem::laser_scans::client::Reader::Result::Success
@ Success
Definition: Reader.h:90
armarx::armem::client::Reader
Reads data from a memory server.
Definition: Reader.h:24
armarx::armem::laser_scans::client::Reader::Result
Definition: Reader.h:80
Reader.h
armarx::armem::laser_scans::client::Reader::Result::Error
@ Error
Definition: Reader.h:89
armarx::armem::laser_scans::client::Reader::queryData
Result queryData(const Query &query) const
Definition: Reader.cpp:184
client.h
armarx::armem::laser_scans::client::Reader::connect
void connect(armem::client::MemoryNameSystem &memoryNameSystem)
Definition: Reader.cpp:65
armarx::armem::laser_scans::client::Reader::registerPropertyDefinitions
void registerPropertyDefinitions(armarx::PropertyDefinitionsPtr &def)
Definition: Reader.cpp:57
armarx::armem::laser_scans::client::TimeRange::min
Time min
Definition: Reader.h:46
armarx::armem::laser_scans::client::Reader
Definition: Reader.h:61
types.h
armarx::armem::laser_scans::client::Reader::Result::sensors
std::vector< std::string > sensors
Definition: Reader.h:85
armarx::armem::laser_scans::client::Reader::~Reader
virtual ~Reader()
armarx::armem::laser_scans::client::Reader::Result::errorMessage
std::string errorMessage
Definition: Reader.h:93
armarx::armem::laser_scans::client::Reader::Query
Definition: Reader.h:69
armarx::armem::laser_scans::client::Reader::Result::status
enum armarx::armem::laser_scans::client::Reader::Result::Status status
armarx::armem::laser_scans::client::Reader::Result::Status
Status
Definition: Reader.h:87
armarx::armem::laser_scans::client
Definition: Reader.cpp:47
armarx::armem::laser_scans::client::Reader::buildQuery
armarx::armem::client::query::Builder buildQuery(const Query &query) const
Definition: Reader.cpp:85
armarx::armem::laser_scans::client::Reader::Query::sensorList
std::vector< std::string > sensorList
Definition: Reader.h:77
armarx::core::time::DateTime
Represents a point in time.
Definition: DateTime.h:24
armarx::armem::laser_scans::client::TimeRange::max
Time max
Definition: Reader.h:47
PropertyDefinitionContainer.h
IceUtil::Handle< class PropertyDefinitionContainer >
armarx::armem::laser_scans::client::Reader::Result::laserScans
std::vector< LaserScanStamped > laserScans
Definition: Reader.h:83
Builder.h
armarx::armem::client::MemoryNameSystem
The memory name system (MNS) client.
Definition: MemoryNameSystem.h:69
armarx::armem::client::query::Builder
The query::Builder class provides a fluent-style specification of hierarchical queries.
Definition: Builder.h:22
armarx::armem::laser_scans::client::Reader::Reader
Reader()
Definition: Reader.cpp:50
MemoryNameSystem.h
armarx::armem::laser_scans::client::Reader::Query::agent
std::string agent
Definition: Reader.h:71
armarx::armem::laser_scans::client::TimeRange
Definition: Reader.h:44
armarx::armem::laser_scans::client::Reader::Query::timeRange
std::optional< TimeRange > timeRange
Definition: Reader.h:74
armarx
This file offers overloads of toIce() and fromIce() functions for STL container types.
Definition: ArmarXTimeserver.cpp:28