YARP
Yet Another Robot Platform
LaserScan2D.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2006-2020 Istituto Italiano di Tecnologia (IIT)
3  * All rights reserved.
4  *
5  * This software may be modified and distributed under the terms of the
6  * BSD-3-Clause license. See the accompanying LICENSE file for details.
7  */
8 
9 // Autogenerated by Thrift Compiler (0.12.0-yarped)
10 //
11 // This is an automatically generated file.
12 // It could get re-generated if the ALLOW_IDL_GENERATION flag is on.
13 
14 #ifndef YARP_THRIFT_GENERATOR_STRUCT_LASERSCAN2D_H
15 #define YARP_THRIFT_GENERATOR_STRUCT_LASERSCAN2D_H
16 
17 #include <yarp/dev/api.h>
18 
19 #include <yarp/os/Wire.h>
20 #include <yarp/os/idl/WireTypes.h>
21 #include <yarp/sig/Vector.h>
22 
23 namespace yarp {
24 namespace dev {
25 
28 {
29 public:
30  // Fields
34  double angle_min;
38  double angle_max;
42  double range_min;
46  double range_max;
51  std::int32_t status;
52 
53  // Default constructor
54  LaserScan2D();
55 
56  // Constructor with field values
57  LaserScan2D(const double angle_min,
58  const double angle_max,
59  const double range_min,
60  const double range_max,
61  const yarp::sig::Vector& scans,
62  const std::int32_t status);
63 
64  // Read structure on a Wire
65  bool read(yarp::os::idl::WireReader& reader) override;
66 
67  // Read structure on a Connection
68  bool read(yarp::os::ConnectionReader& connection) override;
69 
70  // Write structure on a Wire
71  bool write(const yarp::os::idl::WireWriter& writer) const override;
72 
73  // Write structure on a Connection
74  bool write(yarp::os::ConnectionWriter& connection) const override;
75 
76  // Convert to a printable string
77  std::string toString() const;
78 
79  // If you want to serialize this class without nesting, use this helper
81 
82  class Editor :
83  public yarp::os::Wire,
85  {
86  public:
87  // Editor: default constructor
88  Editor();
89 
90  // Editor: constructor with base class
91  Editor(LaserScan2D& obj);
92 
93  // Editor: destructor
94  ~Editor() override;
95 
96  // Editor: Deleted constructors and operator=
97  Editor(const Editor& rhs) = delete;
98  Editor(Editor&& rhs) = delete;
99  Editor& operator=(const Editor& rhs) = delete;
100  Editor& operator=(Editor&& rhs) = delete;
101 
102  // Editor: edit
103  bool edit(LaserScan2D& obj, bool dirty = true);
104 
105  // Editor: validity check
106  bool isValid() const;
107 
108  // Editor: state
109  LaserScan2D& state();
110 
111  // Editor: start editing
112  void start_editing();
113 
114 #ifndef YARP_NO_DEPRECATED // Since YARP 3.2
115  YARP_DEPRECATED_MSG("Use start_editing() instead")
116  void begin()
117  {
118  start_editing();
119  }
120 #endif // YARP_NO_DEPRECATED
121 
122  // Editor: stop editing
123  void stop_editing();
124 
125 #ifndef YARP_NO_DEPRECATED // Since YARP 3.2
126  YARP_DEPRECATED_MSG("Use stop_editing() instead")
127  void end()
128  {
129  stop_editing();
130  }
131 #endif // YARP_NO_DEPRECATED
132 
133  // Editor: angle_min field
134  void set_angle_min(const double angle_min);
135  double get_angle_min() const;
136  virtual bool will_set_angle_min();
137  virtual bool did_set_angle_min();
138 
139  // Editor: angle_max field
140  void set_angle_max(const double angle_max);
141  double get_angle_max() const;
142  virtual bool will_set_angle_max();
143  virtual bool did_set_angle_max();
144 
145  // Editor: range_min field
146  void set_range_min(const double range_min);
147  double get_range_min() const;
148  virtual bool will_set_range_min();
149  virtual bool did_set_range_min();
150 
151  // Editor: range_max field
152  void set_range_max(const double range_max);
153  double get_range_max() const;
154  virtual bool will_set_range_max();
155  virtual bool did_set_range_max();
156 
157  // Editor: scans field
158  void set_scans(const yarp::sig::Vector& scans);
159  const yarp::sig::Vector& get_scans() const;
160  virtual bool will_set_scans();
161  virtual bool did_set_scans();
162 
163  // Editor: status field
164  void set_status(const std::int32_t status);
165  std::int32_t get_status() const;
166  virtual bool will_set_status();
167  virtual bool did_set_status();
168 
169  // Editor: clean
170  void clean();
171 
172  // Editor: read
173  bool read(yarp::os::ConnectionReader& connection) override;
174 
175  // Editor: write
176  bool write(yarp::os::ConnectionWriter& connection) const override;
177 
178  private:
179  // Editor: state
180  LaserScan2D* obj;
181  bool obj_owned;
182  int group;
183 
184  // Editor: dirty variables
185  bool is_dirty;
186  bool is_dirty_angle_min;
187  bool is_dirty_angle_max;
188  bool is_dirty_range_min;
189  bool is_dirty_range_max;
190  bool is_dirty_scans;
191  bool is_dirty_status;
192  int dirty_count;
193 
194  // Editor: send if possible
195  void communicate();
196 
197  // Editor: mark dirty overall
198  void mark_dirty();
199 
200  // Editor: mark dirty single fields
201  void mark_dirty_angle_min();
202  void mark_dirty_angle_max();
203  void mark_dirty_range_min();
204  void mark_dirty_range_max();
205  void mark_dirty_scans();
206  void mark_dirty_status();
207 
208  // Editor: dirty_flags
209  void dirty_flags(bool flag);
210  };
211 
212 private:
213  // read/write angle_min field
214  bool read_angle_min(yarp::os::idl::WireReader& reader);
215  bool write_angle_min(const yarp::os::idl::WireWriter& writer) const;
216  bool nested_read_angle_min(yarp::os::idl::WireReader& reader);
217  bool nested_write_angle_min(const yarp::os::idl::WireWriter& writer) const;
218 
219  // read/write angle_max field
220  bool read_angle_max(yarp::os::idl::WireReader& reader);
221  bool write_angle_max(const yarp::os::idl::WireWriter& writer) const;
222  bool nested_read_angle_max(yarp::os::idl::WireReader& reader);
223  bool nested_write_angle_max(const yarp::os::idl::WireWriter& writer) const;
224 
225  // read/write range_min field
226  bool read_range_min(yarp::os::idl::WireReader& reader);
227  bool write_range_min(const yarp::os::idl::WireWriter& writer) const;
228  bool nested_read_range_min(yarp::os::idl::WireReader& reader);
229  bool nested_write_range_min(const yarp::os::idl::WireWriter& writer) const;
230 
231  // read/write range_max field
232  bool read_range_max(yarp::os::idl::WireReader& reader);
233  bool write_range_max(const yarp::os::idl::WireWriter& writer) const;
234  bool nested_read_range_max(yarp::os::idl::WireReader& reader);
235  bool nested_write_range_max(const yarp::os::idl::WireWriter& writer) const;
236 
237  // read/write scans field
238  bool read_scans(yarp::os::idl::WireReader& reader);
239  bool write_scans(const yarp::os::idl::WireWriter& writer) const;
240  bool nested_read_scans(yarp::os::idl::WireReader& reader);
241  bool nested_write_scans(const yarp::os::idl::WireWriter& writer) const;
242 
243  // read/write status field
244  bool read_status(yarp::os::idl::WireReader& reader);
245  bool write_status(const yarp::os::idl::WireWriter& writer) const;
246  bool nested_read_status(yarp::os::idl::WireReader& reader);
247  bool nested_write_status(const yarp::os::idl::WireWriter& writer) const;
248 };
249 
250 } // namespace yarp
251 } // namespace dev
252 
253 #endif // YARP_THRIFT_GENERATOR_STRUCT_LASERSCAN2D_H
yarp::sig::file::read
bool read(ImageOf< PixelRgb > &dest, const std::string &src, image_fileformat format=FORMAT_ANY)
Definition: ImageFile.cpp:827
Vector.h
contains the definition of a Vector type
yarp::dev::LaserScan2D::angle_max
double angle_max
last angle of the scan [deg]
Definition: LaserScan2D.h:38
WireTypes.h
yarp::dev::LaserScan2D::status
std::int32_t status
Definition: LaserScan2D.h:51
yarp::dev::LaserScan2D::Editor::operator=
Editor & operator=(Editor &&rhs)=delete
yarp::os::Time::isValid
bool isValid()
Check if time is valid (non-zero).
Definition: Time.cpp:317
Wire.h
yarp::dev::LaserScan2D
Definition: LaserScan2D.h:28
yarp::dev::LaserScan2D::Editor::Editor
Editor(const Editor &rhs)=delete
yarp::os::PortWriter
Interface implemented by all objects that can write themselves to the network, such as Bottle objects...
Definition: PortWriter.h:27
yarp::dev::LaserScan2D::Editor::operator=
Editor & operator=(const Editor &rhs)=delete
yarp::os::idl::WireWriter
IDL-friendly connection writer.
Definition: WireWriter.h:33
yarp::dev::LaserScan2D::Editor
Definition: LaserScan2D.h:85
yarp::sig::VectorOf< double >
yarp::os::ConnectionWriter
An interface for writing to a network connection.
Definition: ConnectionWriter.h:40
yarp::dev::LaserScan2D::unwrapped
yarp::os::idl::Unwrapped< LaserScan2D > unwrapped
Definition: LaserScan2D.h:80
yarp::os::idl::Unwrapped
Definition: Unwrapped.h:22
yarp::os::idl::WirePortable
A "tamed" Portable, that promises to serialize itself in an IDL-friendly way.
Definition: WirePortable.h:26
yarp::dev::LaserScan2D::range_max
double range_max
the maximum distance of the scan [m]
Definition: LaserScan2D.h:46
yarp::os::Wire
Base class for IDL client/server.
Definition: Wire.h:22
yarp::dev::LaserScan2D::Editor::Editor
Editor(Editor &&rhs)=delete
YARP_dev_API
#define YARP_dev_API
Definition: api.h:19
yarp::os::idl::WireReader
IDL-friendly connection reader.
Definition: WireReader.h:33
yarp::os::ConnectionReader
An interface for reading from a network connection.
Definition: ConnectionReader.h:40
yarp::dev::LaserScan2D::angle_min
double angle_min
first angle of the scan [deg]
Definition: LaserScan2D.h:34
YARP_DEPRECATED_MSG
#define YARP_DEPRECATED_MSG(MSG)
Expands to either the standard [[deprecated]] attribute or a compiler-specific decorator such as __at...
Definition: compiler.h:2883
toString
std::string toString(const T &value)
convert an arbitrary type to string.
Definition: fakeMotionControl.cpp:121
yarp
The main, catch-all namespace for YARP.
Definition: environment.h:18
yarp::sig::file::write
bool write(const ImageOf< PixelRgb > &src, const std::string &dest, image_fileformat format=FORMAT_PPM)
Definition: ImageFile.cpp:971
yarp::dev::LaserScan2D::scans
yarp::sig::Vector scans
the scan data, measured in [m].
Definition: LaserScan2D.h:50
api.h
yarp::dev::LaserScan2D::range_min
double range_min
the minimum distance of the scan [m]
Definition: LaserScan2D.h:42