YARP
Yet Another Robot Platform
SensorMeasurement.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_SENSORMEASUREMENT_H
15 #define YARP_THRIFT_GENERATOR_STRUCT_SENSORMEASUREMENT_H
16 
17 #include <yarp/os/Wire.h>
18 #include <yarp/os/idl/WireTypes.h>
19 #include <yarp/sig/Vector.h>
20 
23 {
24 public:
25  // Fields
27  double timestamp;
28 
29  // Default constructor
31 
32  // Constructor with field values
34  const double timestamp);
35 
36  // Read structure on a Wire
37  bool read(yarp::os::idl::WireReader& reader) override;
38 
39  // Read structure on a Connection
40  bool read(yarp::os::ConnectionReader& connection) override;
41 
42  // Write structure on a Wire
43  bool write(const yarp::os::idl::WireWriter& writer) const override;
44 
45  // Write structure on a Connection
46  bool write(yarp::os::ConnectionWriter& connection) const override;
47 
48  // Convert to a printable string
49  std::string toString() const;
50 
51  // If you want to serialize this class without nesting, use this helper
53 
54  class Editor :
55  public yarp::os::Wire,
57  {
58  public:
59  // Editor: default constructor
60  Editor();
61 
62  // Editor: constructor with base class
64 
65  // Editor: destructor
66  ~Editor() override;
67 
68  // Editor: Deleted constructors and operator=
69  Editor(const Editor& rhs) = delete;
70  Editor(Editor&& rhs) = delete;
71  Editor& operator=(const Editor& rhs) = delete;
72  Editor& operator=(Editor&& rhs) = delete;
73 
74  // Editor: edit
75  bool edit(SensorMeasurement& obj, bool dirty = true);
76 
77  // Editor: validity check
78  bool isValid() const;
79 
80  // Editor: state
82 
83  // Editor: start editing
84  void start_editing();
85 
86 #ifndef YARP_NO_DEPRECATED // Since YARP 3.2
87  YARP_DEPRECATED_MSG("Use start_editing() instead")
88  void begin()
89  {
90  start_editing();
91  }
92 #endif // YARP_NO_DEPRECATED
93 
94  // Editor: stop editing
95  void stop_editing();
96 
97 #ifndef YARP_NO_DEPRECATED // Since YARP 3.2
98  YARP_DEPRECATED_MSG("Use stop_editing() instead")
99  void end()
100  {
101  stop_editing();
102  }
103 #endif // YARP_NO_DEPRECATED
104 
105  // Editor: measurement field
107  const yarp::sig::Vector& get_measurement() const;
108  virtual bool will_set_measurement();
109  virtual bool did_set_measurement();
110 
111  // Editor: timestamp field
112  void set_timestamp(const double timestamp);
113  double get_timestamp() const;
114  virtual bool will_set_timestamp();
115  virtual bool did_set_timestamp();
116 
117  // Editor: clean
118  void clean();
119 
120  // Editor: read
121  bool read(yarp::os::ConnectionReader& connection) override;
122 
123  // Editor: write
124  bool write(yarp::os::ConnectionWriter& connection) const override;
125 
126  private:
127  // Editor: state
128  SensorMeasurement* obj;
129  bool obj_owned;
130  int group;
131 
132  // Editor: dirty variables
133  bool is_dirty;
134  bool is_dirty_measurement;
135  bool is_dirty_timestamp;
136  int dirty_count;
137 
138  // Editor: send if possible
139  void communicate();
140 
141  // Editor: mark dirty overall
142  void mark_dirty();
143 
144  // Editor: mark dirty single fields
145  void mark_dirty_measurement();
146  void mark_dirty_timestamp();
147 
148  // Editor: dirty_flags
149  void dirty_flags(bool flag);
150  };
151 
152 private:
153  // read/write measurement field
154  bool read_measurement(yarp::os::idl::WireReader& reader);
155  bool write_measurement(const yarp::os::idl::WireWriter& writer) const;
156  bool nested_read_measurement(yarp::os::idl::WireReader& reader);
157  bool nested_write_measurement(const yarp::os::idl::WireWriter& writer) const;
158 
159  // read/write timestamp field
160  bool read_timestamp(yarp::os::idl::WireReader& reader);
161  bool write_timestamp(const yarp::os::idl::WireWriter& writer) const;
162  bool nested_read_timestamp(yarp::os::idl::WireReader& reader);
163  bool nested_write_timestamp(const yarp::os::idl::WireWriter& writer) const;
164 };
165 
166 #endif // YARP_THRIFT_GENERATOR_STRUCT_SENSORMEASUREMENT_H
SensorMeasurement::Editor::write
bool write(yarp::os::ConnectionWriter &connection) const override
Write this object to a network connection.
Definition: SensorMeasurement.cpp:331
SensorMeasurement::write
bool write(const yarp::os::idl::WireWriter &writer) const override
Definition: SensorMeasurement.cpp:56
Vector.h
contains the definition of a Vector type
WireTypes.h
SensorMeasurement::SensorMeasurement
SensorMeasurement()
Definition: SensorMeasurement.cpp:17
SensorMeasurement::measurement
yarp::sig::Vector measurement
Definition: SensorMeasurement.h:26
SensorMeasurement::Editor::edit
bool edit(SensorMeasurement &obj, bool dirty=true)
Definition: SensorMeasurement.cpp:113
SensorMeasurement::Editor::end
void end()
Definition: SensorMeasurement.h:99
SensorMeasurement::Editor::~Editor
~Editor() override
Definition: SensorMeasurement.cpp:105
Wire.h
SensorMeasurement::Editor::isValid
bool isValid() const
Definition: SensorMeasurement.cpp:125
SensorMeasurement::Editor::Editor
Editor(const Editor &rhs)=delete
SensorMeasurement::timestamp
double timestamp
Definition: SensorMeasurement.h:27
SensorMeasurement::Editor::clean
void clean()
Definition: SensorMeasurement.cpp:207
yarp::os::PortWriter
Interface implemented by all objects that can write themselves to the network, such as Bottle objects...
Definition: PortWriter.h:27
SensorMeasurement::Editor::get_timestamp
double get_timestamp() const
Definition: SensorMeasurement.cpp:189
SensorMeasurement::Editor::operator=
Editor & operator=(Editor &&rhs)=delete
SensorMeasurement::Editor::set_measurement
void set_measurement(const yarp::sig::Vector &measurement)
Definition: SensorMeasurement.cpp:151
SensorMeasurement::read
bool read(yarp::os::idl::WireReader &reader) override
Definition: SensorMeasurement.cpp:34
SensorMeasurement::Editor::stop_editing
void stop_editing()
Definition: SensorMeasurement.cpp:143
yarp::os::idl::WireWriter
IDL-friendly connection writer.
Definition: WireWriter.h:33
SensorMeasurement::unwrapped
yarp::os::idl::Unwrapped< SensorMeasurement > unwrapped
Definition: SensorMeasurement.h:52
SensorMeasurement::Editor::start_editing
void start_editing()
Definition: SensorMeasurement.cpp:137
yarp::sig::VectorOf< double >
SensorMeasurement::Editor::operator=
Editor & operator=(const Editor &rhs)=delete
SensorMeasurement
Definition: SensorMeasurement.h:23
yarp::os::ConnectionWriter
An interface for writing to a network connection.
Definition: ConnectionWriter.h:40
SensorMeasurement::Editor::begin
void begin()
Definition: SensorMeasurement.h:88
yarp::os::idl::Unwrapped
Definition: Unwrapped.h:22
SensorMeasurement::Editor::Editor
Editor(Editor &&rhs)=delete
SensorMeasurement::Editor::read
bool read(yarp::os::ConnectionReader &connection) override
Read this object from a network connection.
Definition: SensorMeasurement.cpp:213
SensorMeasurement::Editor
Definition: SensorMeasurement.h:57
SensorMeasurement::Editor::did_set_measurement
virtual bool did_set_measurement()
Definition: SensorMeasurement.cpp:173
yarp::os::idl::WirePortable
A "tamed" Portable, that promises to serialize itself in an IDL-friendly way.
Definition: WirePortable.h:26
yarp::os::Wire
Base class for IDL client/server.
Definition: Wire.h:22
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_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
SensorMeasurement::Editor::will_set_measurement
virtual bool will_set_measurement()
Definition: SensorMeasurement.cpp:167
SensorMeasurement::Editor::will_set_timestamp
virtual bool will_set_timestamp()
Definition: SensorMeasurement.cpp:195
SensorMeasurement::toString
std::string toString() const
Definition: SensorMeasurement.cpp:78
SensorMeasurement::Editor::Editor
Editor()
Definition: SensorMeasurement.cpp:86
SensorMeasurement::Editor::did_set_timestamp
virtual bool did_set_timestamp()
Definition: SensorMeasurement.cpp:201
SensorMeasurement::Editor::state
SensorMeasurement & state()
Definition: SensorMeasurement.cpp:131
SensorMeasurement::Editor::get_measurement
const yarp::sig::Vector & get_measurement() const
Definition: SensorMeasurement.cpp:161
SensorMeasurement::Editor::set_timestamp
void set_timestamp(const double timestamp)
Definition: SensorMeasurement.cpp:179