cpf_item.h
Go to the documentation of this file.
1 
26 #ifndef ODVA_ETHERNETIP_CPF_ITEM_H
27 #define ODVA_ETHERNETIP_CPF_ITEM_H
28 
29 #include <boost/shared_ptr.hpp>
30 
35 
36 using boost::shared_ptr;
37 
38 namespace eip {
39 
40 using serialization::Serializable;
41 using serialization::Reader;
42 using serialization::Writer;
43 
48 class CPFItem : public Serializable
49 {
50 public:
51 
57 
63  CPFItem(EIP_UINT item_type, shared_ptr<Serializable> item_data)
64  : item_type_(item_type), item_data_(item_data) { }
65 
71  {
72  return item_type_;
73  }
74 
79  void setItemType(EIP_UINT item_type)
80  {
81  item_type_ = item_type;
82  }
83 
87  shared_ptr<Serializable> getData()
88  {
89  return item_data_;
90  }
91 
96  void setData(shared_ptr<Serializable> data)
97  {
98  item_data_ = data;
99  }
100 
105  void getDataAs(Serializable& result);
106 
111  virtual EIP_UINT getDataLength() const
112  {
113  return item_data_ ? item_data_->getLength() : 0;
114  }
115 
121  virtual size_t getLength() const
122  {
123  return 4 + getDataLength();
124  }
125 
132  virtual Writer& serialize(Writer& writer) const;
133 
141  virtual Reader& deserialize(Reader& reader, size_t length);
142 
149  virtual Reader& deserialize(Reader& reader);
150 private:
152  shared_ptr<Serializable> item_data_;
153 
159  void deserializeData(Reader& reader, EIP_UINT item_length);
160 };
161 
162 } // namespace eip
163 
164 #endif // ODVA_ETHERNETIP_CPF_ITEM_H
CPFItem(EIP_UINT item_type, shared_ptr< Serializable > item_data)
Definition: cpf_item.h:63
EIP_UINT item_type_
Definition: cpf_item.h:151
void setData(shared_ptr< Serializable > data)
Definition: cpf_item.h:96
virtual size_t getLength() const
Definition: cpf_item.h:121
EIP_UINT getItemType()
Definition: cpf_item.h:70
shared_ptr< Serializable > getData()
Definition: cpf_item.h:87
virtual EIP_UINT getDataLength() const
Definition: cpf_item.h:111
virtual Writer & serialize(Writer &writer) const
Definition: cpf_item.cpp:37
Definition: connection.h:41
virtual Reader & deserialize(Reader &reader, size_t length)
Definition: cpf_item.cpp:47
uint16_t EIP_UINT
Definition: eip_types.h:39
void getDataAs(Serializable &result)
Definition: cpf_item.cpp:86
void deserializeData(Reader &reader, EIP_UINT item_length)
Definition: cpf_item.cpp:73
void setItemType(EIP_UINT item_type)
Definition: cpf_item.h:79
shared_ptr< Serializable > item_data_
Definition: cpf_item.h:152


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