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 
61  RRData() : interface_handle(0), timeout(0) { }
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
virtual Reader & deserialize(Reader &reader, size_t length)
Definition: rr_data.h:88
virtual void setData(CPFItem &item)
Definition: rr_data.h:116
virtual Writer & serialize(Writer &writer) const
Definition: rr_data.cpp:38
EIP_UINT timeout
Definition: rr_data.h:56
virtual shared_ptr< Serializable > getData() const
Definition: rr_data.h:107
EIP_UDINT interface_handle
Definition: rr_data.h:55
Definition: connection.h:41
uint16_t EIP_UINT
Definition: eip_types.h:39
uint32_t EIP_UDINT
Definition: eip_types.h:42
virtual size_t getLength() const
Definition: rr_data.h:67


odva_ethernetip
Author(s): Kareem Shehata
autogenerated on Mon Jun 10 2019 14:00:16