path.h
Go to the documentation of this file.
00001 
00026 #ifndef ODVA_ETHERNETIP_PATH_H
00027 #define ODVA_ETHERNETIP_PATH_H
00028 
00029 #include <vector>
00030 
00031 #include "odva_ethernetip/eip_types.h"
00032 #include "odva_ethernetip/serialization/reader.h"
00033 #include "odva_ethernetip/serialization/writer.h"
00034 #include "odva_ethernetip/serialization/serializable.h"
00035 
00036 using std::vector;
00037 using std::size_t;
00038 
00039 namespace eip {
00040 
00041 using serialization::Serializable;
00042 using serialization::Reader;
00043 using serialization::Writer;
00044 
00050 class Path
00051 {
00052 public:
00053 
00059   Path(bool pad_after_length = false);
00060 
00070   Path(EIP_USINT class_id, EIP_USINT instance_id, EIP_USINT attribute_id,
00071     bool pad_after_length = false);
00072 
00080   Path(EIP_USINT class_id, EIP_USINT instance_id);
00081 
00088   void setPadAfterLength(bool pad)
00089   {
00090     pad_after_length_ = pad;
00091   }
00092 
00097   void addLogicalClass(EIP_USINT class_id);
00098 
00103   void addLogicalInstance(EIP_USINT instance_id);
00104 
00109   void addLogicalAttribute(EIP_USINT attribute_id);
00110 
00115   void addLogicalConnectionPoint(EIP_USINT connection_id);
00116 
00120   void reset()
00121   {
00122     path_buf_.clear();
00123   }
00124 
00129   virtual size_t getLength() const;
00130 
00137   virtual Writer& serialize(Writer& writer) const
00138   {
00139     serialize(writer, pad_after_length_);
00140     return writer;
00141   }
00142 
00151   virtual Writer& serialize(Writer& writer, bool pad_after_length) const;
00152 
00156   virtual Reader& deserialize(Reader& reader, size_t length)
00157   {
00158     throw std::logic_error("Not implemented");
00159   }
00160 
00164   virtual Reader& deserialize(Reader& reader)
00165   {
00166     throw std::logic_error("Not implemented");
00167   }
00168 
00169 private:
00170   bool pad_after_length_;
00171   vector<EIP_USINT> path_buf_;
00172 
00178   void addSegment(EIP_USINT type, EIP_USINT data);
00179 };
00180 
00181 } // namespace eip
00182 
00183 #endif  // ODVA_ETHERNETIP_PATH_H


odva_ethernetip
Author(s): Kareem Shehata
autogenerated on Sat Jun 8 2019 20:21:23