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
eip::serialization::Writer
Definition: writer.h:41
eip::Path::path_buf_
vector< EIP_USINT > path_buf_
Definition: path.h:171
eip_types.h
eip::serialization::Reader
Definition: reader.h:42
eip
Definition: connection.h:41
eip::Path::addLogicalConnectionPoint
void addLogicalConnectionPoint(EIP_USINT connection_id)
Definition: path.cpp:74
eip::Path::addLogicalClass
void addLogicalClass(EIP_USINT class_id)
Definition: path.cpp:59
EIP_USINT
uint8_t EIP_USINT
Definition: eip_types.h:36
eip::Path::deserialize
virtual Reader & deserialize(Reader &reader, size_t length)
Definition: path.h:156
eip::Path::pad_after_length_
bool pad_after_length_
Definition: path.h:170
eip::Path::addLogicalInstance
void addLogicalInstance(EIP_USINT instance_id)
Definition: path.cpp:64
reader.h
eip::Path::Path
Path(bool pad_after_length=false)
Definition: path.cpp:32
eip::Path::addSegment
void addSegment(EIP_USINT type, EIP_USINT data)
Definition: path.cpp:53
eip::Path::setPadAfterLength
void setPadAfterLength(bool pad)
Definition: path.h:88
eip::Path::getLength
virtual size_t getLength() const
Definition: path.cpp:79
eip::Path::serialize
virtual Writer & serialize(Writer &writer) const
Definition: path.h:137
eip::Path::deserialize
virtual Reader & deserialize(Reader &reader)
Definition: path.h:164
eip::Path::addLogicalAttribute
void addLogicalAttribute(EIP_USINT attribute_id)
Definition: path.cpp:69
eip::Path::reset
void reset()
Definition: path.h:120
serializable.h
writer.h
eip::Path
Definition: path.h:50


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