rr_data_request.h
Go to the documentation of this file.
00001 
00026 #ifndef ODVA_ETHERNETIP_RR_DATA_REQUEST_H
00027 #define ODVA_ETHERNETIP_RR_DATA_REQUEST_H
00028 
00029 #include <string>
00030 #include <boost/shared_ptr.hpp>
00031 #include <boost/make_shared.hpp>
00032 #include <boost/asio.hpp>
00033 
00034 #include "odva_ethernetip/eip_types.h"
00035 #include "odva_ethernetip/cpf_item.h"
00036 #include "odva_ethernetip/serialization/serializable.h"
00037 #include "odva_ethernetip/serialization/reader.h"
00038 #include "odva_ethernetip/serialization/writer.h"
00039 #include "odva_ethernetip/rr_data.h"
00040 #include "odva_ethernetip/message_router_request.h"
00041 
00042 using boost::shared_ptr;
00043 using boost::make_shared;
00044 
00045 namespace eip {
00046 
00047 using serialization::Serializable;
00048 using serialization::Reader;
00049 using serialization::Writer;
00050 
00054 class RRDataRequest : public RRData
00055 {
00056 public:
00057 
00061   RRDataRequest(EIP_USINT service_code = 0)
00062   {
00063     mr_data_ = make_shared<MessageRouterRequest>(service_code);
00064   }
00065 
00069   RRDataRequest(EIP_USINT service_code, const Path& path, shared_ptr<Serializable> data)
00070   {
00071     mr_data_ = make_shared<MessageRouterRequest>(service_code);
00072     mr_data_->getPath() = path;
00073     mr_data_->setData(data);
00074   }
00075 
00079   RRDataRequest(EIP_USINT service_code, const Path& path)
00080   {
00081     mr_data_ = make_shared<MessageRouterRequest>(service_code);
00082     mr_data_->getPath() = path;
00083   }
00084 
00089   EIP_USINT getServiceCode() const
00090   {
00091     return mr_data_->service;
00092   }
00093 
00098   void setServiceCode(EIP_USINT service_code)
00099   {
00100     mr_data_->service = service_code;
00101   }
00102 
00107   Path& getPath()
00108   {
00109     return mr_data_->getPath();
00110   }
00111 
00117   shared_ptr<Serializable> getMRData()
00118   {
00119     return mr_data_->getData();
00120   }
00121 
00127   void setMRData(shared_ptr<Serializable> data)
00128   {
00129     mr_data_->setData(data);
00130   }
00131 
00132 protected:
00136   virtual shared_ptr<Serializable> getData() const
00137   {
00138     return mr_data_;
00139   }
00140 
00144   virtual void setData(CPFItem& item)
00145   {
00146     throw std::logic_error("Not implemented");
00147   }
00148 
00149 private:
00150   shared_ptr<MessageRouterRequest> mr_data_;
00151 };
00152 
00153 } // namespace eip
00154 
00155 #endif  // ODVA_ETHERNETIP_RR_DATA_REQUEST_H


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