00001 // this is for emacs file handling -*- mode: c++; indent-tabs-mode: nil -*- 00002 00003 // -- BEGIN LICENSE BLOCK ---------------------------------------------- 00004 00024 // -- END LICENSE BLOCK ------------------------------------------------ 00025 00026 //---------------------------------------------------------------------- 00033 //---------------------------------------------------------------------- 00034 00035 #ifndef SICK_SAFETYSCANNERS_DATASTRUCTURE_PACKETBUFFER_H 00036 #define SICK_SAFETYSCANNERS_DATASTRUCTURE_PACKETBUFFER_H 00037 00038 #include <iostream> 00039 #include <stdint.h> 00040 #include <string> 00041 #include <vector> 00042 00043 #include <boost/array.hpp> 00044 #include <boost/asio.hpp> 00045 00046 #include <sick_safetyscanners/datastructure/DatagramHeader.h> 00047 #include <sick_safetyscanners/datastructure/PacketBuffer.h> 00048 00049 00050 namespace sick { 00051 namespace datastructure { 00052 00056 const uint32_t MAXSIZE = 10000; 00057 00061 class PacketBuffer 00062 { 00063 public: 00067 typedef boost::array<uint8_t, MAXSIZE> ArrayBuffer; 00071 typedef std::vector<uint8_t> VectorBuffer; 00072 00076 PacketBuffer(); 00077 00085 PacketBuffer(const VectorBuffer& buffer); 00086 00092 PacketBuffer(const ArrayBuffer& buffer, const size_t& length); 00093 00098 static uint32_t getMaxSize() { return MAXSIZE; } 00099 00104 const VectorBuffer& getBuffer() const; 00105 00110 void setBuffer(const VectorBuffer& buffer); 00111 00117 void setBuffer(const ArrayBuffer& buffer, const size_t& length); 00118 00123 size_t getLength() const; 00124 00125 00126 private: 00127 VectorBuffer m_buffer; 00128 }; 00129 00130 } // namespace datastructure 00131 } // namespace sick 00132 00133 #endif // SICK_SAFETYSCANNERS_DATASTRUCTURE_PACKETBUFFER_H