sequenced_address_item.h
Go to the documentation of this file.
1 
26 #ifndef ODVA_ETHERNETIP_SEQUENCED_ADDRESS_ITEM_H
27 #define ODVA_ETHERNETIP_SEQUENCED_ADDRESS_ITEM_H
28 
29 #include <string>
30 
35 
36 namespace eip {
37 
38 using std::string;
39 using serialization::Serializable;
40 using serialization::Reader;
41 using serialization::Writer;
42 
47 {
48 public:
51 
52  SequencedAddressItem(EIP_UDINT connection = 0, EIP_UDINT sequence = 0)
53  : connection_id(connection), sequence_num(sequence) { }
54 
59  virtual size_t getLength() const
60  {
61  return sizeof(connection_id) + sizeof(sequence_num);
62  }
63 
70  virtual Writer& serialize(Writer& writer) const
71  {
72  writer.write(connection_id);
73  writer.write(sequence_num);
74  return writer;
75  }
76 
80  virtual Reader& deserialize(Reader& reader, size_t length)
81  {
82  return deserialize(reader);
83  }
84 
91  virtual Reader& deserialize(Reader& reader)
92  {
93  reader.read(connection_id);
94  reader.read(sequence_num);
95  return reader;
96  }
97 };
98 
99 } // namespace eip
100 
101 #endif // ODVA_ETHERNETIP_SEQUENCED_ADDRESS_ITEM_H
eip::serialization::Writer
Definition: writer.h:41
eip_types.h
eip::serialization::Reader
Definition: reader.h:42
eip
Definition: connection.h:41
eip::SequencedAddressItem::getLength
virtual size_t getLength() const
Definition: sequenced_address_item.h:59
eip::SequencedAddressItem::deserialize
virtual Reader & deserialize(Reader &reader)
Definition: sequenced_address_item.h:91
eip::serialization::Writer::write
void write(const T &v)
Definition: writer.h:50
eip::SequencedAddressItem
Definition: sequenced_address_item.h:46
eip::serialization::Reader::read
void read(T &v)
Definition: reader.h:51
eip::serialization::Serializable
Definition: serializable.h:38
eip::SequencedAddressItem::sequence_num
EIP_UDINT sequence_num
Definition: sequenced_address_item.h:50
eip::SequencedAddressItem::deserialize
virtual Reader & deserialize(Reader &reader, size_t length)
Definition: sequenced_address_item.h:80
eip::SequencedAddressItem::connection_id
EIP_UDINT connection_id
Definition: sequenced_address_item.h:49
reader.h
eip::SequencedAddressItem::SequencedAddressItem
SequencedAddressItem(EIP_UDINT connection=0, EIP_UDINT sequence=0)
Definition: sequenced_address_item.h:52
EIP_UDINT
uint32_t EIP_UDINT
Definition: eip_types.h:42
serializable.h
eip::SequencedAddressItem::serialize
virtual Writer & serialize(Writer &writer) const
Definition: sequenced_address_item.h:70
writer.h


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