path.h
Go to the documentation of this file.
1 
26 #ifndef ODVA_ETHERNETIP_PATH_H
27 #define ODVA_ETHERNETIP_PATH_H
28 
29 #include <vector>
30 
35 
36 using std::vector;
37 using std::size_t;
38 
39 namespace eip {
40 
41 using serialization::Serializable;
42 using serialization::Reader;
43 using serialization::Writer;
44 
50 class Path
51 {
52 public:
53 
59  Path(bool pad_after_length = false);
60 
70  Path(EIP_USINT class_id, EIP_USINT instance_id, EIP_USINT attribute_id,
71  bool pad_after_length = false);
72 
80  Path(EIP_USINT class_id, EIP_USINT instance_id);
81 
88  void setPadAfterLength(bool pad)
89  {
90  pad_after_length_ = pad;
91  }
92 
97  void addLogicalClass(EIP_USINT class_id);
98 
103  void addLogicalInstance(EIP_USINT instance_id);
104 
109  void addLogicalAttribute(EIP_USINT attribute_id);
110 
115  void addLogicalConnectionPoint(EIP_USINT connection_id);
116 
120  void reset()
121  {
122  path_buf_.clear();
123  }
124 
129  virtual size_t getLength() const;
130 
137  virtual Writer& serialize(Writer& writer) const
138  {
139  serialize(writer, pad_after_length_);
140  return writer;
141  }
142 
151  virtual Writer& serialize(Writer& writer, bool pad_after_length) const;
152 
156  virtual Reader& deserialize(Reader& reader, size_t length)
157  {
158  throw std::logic_error("Not implemented");
159  }
160 
164  virtual Reader& deserialize(Reader& reader)
165  {
166  throw std::logic_error("Not implemented");
167  }
168 
169 private:
171  vector<EIP_USINT> path_buf_;
172 
178  void addSegment(EIP_USINT type, EIP_USINT data);
179 };
180 
181 } // namespace eip
182 
183 #endif // ODVA_ETHERNETIP_PATH_H
uint8_t EIP_USINT
Definition: eip_types.h:36
void addLogicalClass(EIP_USINT class_id)
Definition: path.cpp:59
virtual Reader & deserialize(Reader &reader, size_t length)
Definition: path.h:156
void addLogicalConnectionPoint(EIP_USINT connection_id)
Definition: path.cpp:74
virtual Writer & serialize(Writer &writer) const
Definition: path.h:137
bool pad_after_length_
Definition: path.h:170
Definition: path.h:50
Definition: connection.h:41
Path(bool pad_after_length=false)
Definition: path.cpp:32
void addLogicalInstance(EIP_USINT instance_id)
Definition: path.cpp:64
void addSegment(EIP_USINT type, EIP_USINT data)
Definition: path.cpp:53
virtual size_t getLength() const
Definition: path.cpp:79
void addLogicalAttribute(EIP_USINT attribute_id)
Definition: path.cpp:69
void reset()
Definition: path.h:120
void setPadAfterLength(bool pad)
Definition: path.h:88
virtual Reader & deserialize(Reader &reader)
Definition: path.h:164
vector< EIP_USINT > path_buf_
Definition: path.h:171


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