00001 // -- BEGIN LICENSE BLOCK ---------------------------------------------- 00002 // This file is part of FZIs ic_workspace. 00003 // 00004 // This program is free software licensed under the LGPL 00005 // (GNU LESSER GENERAL PUBLIC LICENSE Version 3). 00006 // You can find a copy of this license in LICENSE folder in the top 00007 // directory of the source code. 00008 // 00009 // © Copyright 2016 FZI Forschungszentrum Informatik, Karlsruhe, Germany 00010 // 00011 // -- END LICENSE BLOCK ------------------------------------------------ 00012 00013 // ---------------------------------------------------------- 00014 /* 00015 * tCanMatrixParser.h 00016 * <section> 00017 * 00018 * Created by Hugo Ritzkowski on 01.04.2011. 00019 * Copyright 2011 00020 * Company Forschungszentrum Informatik (FZI), Abteilung IDS. 00021 * All rights reserved. 00022 * 00023 */ 00024 // ---------------------------------------------------------- 00034 // ---------------------------------------------------------- 00035 00036 #ifndef _icl_hardware_tCanMatrixParser_h_ 00037 #define _icl_hardware_tCanMatrixParser_h_ 00038 00039 #include "icl_hardware_can/ImportExport.h" 00040 00041 #include <icl_core/tString.h> 00042 00043 #include <fstream> 00044 #include <boost/filesystem.hpp> 00045 #include <map> 00046 #include <vector> 00047 00048 // Forward declaration 00049 class TiXmlHandle; 00050 class TiXmlElement; 00051 00052 namespace icl_hardware { 00053 namespace can { 00054 00055 struct ICL_HARDWARE_CAN_IMPORT_EXPORT CanMatrixElement 00056 { 00057 std::string description; 00058 double conversion; 00059 std::string unit; 00060 unsigned int start_bit; 00061 unsigned int signal_length; 00062 double offset; 00063 double lower_border; 00064 double upper_border; 00065 bool little_endian; 00066 bool signedness; 00067 }; 00068 00069 typedef std::map<unsigned int, std::vector<CanMatrixElement> > CanMatrix; 00070 00071 class ICL_HARDWARE_CAN_IMPORT_EXPORT tCanMatrixParser 00072 { 00073 public: 00075 tCanMatrixParser(const std::string identifier = ""); 00076 00078 virtual ~tCanMatrixParser(); 00079 00080 const CanMatrix &getCanMatrix() const; 00081 00082 const bool isActive() const; 00083 00084 private: 00085 int mapContentOfFile(TiXmlHandle& doc_handle); 00086 int mapContentOfFile(void* dbc_); 00087 00088 const int checkXmlFile(TiXmlElement *element) const; 00089 void setDataFileName(const boost::filesystem::path &file_name); 00090 const boost::filesystem::path & getDataFileName() const; 00091 00092 CanMatrix m_canmatrix; 00093 boost::filesystem::path *m_data_file_name; 00094 bool is_initialized; 00095 }; 00096 00097 ICL_HARDWARE_CAN_IMPORT_EXPORT std::ostream& operator<<(std::ostream &stream, const CanMatrix& can_matrix); 00098 00099 } 00100 } 00101 00102 #endif // _icl_hardware_tCanMatrixParser_h_