rr_data.h
Go to the documentation of this file.
1 
26 #ifndef ODVA_ETHERNETIP_RR_DATA_H
27 #define ODVA_ETHERNETIP_RR_DATA_H
28 
29 #include <string>
30 #include <boost/shared_ptr.hpp>
31 #include <boost/asio.hpp>
32 
38 
39 using boost::shared_ptr;
40 
41 namespace eip {
42 
43 using serialization::Serializable;
44 using serialization::Reader;
45 using serialization::Writer;
46 
51 class RRData : public Serializable
52 {
53 public:
54 
57 
62 
67  virtual size_t getLength() const
68  {
69  size_t result = sizeof(interface_handle) + sizeof(timeout) + 5 * sizeof(EIP_UINT);
70  if (getData())
71  {
72  result += getData()->getLength();
73  }
74  return result;
75  }
76 
83  virtual Writer& serialize(Writer& writer) const;
84 
88  virtual Reader& deserialize(Reader& reader, size_t length)
89  {
90  deserialize(reader);
91  return reader;
92  }
93 
100  virtual Reader& deserialize(Reader& reader);
101 
102 protected:
107  virtual shared_ptr<Serializable> getData() const
108  {
109  return shared_ptr<Serializable>();
110  }
111 
116  virtual void setData(CPFItem& item) { }
117 };
118 
119 } // namespace eip
120 
121 #endif // ODVA_ETHERNETIP_RR_DATA_H
eip::serialization::Writer
Definition: writer.h:41
eip_types.h
eip::serialization::Reader
Definition: reader.h:42
eip
Definition: connection.h:41
eip::RRData::getLength
virtual size_t getLength() const
Definition: rr_data.h:67
eip::RRData::interface_handle
EIP_UDINT interface_handle
Definition: rr_data.h:55
eip::RRData::RRData
RRData()
Definition: rr_data.h:61
EIP_UINT
uint16_t EIP_UINT
Definition: eip_types.h:39
eip::RRData::deserialize
virtual Reader & deserialize(Reader &reader, size_t length)
Definition: rr_data.h:88
eip::serialization::Serializable
Definition: serializable.h:38
eip::RRData::serialize
virtual Writer & serialize(Writer &writer) const
Definition: rr_data.cpp:39
cpf_item.h
reader.h
eip::RRData::setData
virtual void setData(CPFItem &item)
Definition: rr_data.h:116
eip::RRData::getData
virtual shared_ptr< Serializable > getData() const
Definition: rr_data.h:107
eip::RRData::timeout
EIP_UINT timeout
Definition: rr_data.h:56
eip::CPFItem
Definition: cpf_item.h:48
eip::RRData
Definition: rr_data.h:51
EIP_UDINT
uint32_t EIP_UDINT
Definition: eip_types.h:42
serializable.h
writer.h


odva_ethernetip
Author(s): Kareem Shehata
autogenerated on Wed Mar 2 2022 00:38:56