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_DATA_PROCESSING_TCPPACKETMERGER_H 00036 #define SICK_SAFETYSCANNERS_DATA_PROCESSING_TCPPACKETMERGER_H 00037 00038 #include <sick_safetyscanners/datastructure/PacketBuffer.h> 00039 00040 #include <sick_safetyscanners/data_processing/ParseDatagramHeader.h> 00041 00042 #include <vector> 00043 00044 namespace sick { 00045 namespace data_processing { 00046 00050 class TCPPacketMerger 00051 { 00052 public: 00056 TCPPacketMerger(); 00057 00063 bool isComplete() const; 00064 00070 bool isEmpty() const; 00071 00080 bool addTCPPacket(const sick::datastructure::PacketBuffer& buffer); 00081 00087 sick::datastructure::PacketBuffer getDeployedPacketBuffer(); 00088 00094 uint32_t getTargetSize() const; 00095 00101 void setTargetSize(const uint32_t& targetSize); 00102 00103 private: 00104 bool m_is_complete; 00105 sick::datastructure::PacketBuffer m_deployed_packet_buffer; 00106 00107 std::vector<sick::datastructure::PacketBuffer> m_buffer_vector; 00108 uint32_t m_targetSize; 00109 00110 bool addToMap(const sick::datastructure::PacketBuffer& newPacket); 00111 bool deployPacketIfComplete(); 00112 00113 uint32_t getCurrentSize() const; 00114 bool deployPacket(); 00115 }; 00116 00117 } // namespace data_processing 00118 } // namespace sick 00119 00120 #endif // SICK_SAFETYSCANNERS_DATA_PROCESSING_TCPPACKETMERGER_H