00001 00026 #ifndef ODVA_ETHERNETIP_CPF_PACKET_H 00027 #define ODVA_ETHERNETIP_CPF_PACKET_H 00028 00029 #include <vector> 00030 #include <iostream> 00031 00032 #include "odva_ethernetip/eip_types.h" 00033 #include "odva_ethernetip/cpf_item.h" 00034 #include "odva_ethernetip/serialization/reader.h" 00035 #include "odva_ethernetip/serialization/writer.h" 00036 #include "odva_ethernetip/serialization/serializable.h" 00037 00038 using std::vector; 00039 00040 namespace eip { 00041 00042 using serialization::Serializable; 00043 using serialization::Reader; 00044 using serialization::Writer; 00045 00049 class CPFPacket : public Serializable 00050 { 00051 public: 00052 00057 EIP_UINT getItemCount() const 00058 { 00059 return items_.size(); 00060 } 00061 00066 vector<CPFItem>& getItems() 00067 { 00068 return items_; 00069 } 00070 00075 virtual size_t getLength() const; 00076 00083 virtual Writer& serialize(Writer& writer) const; 00084 00089 virtual Reader& deserialize(Reader& reader, size_t length) 00090 { 00091 deserialize(reader); 00092 return reader; 00093 } 00094 00101 virtual Reader& deserialize(Reader& reader); 00102 00103 private: 00104 vector< CPFItem > items_; 00105 }; 00106 00107 } // namespace eip 00108 00109 #endif // ODVA_ETHERNETIP_CPF_PACKET_H