YARP
Yet Another Robot Platform
SensorMeasurements.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_SENSORMEASUREMENTS_H
15 #define YARP_THRIFT_GENERATOR_STRUCT_SENSORMEASUREMENTS_H
16 
17 #include <yarp/os/Wire.h>
18 #include <yarp/os/idl/WireTypes.h>
19 #include <SensorMeasurement.h>
20 
23 {
24 public:
25  // Fields
26  std::vector<SensorMeasurement> measurements;
27 
28  // Default constructor
30 
31  // Constructor with field values
32  SensorMeasurements(const std::vector<SensorMeasurement>& measurements);
33 
34  // Read structure on a Wire
35  bool read(yarp::os::idl::WireReader& reader) override;
36 
37  // Read structure on a Connection
38  bool read(yarp::os::ConnectionReader& connection) override;
39 
40  // Write structure on a Wire
41  bool write(const yarp::os::idl::WireWriter& writer) const override;
42 
43  // Write structure on a Connection
44  bool write(yarp::os::ConnectionWriter& connection) const override;
45 
46  // Convert to a printable string
47  std::string toString() const;
48 
49  // If you want to serialize this class without nesting, use this helper
51 
52  class Editor :
53  public yarp::os::Wire,
55  {
56  public:
57  // Editor: default constructor
58  Editor();
59 
60  // Editor: constructor with base class
62 
63  // Editor: destructor
64  ~Editor() override;
65 
66  // Editor: Deleted constructors and operator=
67  Editor(const Editor& rhs) = delete;
68  Editor(Editor&& rhs) = delete;
69  Editor& operator=(const Editor& rhs) = delete;
70  Editor& operator=(Editor&& rhs) = delete;
71 
72  // Editor: edit
73  bool edit(SensorMeasurements& obj, bool dirty = true);
74 
75  // Editor: validity check
76  bool isValid() const;
77 
78  // Editor: state
80 
81  // Editor: start editing
82  void start_editing();
83 
84 #ifndef YARP_NO_DEPRECATED // Since YARP 3.2
85  YARP_DEPRECATED_MSG("Use start_editing() instead")
86  void begin()
87  {
88  start_editing();
89  }
90 #endif // YARP_NO_DEPRECATED
91 
92  // Editor: stop editing
93  void stop_editing();
94 
95 #ifndef YARP_NO_DEPRECATED // Since YARP 3.2
96  YARP_DEPRECATED_MSG("Use stop_editing() instead")
97  void end()
98  {
99  stop_editing();
100  }
101 #endif // YARP_NO_DEPRECATED
102 
103  // Editor: measurements field
104  void set_measurements(const std::vector<SensorMeasurement>& measurements);
105  void set_measurements(size_t index, const SensorMeasurement& elem);
106  const std::vector<SensorMeasurement>& get_measurements() const;
107  virtual bool will_set_measurements();
108  virtual bool did_set_measurements();
109 
110  // Editor: clean
111  void clean();
112 
113  // Editor: read
114  bool read(yarp::os::ConnectionReader& connection) override;
115 
116  // Editor: write
117  bool write(yarp::os::ConnectionWriter& connection) const override;
118 
119  private:
120  // Editor: state
121  SensorMeasurements* obj;
122  bool obj_owned;
123  int group;
124 
125  // Editor: dirty variables
126  bool is_dirty;
127  bool is_dirty_measurements;
128  int dirty_count;
129 
130  // Editor: send if possible
131  void communicate();
132 
133  // Editor: mark dirty overall
134  void mark_dirty();
135 
136  // Editor: mark dirty single fields
137  void mark_dirty_measurements();
138 
139  // Editor: dirty_flags
140  void dirty_flags(bool flag);
141  };
142 
143 private:
144  // read/write measurements field
145  bool read_measurements(yarp::os::idl::WireReader& reader);
146  bool write_measurements(const yarp::os::idl::WireWriter& writer) const;
147  bool nested_read_measurements(yarp::os::idl::WireReader& reader);
148  bool nested_write_measurements(const yarp::os::idl::WireWriter& writer) const;
149 };
150 
151 #endif // YARP_THRIFT_GENERATOR_STRUCT_SENSORMEASUREMENTS_H
SensorMeasurements::measurements
std::vector< SensorMeasurement > measurements
Definition: SensorMeasurements.h:26
WireTypes.h
SensorMeasurements::Editor::clean
void clean()
Definition: SensorMeasurements.cpp:180
Wire.h
SensorMeasurements::Editor::start_editing
void start_editing()
Definition: SensorMeasurements.cpp:128
yarp::os::PortWriter
Interface implemented by all objects that can write themselves to the network, such as Bottle objects...
Definition: PortWriter.h:27
SensorMeasurements::Editor::set_measurements
void set_measurements(const std::vector< SensorMeasurement > &measurements)
Definition: SensorMeasurements.cpp:142
yarp::os::idl::WireWriter
IDL-friendly connection writer.
Definition: WireWriter.h:33
SensorMeasurements::unwrapped
yarp::os::idl::Unwrapped< SensorMeasurements > unwrapped
Definition: SensorMeasurements.h:50
SensorMeasurements::toString
std::string toString() const
Definition: SensorMeasurements.cpp:69
SensorMeasurements
Definition: SensorMeasurements.h:23
SensorMeasurement
Definition: SensorMeasurement.h:23
yarp::os::ConnectionWriter
An interface for writing to a network connection.
Definition: ConnectionWriter.h:40
yarp::os::idl::Unwrapped
Definition: Unwrapped.h:22
SensorMeasurements::Editor::~Editor
~Editor() override
Definition: SensorMeasurements.cpp:96
SensorMeasurements::Editor::edit
bool edit(SensorMeasurements &obj, bool dirty=true)
Definition: SensorMeasurements.cpp:104
yarp::os::idl::WirePortable
A "tamed" Portable, that promises to serialize itself in an IDL-friendly way.
Definition: WirePortable.h:26
SensorMeasurements::Editor::read
bool read(yarp::os::ConnectionReader &connection) override
Read this object from a network connection.
Definition: SensorMeasurements.cpp:186
yarp::os::Wire
Base class for IDL client/server.
Definition: Wire.h:22
SensorMeasurements::read
bool read(yarp::os::idl::WireReader &reader) override
Definition: SensorMeasurements.cpp:31
SensorMeasurements::Editor::write
bool write(yarp::os::ConnectionWriter &connection) const override
Write this object to a network connection.
Definition: SensorMeasurements.cpp:289
SensorMeasurements::Editor::get_measurements
const std::vector< SensorMeasurement > & get_measurements() const
Definition: SensorMeasurements.cpp:162
SensorMeasurements::Editor::stop_editing
void stop_editing()
Definition: SensorMeasurements.cpp:134
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
SensorMeasurements::Editor::end
void end()
Definition: SensorMeasurements.h:97
SensorMeasurements::write
bool write(const yarp::os::idl::WireWriter &writer) const override
Definition: SensorMeasurements.cpp:50
SensorMeasurements::Editor::will_set_measurements
virtual bool will_set_measurements()
Definition: SensorMeasurements.cpp:168
SensorMeasurements::Editor::operator=
Editor & operator=(const Editor &rhs)=delete
SensorMeasurements::Editor::Editor
Editor(const Editor &rhs)=delete
SensorMeasurements::Editor::isValid
bool isValid() const
Definition: SensorMeasurements.cpp:116
SensorMeasurements::Editor::state
SensorMeasurements & state()
Definition: SensorMeasurements.cpp:122
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
SensorMeasurements::Editor::Editor
Editor(Editor &&rhs)=delete
SensorMeasurements::Editor::Editor
Editor()
Definition: SensorMeasurements.cpp:77
SensorMeasurements::SensorMeasurements
SensorMeasurements()
Definition: SensorMeasurements.cpp:17
SensorMeasurements::Editor::did_set_measurements
virtual bool did_set_measurements()
Definition: SensorMeasurements.cpp:174
SensorMeasurements::Editor::operator=
Editor & operator=(Editor &&rhs)=delete
SensorMeasurements::Editor::begin
void begin()
Definition: SensorMeasurements.h:86
SensorMeasurement.h
SensorMeasurements::Editor
Definition: SensorMeasurements.h:55