YARP
Yet Another Robot Platform
SensorMeasurement.h
Go to the documentation of this file.
1 /*
2  * SPDX-FileCopyrightText: 2006-2021 Istituto Italiano di Tecnologia (IIT)
3  * SPDX-License-Identifier: BSD-3-Clause
4  */
5 
6 // Autogenerated by Thrift Compiler (0.14.1-yarped)
7 //
8 // This is an automatically generated file.
9 // It could get re-generated if the ALLOW_IDL_GENERATION flag is on.
10 
11 #ifndef YARP_THRIFT_GENERATOR_STRUCT_SENSORMEASUREMENT_H
12 #define YARP_THRIFT_GENERATOR_STRUCT_SENSORMEASUREMENT_H
13 
14 #include <yarp/os/Wire.h>
15 #include <yarp/os/idl/WireTypes.h>
16 #include <yarp/sig/Vector.h>
17 
20 {
21 public:
22  // Fields
24  double timestamp;
25 
26  // Default constructor
28 
29  // Constructor with field values
31  const double timestamp);
32 
33  // Read structure on a Wire
34  bool read(yarp::os::idl::WireReader& reader) override;
35 
36  // Read structure on a Connection
37  bool read(yarp::os::ConnectionReader& connection) override;
38 
39  // Write structure on a Wire
40  bool write(const yarp::os::idl::WireWriter& writer) const override;
41 
42  // Write structure on a Connection
43  bool write(yarp::os::ConnectionWriter& connection) const override;
44 
45  // Convert to a printable string
46  std::string toString() const;
47 
48  // If you want to serialize this class without nesting, use this helper
50 
51  class Editor :
52  public yarp::os::Wire,
54  {
55  public:
56  // Editor: default constructor
57  Editor();
58 
59  // Editor: constructor with base class
61 
62  // Editor: destructor
63  ~Editor() override;
64 
65  // Editor: Deleted constructors and operator=
66  Editor(const Editor& rhs) = delete;
67  Editor(Editor&& rhs) = delete;
68  Editor& operator=(const Editor& rhs) = delete;
69  Editor& operator=(Editor&& rhs) = delete;
70 
71  // Editor: edit
72  bool edit(SensorMeasurement& obj, bool dirty = true);
73 
74  // Editor: validity check
75  bool isValid() const;
76 
77  // Editor: state
79 
80  // Editor: start editing
81  void start_editing();
82 
83 #ifndef YARP_NO_DEPRECATED // Since YARP 3.2
84  YARP_DEPRECATED_MSG("Use start_editing() instead")
85  void begin()
86  {
87  start_editing();
88  }
89 #endif // YARP_NO_DEPRECATED
90 
91  // Editor: stop editing
92  void stop_editing();
93 
94 #ifndef YARP_NO_DEPRECATED // Since YARP 3.2
95  YARP_DEPRECATED_MSG("Use stop_editing() instead")
96  void end()
97  {
98  stop_editing();
99  }
100 #endif // YARP_NO_DEPRECATED
101 
102  // Editor: measurement field
104  const yarp::sig::Vector& get_measurement() const;
105  virtual bool will_set_measurement();
106  virtual bool did_set_measurement();
107 
108  // Editor: timestamp field
109  void set_timestamp(const double timestamp);
110  double get_timestamp() const;
111  virtual bool will_set_timestamp();
112  virtual bool did_set_timestamp();
113 
114  // Editor: clean
115  void clean();
116 
117  // Editor: read
118  bool read(yarp::os::ConnectionReader& connection) override;
119 
120  // Editor: write
121  bool write(yarp::os::ConnectionWriter& connection) const override;
122 
123  private:
124  // Editor: state
125  SensorMeasurement* obj;
126  bool obj_owned;
127  int group;
128 
129  // Editor: dirty variables
130  bool is_dirty;
131  bool is_dirty_measurement;
132  bool is_dirty_timestamp;
133  int dirty_count;
134 
135  // Editor: send if possible
136  void communicate();
137 
138  // Editor: mark dirty overall
139  void mark_dirty();
140 
141  // Editor: mark dirty single fields
142  void mark_dirty_measurement();
143  void mark_dirty_timestamp();
144 
145  // Editor: dirty_flags
146  void dirty_flags(bool flag);
147  };
148 
149 private:
150  // read/write measurement field
151  bool read_measurement(yarp::os::idl::WireReader& reader);
152  bool write_measurement(const yarp::os::idl::WireWriter& writer) const;
153  bool nested_read_measurement(yarp::os::idl::WireReader& reader);
154  bool nested_write_measurement(const yarp::os::idl::WireWriter& writer) const;
155 
156  // read/write timestamp field
157  bool read_timestamp(yarp::os::idl::WireReader& reader);
158  bool write_timestamp(const yarp::os::idl::WireWriter& writer) const;
159  bool nested_read_timestamp(yarp::os::idl::WireReader& reader);
160  bool nested_write_timestamp(const yarp::os::idl::WireWriter& writer) const;
161 };
162 
163 #endif // YARP_THRIFT_GENERATOR_STRUCT_SENSORMEASUREMENT_H
contains the definition of a Vector type
void set_timestamp(const double timestamp)
const yarp::sig::Vector & get_measurement() const
SensorMeasurement & state()
bool read(yarp::os::ConnectionReader &connection) override
Read this object from a network connection.
void set_measurement(const yarp::sig::Vector &measurement)
bool write(yarp::os::ConnectionWriter &connection) const override
Write this object to a network connection.
Editor(const Editor &rhs)=delete
Editor & operator=(const Editor &rhs)=delete
Editor & operator=(Editor &&rhs)=delete
bool edit(SensorMeasurement &obj, bool dirty=true)
Editor(Editor &&rhs)=delete
bool read(yarp::os::idl::WireReader &reader) override
bool write(const yarp::os::idl::WireWriter &writer) const override
yarp::sig::Vector measurement
yarp::os::idl::Unwrapped< SensorMeasurement > unwrapped
std::string toString() const
An interface for reading from a network connection.
An interface for writing to a network connection.
Interface implemented by all objects that can write themselves to the network, such as Bottle objects...
Definition: PortWriter.h:24
Base class for IDL client/server.
Definition: Wire.h:19
A "tamed" Portable, that promises to serialize itself in an IDL-friendly way.
Definition: WirePortable.h:23
IDL-friendly connection reader.
Definition: WireReader.h:30
IDL-friendly connection writer.
Definition: WireWriter.h:30
#define YARP_DEPRECATED_MSG(MSG)
Expands to either the standard [[deprecated]] attribute or a compiler-specific decorator such as __at...
Definition: compiler.h:2885