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 #include "sick_safetyscanners/datastructure/PacketBuffer.h" 00036 00037 namespace sick { 00038 namespace datastructure { 00039 00040 00041 PacketBuffer::PacketBuffer() {} 00042 00043 PacketBuffer::PacketBuffer(const PacketBuffer::VectorBuffer& buffer) 00044 { 00045 setBuffer(buffer); 00046 } 00047 00048 PacketBuffer::PacketBuffer(const PacketBuffer::ArrayBuffer& buffer, const size_t& length) 00049 { 00050 setBuffer(buffer, length); 00051 } 00052 00053 const PacketBuffer::VectorBuffer& PacketBuffer::getBuffer() const 00054 { 00055 return m_buffer; 00056 } 00057 00058 void PacketBuffer::setBuffer(const PacketBuffer::VectorBuffer& buffer) 00059 { 00060 m_buffer.clear(); 00061 m_buffer.insert(m_buffer.begin(), buffer.begin(), buffer.end()); 00062 } 00063 00064 void PacketBuffer::setBuffer(const PacketBuffer::ArrayBuffer& buffer, const size_t& length) 00065 { 00066 m_buffer.clear(); 00067 m_buffer.insert(m_buffer.begin(), buffer.data(), buffer.data() + length); 00068 } 00069 00070 size_t PacketBuffer::getLength() const 00071 { 00072 return m_buffer.size(); 00073 } 00074 00075 } // namespace datastructure 00076 } // namespace sick