measurement_report.h
Go to the documentation of this file.
00001 
00026 #ifndef OMRON_OS32C_DRIVER_MEASUREMENT_REPORT_H
00027 #define OMRON_OS32C_DRIVER_MEASUREMENT_REPORT_H
00028 
00029 #include <string>
00030 #include <vector>
00031 
00032 #include "odva_ethernetip/eip_types.h"
00033 #include "odva_ethernetip/serialization/reader.h"
00034 #include "odva_ethernetip/serialization/writer.h"
00035 #include "odva_ethernetip/serialization/serializable.h"
00036 #include "omron_os32c_driver/measurement_report_header.h"
00037 
00038 using std::vector;
00039 using eip::serialization::Serializable;
00040 using eip::serialization::Reader;
00041 using eip::serialization::Writer;
00042 
00043 namespace omron_os32c_driver {
00044 
00050 class MeasurementReport : public Serializable
00051 {
00052 public:
00053   MeasurementReportHeader header;
00054   vector<EIP_UINT> measurement_data;
00055 
00059   virtual size_t getLength() const
00060   {
00061     return header.getLength() + measurement_data.size() * sizeof(EIP_UINT);
00062   }
00063 
00070   virtual Writer& serialize(Writer& writer) const
00071   {
00072     header.serialize(writer);
00073     writer.writeBytes(&measurement_data[0], measurement_data.size() * sizeof(EIP_UINT));
00074     return writer;
00075   }
00076 
00080   virtual Reader& deserialize(Reader& reader, size_t length)
00081   {
00082     deserialize(reader);
00083     return reader;
00084   }
00085 
00092   virtual Reader& deserialize(Reader& reader)
00093   {
00094     header.deserialize(reader);
00095     measurement_data.resize(header.num_beams);
00096     reader.readBytes(&measurement_data[0], measurement_data.size() * sizeof(EIP_UINT));
00097     return reader;
00098   }
00099 };
00100 
00101 } // namespace omron_os32c_driver
00102 
00103 #endif  // OMRON_OS32C_DRIVER_MEASUREMENT_REPORT_H


omron_os32c_driver
Author(s): Kareem Shehata
autogenerated on Thu Jun 6 2019 19:00:54