measurement_report.h
Go to the documentation of this file.
1 
26 #ifndef OMRON_OS32C_DRIVER_MEASUREMENT_REPORT_H
27 #define OMRON_OS32C_DRIVER_MEASUREMENT_REPORT_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> measurement_data;
55 
59  virtual size_t getLength() const
60  {
61  return header.getLength() + measurement_data.size() * sizeof(EIP_UINT);
62  }
63 
70  virtual Writer& serialize(Writer& writer) const
71  {
72  header.serialize(writer);
73  writer.writeBytes(&measurement_data[0], measurement_data.size() * sizeof(EIP_UINT));
74  return writer;
75  }
76 
80  virtual Reader& deserialize(Reader& reader, size_t length)
81  {
82  deserialize(reader);
83  return reader;
84  }
85 
92  virtual Reader& deserialize(Reader& reader)
93  {
94  header.deserialize(reader);
95  measurement_data.resize(header.num_beams);
96  reader.readBytes(&measurement_data[0], measurement_data.size() * sizeof(EIP_UINT));
97  return reader;
98  }
99 };
100 
101 } // namespace omron_os32c_driver
102 
103 #endif // OMRON_OS32C_DRIVER_MEASUREMENT_REPORT_H
virtual Reader & deserialize(Reader &reader, size_t length)
uint16_t EIP_UINT
virtual Writer & serialize(Writer &writer) const
virtual Writer & serialize(Writer &writer) const
virtual Reader & deserialize(Reader &reader)
virtual void writeBytes(const void *p, size_t n)=0
virtual void readBytes(void *buf, size_t n)=0
virtual Reader & deserialize(Reader &reader, size_t length)


omron_os32c_driver
Author(s): Kareem Shehata
autogenerated on Fri Nov 27 2020 03:06:12