ParseData.cpp
Go to the documentation of this file.
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/data_processing/ParseData.h>
00036 
00037 namespace sick {
00038 namespace data_processing {
00039 
00040 ParseData::ParseData()
00041 {
00042   m_reader_ptr                  = std::make_shared<sick::data_processing::ReadWriteHelper>();
00043   m_data_header_parser_ptr      = std::make_shared<sick::data_processing::ParseDataHeader>();
00044   m_derived_values_parser_ptr   = std::make_shared<sick::data_processing::ParseDerivedValues>();
00045   m_measurement_data_parser_ptr = std::make_shared<sick::data_processing::ParseMeasurementData>();
00046   m_general_system_state_parser_ptr =
00047     std::make_shared<sick::data_processing::ParseGeneralSystemState>();
00048   m_intrusion_data_parser_ptr   = std::make_shared<sick::data_processing::ParseIntrusionData>();
00049   m_application_data_parser_ptr = std::make_shared<sick::data_processing::ParseApplicationData>();
00050 }
00051 
00052 bool ParseData::parseUDPSequence(const datastructure::PacketBuffer buffer,
00053                                  datastructure::Data& data) const
00054 {
00055   setDataBlocksInData(buffer, data);
00056   return true;
00057 }
00058 
00059 void ParseData::setDataBlocksInData(const datastructure::PacketBuffer& buffer,
00060                                     datastructure::Data& data) const
00061 {
00062   setDataHeaderInData(buffer, data);
00063   setDerivedValuesInData(buffer, data);
00064   setMeasurementDataInData(buffer, data);
00065   setGeneralSystemStateInData(buffer, data);
00066   setIntrusionDataInData(buffer, data);
00067   setApplicationDataInData(buffer, data);
00068 }
00069 
00070 void ParseData::setDataHeaderInData(const datastructure::PacketBuffer& buffer,
00071                                     datastructure::Data& data) const
00072 {
00073   sick::datastructure::DataHeader data_header =
00074     m_data_header_parser_ptr->parseUDPSequence(buffer, data);
00075   data.setDataHeaderPtr(std::make_shared<sick::datastructure::DataHeader>(data_header));
00076 }
00077 
00078 void ParseData::setDerivedValuesInData(const datastructure::PacketBuffer& buffer,
00079                                        datastructure::Data& data) const
00080 {
00081   sick::datastructure::DerivedValues derived_values =
00082     m_derived_values_parser_ptr->parseUDPSequence(buffer, data);
00083   data.setDerivedValuesPtr(std::make_shared<sick::datastructure::DerivedValues>(derived_values));
00084 }
00085 
00086 void ParseData::setMeasurementDataInData(const datastructure::PacketBuffer& buffer,
00087                                          datastructure::Data& data) const
00088 {
00089   sick::datastructure::MeasurementData measurement_data =
00090     m_measurement_data_parser_ptr->parseUDPSequence(buffer, data);
00091   data.setMeasurementDataPtr(
00092     std::make_shared<sick::datastructure::MeasurementData>(measurement_data));
00093 }
00094 
00095 void ParseData::setGeneralSystemStateInData(const datastructure::PacketBuffer& buffer,
00096                                             datastructure::Data& data) const
00097 {
00098   sick::datastructure::GeneralSystemState general_system_state =
00099     m_general_system_state_parser_ptr->parseUDPSequence(buffer, data);
00100   data.setGeneralSystemStatePtr(
00101     std::make_shared<sick::datastructure::GeneralSystemState>(general_system_state));
00102 }
00103 
00104 void ParseData::setIntrusionDataInData(const datastructure::PacketBuffer& buffer,
00105                                        datastructure::Data& data) const
00106 {
00107   sick::datastructure::IntrusionData intrusion_data =
00108     m_intrusion_data_parser_ptr->parseUDPSequence(buffer, data);
00109   data.setIntrusionDataPtr(std::make_shared<sick::datastructure::IntrusionData>(intrusion_data));
00110 }
00111 
00112 void ParseData::setApplicationDataInData(const datastructure::PacketBuffer& buffer,
00113                                          datastructure::Data& data) const
00114 {
00115   sick::datastructure::ApplicationData application_data =
00116     m_application_data_parser_ptr->parseUDPSequence(buffer, data);
00117   data.setApplicationDataPtr(
00118     std::make_shared<sick::datastructure::ApplicationData>(application_data));
00119 }
00120 
00121 } // namespace data_processing
00122 } // namespace sick


sick_safetyscanners
Author(s): Lennart Puck
autogenerated on Tue May 7 2019 03:27:36