range_and_reflectance_measurement.h
Go to the documentation of this file.
1 
26 #ifndef OMRON_OS32C_DRIVER_RANGE_AND_REFLECTANCE_MEASUREMENT_H
27 #define OMRON_OS32C_DRIVER_RANGE_AND_REFLECTANCE_MEASUREMENT_H
28 
29 #include <string>
30 #include <vector>
31 
37 
38 using std::vector;
42 
43 namespace omron_os32c_driver {
44 
51 {
52 public:
54  vector<EIP_UINT> range_data;
55  vector<EIP_UINT> reflectance_data;
56 
60  virtual size_t getLength() const
61  {
62  return header.getLength() + range_data.size() * sizeof(EIP_UINT) + reflectance_data.size() * sizeof(EIP_UINT);
63  }
64 
71  virtual Writer& serialize(Writer& writer) const
72  {
73  header.serialize(writer);
74  writer.writeBytes(&range_data[0], range_data.size() * sizeof(EIP_UINT));
75  writer.writeBytes(&reflectance_data[0], reflectance_data.size() * sizeof(EIP_UINT));
76  return writer;
77  }
78 
82  virtual Reader& deserialize(Reader& reader, size_t length)
83  {
84  deserialize(reader);
85  return reader;
86  }
87 
94  virtual Reader& deserialize(Reader& reader)
95  {
96  header.deserialize(reader);
97  range_data.resize(header.num_beams);
99  reader.readBytes(&range_data[0], range_data.size() * sizeof(EIP_UINT));
100  reader.readBytes(&reflectance_data[0], reflectance_data.size() * sizeof(EIP_UINT));
101  return reader;
102  }
103 };
104 
105 } // namespace omron_os32c_driver
106 
107 #endif // OS32C_RANGE_AND_REFLECTANCE_MEASUREMENT_H
omron_os32c_driver::RangeAndReflectanceMeasurement
Definition: range_and_reflectance_measurement.h:50
omron_os32c_driver::MeasurementReportHeader::getLength
virtual size_t getLength() const
Definition: measurement_report_header.h:71
eip::serialization::Writer
omron_os32c_driver::MeasurementReportHeader::num_beams
EIP_UINT num_beams
Definition: measurement_report_header.h:66
eip::serialization::Reader
omron_os32c_driver::RangeAndReflectanceMeasurement::deserialize
virtual Reader & deserialize(Reader &reader, size_t length)
Definition: range_and_reflectance_measurement.h:82
EIP_UINT
uint16_t EIP_UINT
measurement_report_header.h
reader.h
eip_types.h
eip::serialization::Writer::writeBytes
virtual void writeBytes(const void *p, size_t n)=0
eip::serialization::Serializable
eip::serialization::Reader::readBytes
virtual void readBytes(void *buf, size_t n)=0
omron_os32c_driver::RangeAndReflectanceMeasurement::serialize
virtual Writer & serialize(Writer &writer) const
Definition: range_and_reflectance_measurement.h:71
omron_os32c_driver::RangeAndReflectanceMeasurement::reflectance_data
vector< EIP_UINT > reflectance_data
Definition: range_and_reflectance_measurement.h:55
omron_os32c_driver
Definition: measurement_report.h:43
omron_os32c_driver::RangeAndReflectanceMeasurement::getLength
virtual size_t getLength() const
Definition: range_and_reflectance_measurement.h:60
omron_os32c_driver::MeasurementReportHeader
Definition: measurement_report_header.h:47
omron_os32c_driver::RangeAndReflectanceMeasurement::range_data
vector< EIP_UINT > range_data
Definition: range_and_reflectance_measurement.h:54
omron_os32c_driver::RangeAndReflectanceMeasurement::deserialize
virtual Reader & deserialize(Reader &reader)
Definition: range_and_reflectance_measurement.h:94
omron_os32c_driver::MeasurementReportHeader::serialize
virtual Writer & serialize(Writer &writer) const
Definition: measurement_report_header.h:82
serializable.h
omron_os32c_driver::MeasurementReportHeader::deserialize
virtual Reader & deserialize(Reader &reader, size_t length)
Definition: measurement_report_header.h:115
omron_os32c_driver::RangeAndReflectanceMeasurement::header
MeasurementReportHeader header
Definition: range_and_reflectance_measurement.h:53
writer.h


omron_os32c_driver
Author(s): Kareem Shehata
autogenerated on Wed Mar 2 2022 00:39:14