362 lines
45 KiB
TeX
362 lines
45 KiB
TeX
\hypertarget{dbc__parser_8cpp_source}{}\doxysection{dbc\+\_\+parser.\+cpp}
|
|
\mbox{\hyperlink{dbc__parser_8cpp}{Go to the documentation of this file.}}
|
|
\begin{DoxyCode}{0}
|
|
\DoxyCodeLine{\Hypertarget{dbc__parser_8cpp_source_l00001}00001 \textcolor{comment}{/**}}
|
|
\DoxyCodeLine{\Hypertarget{dbc__parser_8cpp_source_l00002}00002 \textcolor{comment}{ * @file dbc\_parser.cpp}}
|
|
\DoxyCodeLine{\Hypertarget{dbc__parser_8cpp_source_l00003}00003 \textcolor{comment}{ * @brief}}
|
|
\DoxyCodeLine{\Hypertarget{dbc__parser_8cpp_source_l00004}00004 \textcolor{comment}{ *}}
|
|
\DoxyCodeLine{\Hypertarget{dbc__parser_8cpp_source_l00005}00005 \textcolor{comment}{ * Created: 2026-\/03-\/13}}
|
|
\DoxyCodeLine{\Hypertarget{dbc__parser_8cpp_source_l00006}00006 \textcolor{comment}{ * Author: Deeaitch (Dim. Himro)}}
|
|
\DoxyCodeLine{\Hypertarget{dbc__parser_8cpp_source_l00007}00007 \textcolor{comment}{ *}}
|
|
\DoxyCodeLine{\Hypertarget{dbc__parser_8cpp_source_l00008}00008 \textcolor{comment}{ * Licensed under the MIT License.}}
|
|
\DoxyCodeLine{\Hypertarget{dbc__parser_8cpp_source_l00009}00009 \textcolor{comment}{ * See LICENSE file in the project root for full license text.}}
|
|
\DoxyCodeLine{\Hypertarget{dbc__parser_8cpp_source_l00010}00010 \textcolor{comment}{ */}}
|
|
\DoxyCodeLine{\Hypertarget{dbc__parser_8cpp_source_l00011}00011 }
|
|
\DoxyCodeLine{\Hypertarget{dbc__parser_8cpp_source_l00012}00012 \textcolor{preprocessor}{\#include "{}\mbox{\hyperlink{dbc__parser_8h}{dbc\_parser.h}}"{}}}
|
|
\DoxyCodeLine{\Hypertarget{dbc__parser_8cpp_source_l00013}00013 }
|
|
\DoxyCodeLine{\Hypertarget{dbc__parser_8cpp_source_l00014}00014 \textcolor{preprocessor}{\#include <fstream>}}
|
|
\DoxyCodeLine{\Hypertarget{dbc__parser_8cpp_source_l00015}00015 \textcolor{preprocessor}{\#include <sstream>}}
|
|
\DoxyCodeLine{\Hypertarget{dbc__parser_8cpp_source_l00016}00016 \textcolor{preprocessor}{\#include <stdexcept>}}
|
|
\DoxyCodeLine{\Hypertarget{dbc__parser_8cpp_source_l00017}00017 \textcolor{preprocessor}{\#include <cctype>}}
|
|
\DoxyCodeLine{\Hypertarget{dbc__parser_8cpp_source_l00018}00018 }
|
|
\DoxyCodeLine{\Hypertarget{dbc__parser_8cpp_source_l00019}\mbox{\hyperlink{namespaceanonymous__namespace_02dbc__parser_8cpp_03}{00019}} \textcolor{keyword}{namespace }\{\textcolor{comment}{}}
|
|
\DoxyCodeLine{\Hypertarget{dbc__parser_8cpp_source_l00020}00020 \textcolor{comment}{ /**}}
|
|
\DoxyCodeLine{\Hypertarget{dbc__parser_8cpp_source_l00021}00021 \textcolor{comment}{ * @brief Remove leading and trailing spaces.}}
|
|
\DoxyCodeLine{\Hypertarget{dbc__parser_8cpp_source_l00022}00022 \textcolor{comment}{ * @param text Input text.}}
|
|
\DoxyCodeLine{\Hypertarget{dbc__parser_8cpp_source_l00023}00023 \textcolor{comment}{ * @return Trimmed text.}}
|
|
\DoxyCodeLine{\Hypertarget{dbc__parser_8cpp_source_l00024}00024 \textcolor{comment}{ */}}
|
|
\DoxyCodeLine{\Hypertarget{dbc__parser_8cpp_source_l00025}\mbox{\hyperlink{namespaceanonymous__namespace_02dbc__parser_8cpp_03_a5850f07ce5f4e5c4f3bf385ebcfcebbb}{00025}} std::string \mbox{\hyperlink{namespaceanonymous__namespace_02dbc__parser_8cpp_03_a5850f07ce5f4e5c4f3bf385ebcfcebbb}{TrimText}} (\textcolor{keyword}{const} std::string \&text) \{}
|
|
\DoxyCodeLine{\Hypertarget{dbc__parser_8cpp_source_l00026}00026 std::string::size\_type begin = 0U;}
|
|
\DoxyCodeLine{\Hypertarget{dbc__parser_8cpp_source_l00027}00027 \textcolor{keywordflow}{while} ((begin < text.size()) \&\&}
|
|
\DoxyCodeLine{\Hypertarget{dbc__parser_8cpp_source_l00028}00028 std::isspace (\textcolor{keyword}{static\_cast<}\textcolor{keywordtype}{unsigned} \textcolor{keywordtype}{char}\textcolor{keyword}{>} (text[begin])))}
|
|
\DoxyCodeLine{\Hypertarget{dbc__parser_8cpp_source_l00029}00029 ++begin;}
|
|
\DoxyCodeLine{\Hypertarget{dbc__parser_8cpp_source_l00030}00030 }
|
|
\DoxyCodeLine{\Hypertarget{dbc__parser_8cpp_source_l00031}00031 std::string::size\_type end = text.size();}
|
|
\DoxyCodeLine{\Hypertarget{dbc__parser_8cpp_source_l00032}00032 \textcolor{keywordflow}{while} ((end > begin) \&\&}
|
|
\DoxyCodeLine{\Hypertarget{dbc__parser_8cpp_source_l00033}00033 std::isspace (\textcolor{keyword}{static\_cast<}\textcolor{keywordtype}{unsigned} \textcolor{keywordtype}{char}\textcolor{keyword}{>} (text[end -\/ 1U])))}
|
|
\DoxyCodeLine{\Hypertarget{dbc__parser_8cpp_source_l00034}00034 -\/-\/end;}
|
|
\DoxyCodeLine{\Hypertarget{dbc__parser_8cpp_source_l00035}00035 }
|
|
\DoxyCodeLine{\Hypertarget{dbc__parser_8cpp_source_l00036}00036 \textcolor{keywordflow}{return} text.substr (begin, end -\/ begin);}
|
|
\DoxyCodeLine{\Hypertarget{dbc__parser_8cpp_source_l00037}00037 \}}
|
|
\DoxyCodeLine{\Hypertarget{dbc__parser_8cpp_source_l00038}00038 \}}
|
|
\DoxyCodeLine{\Hypertarget{dbc__parser_8cpp_source_l00039}00039 }
|
|
\DoxyCodeLine{\Hypertarget{dbc__parser_8cpp_source_l00040}\mbox{\hyperlink{classDbcParser_aef72826942c9095d653fafa435855e56}{00040}} \mbox{\hyperlink{structDbcDatabase}{DbcDatabase}} \mbox{\hyperlink{classDbcParser_aef72826942c9095d653fafa435855e56}{DbcParser::ParseFile}} (\textcolor{keyword}{const} std::string \&filePath)\textcolor{keyword}{ const }\{}
|
|
\DoxyCodeLine{\Hypertarget{dbc__parser_8cpp_source_l00041}00041 std::ifstream input (filePath.c\_str());}
|
|
\DoxyCodeLine{\Hypertarget{dbc__parser_8cpp_source_l00042}00042 \textcolor{keywordflow}{if} (!input.is\_open())}
|
|
\DoxyCodeLine{\Hypertarget{dbc__parser_8cpp_source_l00043}00043 \textcolor{keywordflow}{throw} std::runtime\_error (\textcolor{stringliteral}{"{}Failed to open DBC file: "{}} + filePath);}
|
|
\DoxyCodeLine{\Hypertarget{dbc__parser_8cpp_source_l00044}00044 }
|
|
\DoxyCodeLine{\Hypertarget{dbc__parser_8cpp_source_l00045}00045 \mbox{\hyperlink{structDbcDatabase}{DbcDatabase}} database;}
|
|
\DoxyCodeLine{\Hypertarget{dbc__parser_8cpp_source_l00046}00046 \mbox{\hyperlink{structFrameInfo}{FrameInfo}} *currentFrame = \textcolor{keyword}{nullptr};}
|
|
\DoxyCodeLine{\Hypertarget{dbc__parser_8cpp_source_l00047}00047 }
|
|
\DoxyCodeLine{\Hypertarget{dbc__parser_8cpp_source_l00048}00048 std::string line;}
|
|
\DoxyCodeLine{\Hypertarget{dbc__parser_8cpp_source_l00049}00049 \textcolor{keywordflow}{while} (std::getline (input, line)) \{}
|
|
\DoxyCodeLine{\Hypertarget{dbc__parser_8cpp_source_l00050}00050 line = \mbox{\hyperlink{classDbcParser_a1ae77c4c356af3d7b01a30044366f02b}{Trim}} (line);}
|
|
\DoxyCodeLine{\Hypertarget{dbc__parser_8cpp_source_l00051}00051 \textcolor{keywordflow}{if} (line.empty())}
|
|
\DoxyCodeLine{\Hypertarget{dbc__parser_8cpp_source_l00052}00052 \textcolor{keywordflow}{continue};}
|
|
\DoxyCodeLine{\Hypertarget{dbc__parser_8cpp_source_l00053}00053 }
|
|
\DoxyCodeLine{\Hypertarget{dbc__parser_8cpp_source_l00054}00054 \textcolor{keywordflow}{if} (\mbox{\hyperlink{classDbcParser_ada086584d371c08dd93b75fb7965f13b}{IsFrameLine}} (line)) \{}
|
|
\DoxyCodeLine{\Hypertarget{dbc__parser_8cpp_source_l00055}00055 \mbox{\hyperlink{structFrameInfo}{FrameInfo}} frame = \mbox{\hyperlink{classDbcParser_a6d73bb1885e59aecd8202e93a7cd392a}{ParseFrameLine}} (line);}
|
|
\DoxyCodeLine{\Hypertarget{dbc__parser_8cpp_source_l00056}00056 database.\mbox{\hyperlink{structDbcDatabase_a2cade5d0234ee816132127542f8c612b}{frames}}.push\_back (frame);}
|
|
\DoxyCodeLine{\Hypertarget{dbc__parser_8cpp_source_l00057}00057 currentFrame = \&database.\mbox{\hyperlink{structDbcDatabase_a2cade5d0234ee816132127542f8c612b}{frames}}.back();}
|
|
\DoxyCodeLine{\Hypertarget{dbc__parser_8cpp_source_l00058}00058 \} \textcolor{keywordflow}{else} \textcolor{keywordflow}{if} (\mbox{\hyperlink{classDbcParser_ace3d3432a55707bc286a994aa205fed1}{IsSignalLine}} (line)) \{}
|
|
\DoxyCodeLine{\Hypertarget{dbc__parser_8cpp_source_l00059}00059 \textcolor{keywordflow}{if} (currentFrame == \textcolor{keyword}{nullptr})}
|
|
\DoxyCodeLine{\Hypertarget{dbc__parser_8cpp_source_l00060}00060 \textcolor{keywordflow}{throw} std::runtime\_error (\textcolor{stringliteral}{"{}Signal found before any frame definition."{}});}
|
|
\DoxyCodeLine{\Hypertarget{dbc__parser_8cpp_source_l00061}00061 }
|
|
\DoxyCodeLine{\Hypertarget{dbc__parser_8cpp_source_l00062}00062 \mbox{\hyperlink{structSignalInfo}{SignalInfo}} signal = \mbox{\hyperlink{classDbcParser_a4cbce88d08b1f72903ecf1bce41de5d2}{ParseSignalLine}} (line);}
|
|
\DoxyCodeLine{\Hypertarget{dbc__parser_8cpp_source_l00063}00063 currentFrame-\/>\mbox{\hyperlink{structFrameInfo_a942937027f1af06536f98cc23b2bf6ce}{signals}}.push\_back (signal);}
|
|
\DoxyCodeLine{\Hypertarget{dbc__parser_8cpp_source_l00064}00064 \} \textcolor{keywordflow}{else} \textcolor{keywordflow}{if} (\mbox{\hyperlink{classDbcParser_ae3488a0a6c64dc95e4ed289e77579feb}{IsCommentLine}} (line))}
|
|
\DoxyCodeLine{\Hypertarget{dbc__parser_8cpp_source_l00065}00065 \mbox{\hyperlink{classDbcParser_aa662b34694fd8b3edd757f36cb064c5c}{ParseCommentLine}} (line, database);}
|
|
\DoxyCodeLine{\Hypertarget{dbc__parser_8cpp_source_l00066}00066 \}}
|
|
\DoxyCodeLine{\Hypertarget{dbc__parser_8cpp_source_l00067}00067 }
|
|
\DoxyCodeLine{\Hypertarget{dbc__parser_8cpp_source_l00068}00068 \textcolor{keywordflow}{return} database;}
|
|
\DoxyCodeLine{\Hypertarget{dbc__parser_8cpp_source_l00069}00069 \}}
|
|
\DoxyCodeLine{\Hypertarget{dbc__parser_8cpp_source_l00070}00070 }
|
|
\DoxyCodeLine{\Hypertarget{dbc__parser_8cpp_source_l00071}\mbox{\hyperlink{classDbcParser_ada086584d371c08dd93b75fb7965f13b}{00071}} \textcolor{keywordtype}{bool} \mbox{\hyperlink{classDbcParser_ada086584d371c08dd93b75fb7965f13b}{DbcParser::IsFrameLine}} (\textcolor{keyword}{const} std::string \&line) \{}
|
|
\DoxyCodeLine{\Hypertarget{dbc__parser_8cpp_source_l00072}00072 \textcolor{keywordflow}{return} (line.size() >= 4U) \&\& (line.compare (0U, 4U, \textcolor{stringliteral}{"{}BO\_ "{}}) == 0);}
|
|
\DoxyCodeLine{\Hypertarget{dbc__parser_8cpp_source_l00073}00073 \}}
|
|
\DoxyCodeLine{\Hypertarget{dbc__parser_8cpp_source_l00074}00074 }
|
|
\DoxyCodeLine{\Hypertarget{dbc__parser_8cpp_source_l00075}\mbox{\hyperlink{classDbcParser_ace3d3432a55707bc286a994aa205fed1}{00075}} \textcolor{keywordtype}{bool} \mbox{\hyperlink{classDbcParser_ace3d3432a55707bc286a994aa205fed1}{DbcParser::IsSignalLine}} (\textcolor{keyword}{const} std::string \&line) \{}
|
|
\DoxyCodeLine{\Hypertarget{dbc__parser_8cpp_source_l00076}00076 \textcolor{keywordflow}{return} (line.size() >= 4U) \&\& (line.compare (0U, 4U, \textcolor{stringliteral}{"{}SG\_ "{}}) == 0);}
|
|
\DoxyCodeLine{\Hypertarget{dbc__parser_8cpp_source_l00077}00077 \}}
|
|
\DoxyCodeLine{\Hypertarget{dbc__parser_8cpp_source_l00078}00078 }
|
|
\DoxyCodeLine{\Hypertarget{dbc__parser_8cpp_source_l00079}\mbox{\hyperlink{classDbcParser_ae3488a0a6c64dc95e4ed289e77579feb}{00079}} \textcolor{keywordtype}{bool} \mbox{\hyperlink{classDbcParser_ae3488a0a6c64dc95e4ed289e77579feb}{DbcParser::IsCommentLine}} (\textcolor{keyword}{const} std::string \&line) \{}
|
|
\DoxyCodeLine{\Hypertarget{dbc__parser_8cpp_source_l00080}00080 \textcolor{keywordflow}{return} (line.size() >= 4U) \&\& (line.compare (0U, 4U, \textcolor{stringliteral}{"{}CM\_ "{}}) == 0);}
|
|
\DoxyCodeLine{\Hypertarget{dbc__parser_8cpp_source_l00081}00081 \}}
|
|
\DoxyCodeLine{\Hypertarget{dbc__parser_8cpp_source_l00082}00082 }
|
|
\DoxyCodeLine{\Hypertarget{dbc__parser_8cpp_source_l00083}\mbox{\hyperlink{classDbcParser_a1ae77c4c356af3d7b01a30044366f02b}{00083}} std::string \mbox{\hyperlink{classDbcParser_a1ae77c4c356af3d7b01a30044366f02b}{DbcParser::Trim}} (\textcolor{keyword}{const} std::string \&text) \{}
|
|
\DoxyCodeLine{\Hypertarget{dbc__parser_8cpp_source_l00084}00084 \textcolor{keywordflow}{return} \mbox{\hyperlink{namespaceanonymous__namespace_02dbc__parser_8cpp_03_a5850f07ce5f4e5c4f3bf385ebcfcebbb}{TrimText}} (text);}
|
|
\DoxyCodeLine{\Hypertarget{dbc__parser_8cpp_source_l00085}00085 \}}
|
|
\DoxyCodeLine{\Hypertarget{dbc__parser_8cpp_source_l00086}00086 }
|
|
\DoxyCodeLine{\Hypertarget{dbc__parser_8cpp_source_l00087}\mbox{\hyperlink{classDbcParser_a0c1cc3c58f33473bf426a77b7a25c529}{00087}} std::vector<std::string> \mbox{\hyperlink{classDbcParser_a0c1cc3c58f33473bf426a77b7a25c529}{DbcParser::SplitReceivers}} (\textcolor{keyword}{const} std::string \&text) \{}
|
|
\DoxyCodeLine{\Hypertarget{dbc__parser_8cpp_source_l00088}00088 std::vector<std::string> receivers;}
|
|
\DoxyCodeLine{\Hypertarget{dbc__parser_8cpp_source_l00089}00089 std::string token;}
|
|
\DoxyCodeLine{\Hypertarget{dbc__parser_8cpp_source_l00090}00090 std::istringstream stream (text);}
|
|
\DoxyCodeLine{\Hypertarget{dbc__parser_8cpp_source_l00091}00091 }
|
|
\DoxyCodeLine{\Hypertarget{dbc__parser_8cpp_source_l00092}00092 \textcolor{keywordflow}{while} (std::getline (stream, token, \textcolor{charliteral}{','})) \{}
|
|
\DoxyCodeLine{\Hypertarget{dbc__parser_8cpp_source_l00093}00093 token = \mbox{\hyperlink{namespaceanonymous__namespace_02dbc__parser_8cpp_03_a5850f07ce5f4e5c4f3bf385ebcfcebbb}{TrimText}} (token);}
|
|
\DoxyCodeLine{\Hypertarget{dbc__parser_8cpp_source_l00094}00094 \textcolor{keywordflow}{if} (!token.empty())}
|
|
\DoxyCodeLine{\Hypertarget{dbc__parser_8cpp_source_l00095}00095 receivers.push\_back (token);}
|
|
\DoxyCodeLine{\Hypertarget{dbc__parser_8cpp_source_l00096}00096 \}}
|
|
\DoxyCodeLine{\Hypertarget{dbc__parser_8cpp_source_l00097}00097 }
|
|
\DoxyCodeLine{\Hypertarget{dbc__parser_8cpp_source_l00098}00098 \textcolor{keywordflow}{return} receivers;}
|
|
\DoxyCodeLine{\Hypertarget{dbc__parser_8cpp_source_l00099}00099 \}}
|
|
\DoxyCodeLine{\Hypertarget{dbc__parser_8cpp_source_l00100}00100 }
|
|
\DoxyCodeLine{\Hypertarget{dbc__parser_8cpp_source_l00101}\mbox{\hyperlink{classDbcParser_a94d140d9442e4989b5b2ea7662c2debf}{00101}} \textcolor{keywordtype}{void} \mbox{\hyperlink{classDbcParser_a94d140d9442e4989b5b2ea7662c2debf}{DbcParser::NormalizeCanId}} (std::uint32\_t rawCanId,}
|
|
\DoxyCodeLine{\Hypertarget{dbc__parser_8cpp_source_l00102}00102 std::uint32\_t \&normalizedCanId,}
|
|
\DoxyCodeLine{\Hypertarget{dbc__parser_8cpp_source_l00103}00103 \textcolor{keywordtype}{bool} \&isExtended) \{}
|
|
\DoxyCodeLine{\Hypertarget{dbc__parser_8cpp_source_l00104}00104 \textcolor{comment}{/*}}
|
|
\DoxyCodeLine{\Hypertarget{dbc__parser_8cpp_source_l00105}00105 \textcolor{comment}{ * DBC commonly stores extended identifiers with bit 31 set.}}
|
|
\DoxyCodeLine{\Hypertarget{dbc__parser_8cpp_source_l00106}00106 \textcolor{comment}{ * Example:}}
|
|
\DoxyCodeLine{\Hypertarget{dbc__parser_8cpp_source_l00107}00107 \textcolor{comment}{ * raw id = 0x80000000 | actual\_29\_bit\_id}}
|
|
\DoxyCodeLine{\Hypertarget{dbc__parser_8cpp_source_l00108}00108 \textcolor{comment}{ */}}
|
|
\DoxyCodeLine{\Hypertarget{dbc__parser_8cpp_source_l00109}00109 \textcolor{keywordflow}{if} ((rawCanId \& 0x80000000U) != 0U) \{}
|
|
\DoxyCodeLine{\Hypertarget{dbc__parser_8cpp_source_l00110}00110 isExtended = \textcolor{keyword}{true};}
|
|
\DoxyCodeLine{\Hypertarget{dbc__parser_8cpp_source_l00111}00111 normalizedCanId = (rawCanId \& 0x1FFFFFFFU);}
|
|
\DoxyCodeLine{\Hypertarget{dbc__parser_8cpp_source_l00112}00112 \} \textcolor{keywordflow}{else} \{}
|
|
\DoxyCodeLine{\Hypertarget{dbc__parser_8cpp_source_l00113}00113 isExtended = (rawCanId > 0x7FFU);}
|
|
\DoxyCodeLine{\Hypertarget{dbc__parser_8cpp_source_l00114}00114 normalizedCanId = rawCanId;}
|
|
\DoxyCodeLine{\Hypertarget{dbc__parser_8cpp_source_l00115}00115 \}}
|
|
\DoxyCodeLine{\Hypertarget{dbc__parser_8cpp_source_l00116}00116 \}}
|
|
\DoxyCodeLine{\Hypertarget{dbc__parser_8cpp_source_l00117}00117 }
|
|
\DoxyCodeLine{\Hypertarget{dbc__parser_8cpp_source_l00118}\mbox{\hyperlink{classDbcParser_a8a7e8fc517e40beab87a8a1dbad2b324}{00118}} std::uint32\_t \mbox{\hyperlink{classDbcParser_a8a7e8fc517e40beab87a8a1dbad2b324}{DbcParser::TryExtractPgn}} (std::uint32\_t canId, \textcolor{keywordtype}{bool} isExtended, \textcolor{keywordtype}{bool} \&hasPgn) \{}
|
|
\DoxyCodeLine{\Hypertarget{dbc__parser_8cpp_source_l00119}00119 hasPgn = \textcolor{keyword}{false};}
|
|
\DoxyCodeLine{\Hypertarget{dbc__parser_8cpp_source_l00120}00120 }
|
|
\DoxyCodeLine{\Hypertarget{dbc__parser_8cpp_source_l00121}00121 \textcolor{keywordflow}{if} (!isExtended)}
|
|
\DoxyCodeLine{\Hypertarget{dbc__parser_8cpp_source_l00122}00122 \textcolor{keywordflow}{return} 0U;}
|
|
\DoxyCodeLine{\Hypertarget{dbc__parser_8cpp_source_l00123}00123 }
|
|
\DoxyCodeLine{\Hypertarget{dbc__parser_8cpp_source_l00124}00124 \textcolor{keywordflow}{if} ((canId \& 0x1FFFFFFFU) != canId)}
|
|
\DoxyCodeLine{\Hypertarget{dbc__parser_8cpp_source_l00125}00125 \textcolor{keywordflow}{return} 0U;}
|
|
\DoxyCodeLine{\Hypertarget{dbc__parser_8cpp_source_l00126}00126 }
|
|
\DoxyCodeLine{\Hypertarget{dbc__parser_8cpp_source_l00127}00127 \textcolor{keyword}{const} std::uint32\_t pf = (canId >> 16U) \& 0xFFU;}
|
|
\DoxyCodeLine{\Hypertarget{dbc__parser_8cpp_source_l00128}00128 \textcolor{keyword}{const} std::uint32\_t ps = (canId >> 8U) \& 0xFFU;}
|
|
\DoxyCodeLine{\Hypertarget{dbc__parser_8cpp_source_l00129}00129 \textcolor{keyword}{const} std::uint32\_t dp = (canId >> 24U) \& 0x01U;}
|
|
\DoxyCodeLine{\Hypertarget{dbc__parser_8cpp_source_l00130}00130 }
|
|
\DoxyCodeLine{\Hypertarget{dbc__parser_8cpp_source_l00131}00131 std::uint32\_t pgn = 0U;}
|
|
\DoxyCodeLine{\Hypertarget{dbc__parser_8cpp_source_l00132}00132 }
|
|
\DoxyCodeLine{\Hypertarget{dbc__parser_8cpp_source_l00133}00133 \textcolor{keywordflow}{if} (pf < 240U)}
|
|
\DoxyCodeLine{\Hypertarget{dbc__parser_8cpp_source_l00134}00134 pgn = (dp << 16U) | (pf << 8U);}
|
|
\DoxyCodeLine{\Hypertarget{dbc__parser_8cpp_source_l00135}00135 \textcolor{keywordflow}{else}}
|
|
\DoxyCodeLine{\Hypertarget{dbc__parser_8cpp_source_l00136}00136 pgn = (dp << 16U) | (pf << 8U) | ps;}
|
|
\DoxyCodeLine{\Hypertarget{dbc__parser_8cpp_source_l00137}00137 }
|
|
\DoxyCodeLine{\Hypertarget{dbc__parser_8cpp_source_l00138}00138 hasPgn = \textcolor{keyword}{true};}
|
|
\DoxyCodeLine{\Hypertarget{dbc__parser_8cpp_source_l00139}00139 \textcolor{keywordflow}{return} pgn;}
|
|
\DoxyCodeLine{\Hypertarget{dbc__parser_8cpp_source_l00140}00140 \}}
|
|
\DoxyCodeLine{\Hypertarget{dbc__parser_8cpp_source_l00141}00141 }
|
|
\DoxyCodeLine{\Hypertarget{dbc__parser_8cpp_source_l00142}\mbox{\hyperlink{classDbcParser_a6d73bb1885e59aecd8202e93a7cd392a}{00142}} \mbox{\hyperlink{structFrameInfo}{FrameInfo}} \mbox{\hyperlink{classDbcParser_a6d73bb1885e59aecd8202e93a7cd392a}{DbcParser::ParseFrameLine}} (\textcolor{keyword}{const} std::string \&line) \{}
|
|
\DoxyCodeLine{\Hypertarget{dbc__parser_8cpp_source_l00143}00143 \textcolor{comment}{/*}}
|
|
\DoxyCodeLine{\Hypertarget{dbc__parser_8cpp_source_l00144}00144 \textcolor{comment}{ * Example:}}
|
|
\DoxyCodeLine{\Hypertarget{dbc__parser_8cpp_source_l00145}00145 \textcolor{comment}{ * BO\_ 256 EngineData: 8 EEC1}}
|
|
\DoxyCodeLine{\Hypertarget{dbc__parser_8cpp_source_l00146}00146 \textcolor{comment}{ */}}
|
|
\DoxyCodeLine{\Hypertarget{dbc__parser_8cpp_source_l00147}00147 }
|
|
\DoxyCodeLine{\Hypertarget{dbc__parser_8cpp_source_l00148}00148 std::istringstream stream (line);}
|
|
\DoxyCodeLine{\Hypertarget{dbc__parser_8cpp_source_l00149}00149 std::string token;}
|
|
\DoxyCodeLine{\Hypertarget{dbc__parser_8cpp_source_l00150}00150 \mbox{\hyperlink{structFrameInfo}{FrameInfo}} frame;}
|
|
\DoxyCodeLine{\Hypertarget{dbc__parser_8cpp_source_l00151}00151 std::uint32\_t rawCanId = 0U;}
|
|
\DoxyCodeLine{\Hypertarget{dbc__parser_8cpp_source_l00152}00152 }
|
|
\DoxyCodeLine{\Hypertarget{dbc__parser_8cpp_source_l00153}00153 stream >> token;}
|
|
\DoxyCodeLine{\Hypertarget{dbc__parser_8cpp_source_l00154}00154 \textcolor{keywordflow}{if} (token != \textcolor{stringliteral}{"{}BO\_"{}})}
|
|
\DoxyCodeLine{\Hypertarget{dbc__parser_8cpp_source_l00155}00155 \textcolor{keywordflow}{throw} std::runtime\_error (\textcolor{stringliteral}{"{}Invalid frame line: "{}} + line);}
|
|
\DoxyCodeLine{\Hypertarget{dbc__parser_8cpp_source_l00156}00156 }
|
|
\DoxyCodeLine{\Hypertarget{dbc__parser_8cpp_source_l00157}00157 stream >> rawCanId;}
|
|
\DoxyCodeLine{\Hypertarget{dbc__parser_8cpp_source_l00158}00158 \mbox{\hyperlink{classDbcParser_a94d140d9442e4989b5b2ea7662c2debf}{NormalizeCanId}} (rawCanId, frame.\mbox{\hyperlink{structFrameInfo_af470b0742c05bfbffc31c51a68f5c05e}{canId}}, frame.\mbox{\hyperlink{structFrameInfo_a34b726afaad2ac5c697fdb2ac070cdaf}{isExtended}});}
|
|
\DoxyCodeLine{\Hypertarget{dbc__parser_8cpp_source_l00159}00159 }
|
|
\DoxyCodeLine{\Hypertarget{dbc__parser_8cpp_source_l00160}00160 stream >> token;}
|
|
\DoxyCodeLine{\Hypertarget{dbc__parser_8cpp_source_l00161}00161 \textcolor{keywordflow}{if} (token.empty())}
|
|
\DoxyCodeLine{\Hypertarget{dbc__parser_8cpp_source_l00162}00162 \textcolor{keywordflow}{throw} std::runtime\_error (\textcolor{stringliteral}{"{}Missing frame name: "{}} + line);}
|
|
\DoxyCodeLine{\Hypertarget{dbc__parser_8cpp_source_l00163}00163 }
|
|
\DoxyCodeLine{\Hypertarget{dbc__parser_8cpp_source_l00164}00164 \textcolor{keywordflow}{if} (token[token.size() -\/ 1U] == \textcolor{charliteral}{':'})}
|
|
\DoxyCodeLine{\Hypertarget{dbc__parser_8cpp_source_l00165}00165 token.erase (token.size() -\/ 1U, 1U);}
|
|
\DoxyCodeLine{\Hypertarget{dbc__parser_8cpp_source_l00166}00166 }
|
|
\DoxyCodeLine{\Hypertarget{dbc__parser_8cpp_source_l00167}00167 frame.\mbox{\hyperlink{structFrameInfo_abb53a7f93ed7abc0ea1ae4a8ccafcdcb}{name}} = token;}
|
|
\DoxyCodeLine{\Hypertarget{dbc__parser_8cpp_source_l00168}00168 }
|
|
\DoxyCodeLine{\Hypertarget{dbc__parser_8cpp_source_l00169}00169 \{}
|
|
\DoxyCodeLine{\Hypertarget{dbc__parser_8cpp_source_l00170}00170 \textcolor{keywordtype}{unsigned} \textcolor{keywordtype}{int} dlcValue = 0U;}
|
|
\DoxyCodeLine{\Hypertarget{dbc__parser_8cpp_source_l00171}00171 stream >> dlcValue;}
|
|
\DoxyCodeLine{\Hypertarget{dbc__parser_8cpp_source_l00172}00172 frame.\mbox{\hyperlink{structFrameInfo_aa2b198ea0f55e560c123d35e7b3ecab9}{dlc}} = \textcolor{keyword}{static\_cast<}std::uint8\_t\textcolor{keyword}{>} (dlcValue);}
|
|
\DoxyCodeLine{\Hypertarget{dbc__parser_8cpp_source_l00173}00173 \}}
|
|
\DoxyCodeLine{\Hypertarget{dbc__parser_8cpp_source_l00174}00174 }
|
|
\DoxyCodeLine{\Hypertarget{dbc__parser_8cpp_source_l00175}00175 stream >> frame.\mbox{\hyperlink{structFrameInfo_a92749ec3798d4211a505860fb389a9e8}{transmitter}};}
|
|
\DoxyCodeLine{\Hypertarget{dbc__parser_8cpp_source_l00176}00176 frame.\mbox{\hyperlink{structFrameInfo_aee518b33f1000bf0b7f6e4a87474c943}{pgn}} = \mbox{\hyperlink{classDbcParser_a8a7e8fc517e40beab87a8a1dbad2b324}{TryExtractPgn}} (frame.\mbox{\hyperlink{structFrameInfo_af470b0742c05bfbffc31c51a68f5c05e}{canId}}, frame.\mbox{\hyperlink{structFrameInfo_a34b726afaad2ac5c697fdb2ac070cdaf}{isExtended}}, frame.\mbox{\hyperlink{structFrameInfo_a4737a5420213ad4304724e39f3a4e55d}{hasPgn}});}
|
|
\DoxyCodeLine{\Hypertarget{dbc__parser_8cpp_source_l00177}00177 }
|
|
\DoxyCodeLine{\Hypertarget{dbc__parser_8cpp_source_l00178}00178 \textcolor{keywordflow}{return} frame;}
|
|
\DoxyCodeLine{\Hypertarget{dbc__parser_8cpp_source_l00179}00179 \}}
|
|
\DoxyCodeLine{\Hypertarget{dbc__parser_8cpp_source_l00180}00180 }
|
|
\DoxyCodeLine{\Hypertarget{dbc__parser_8cpp_source_l00181}\mbox{\hyperlink{classDbcParser_a4cbce88d08b1f72903ecf1bce41de5d2}{00181}} \mbox{\hyperlink{structSignalInfo}{SignalInfo}} \mbox{\hyperlink{classDbcParser_a4cbce88d08b1f72903ecf1bce41de5d2}{DbcParser::ParseSignalLine}} (\textcolor{keyword}{const} std::string \&line) \{}
|
|
\DoxyCodeLine{\Hypertarget{dbc__parser_8cpp_source_l00182}00182 \textcolor{comment}{/*}}
|
|
\DoxyCodeLine{\Hypertarget{dbc__parser_8cpp_source_l00183}00183 \textcolor{comment}{ * Example:}}
|
|
\DoxyCodeLine{\Hypertarget{dbc__parser_8cpp_source_l00184}00184 \textcolor{comment}{ * SG\_ EngineSpeed : 0|16@1+ (0.125,0) [0|8000] "{}rpm"{} ECU1,ECU2}}
|
|
\DoxyCodeLine{\Hypertarget{dbc__parser_8cpp_source_l00185}00185 \textcolor{comment}{ */}}
|
|
\DoxyCodeLine{\Hypertarget{dbc__parser_8cpp_source_l00186}00186 }
|
|
\DoxyCodeLine{\Hypertarget{dbc__parser_8cpp_source_l00187}00187 \mbox{\hyperlink{structSignalInfo}{SignalInfo}} signal;}
|
|
\DoxyCodeLine{\Hypertarget{dbc__parser_8cpp_source_l00188}00188 }
|
|
\DoxyCodeLine{\Hypertarget{dbc__parser_8cpp_source_l00189}00189 std::string work = \mbox{\hyperlink{namespaceanonymous__namespace_02dbc__parser_8cpp_03_a5850f07ce5f4e5c4f3bf385ebcfcebbb}{TrimText}} (line);}
|
|
\DoxyCodeLine{\Hypertarget{dbc__parser_8cpp_source_l00190}00190 \textcolor{keywordflow}{if} (work.compare (0U, 4U, \textcolor{stringliteral}{"{}SG\_ "{}}) != 0)}
|
|
\DoxyCodeLine{\Hypertarget{dbc__parser_8cpp_source_l00191}00191 \textcolor{keywordflow}{throw} std::runtime\_error (\textcolor{stringliteral}{"{}Invalid signal line: "{}} + line);}
|
|
\DoxyCodeLine{\Hypertarget{dbc__parser_8cpp_source_l00192}00192 }
|
|
\DoxyCodeLine{\Hypertarget{dbc__parser_8cpp_source_l00193}00193 work.erase (0U, 4U);}
|
|
\DoxyCodeLine{\Hypertarget{dbc__parser_8cpp_source_l00194}00194 }
|
|
\DoxyCodeLine{\Hypertarget{dbc__parser_8cpp_source_l00195}00195 \textcolor{keyword}{const} std::string::size\_type colonPos = work.find (\textcolor{charliteral}{':'});}
|
|
\DoxyCodeLine{\Hypertarget{dbc__parser_8cpp_source_l00196}00196 \textcolor{keywordflow}{if} (colonPos == std::string::npos)}
|
|
\DoxyCodeLine{\Hypertarget{dbc__parser_8cpp_source_l00197}00197 \textcolor{keywordflow}{throw} std::runtime\_error (\textcolor{stringliteral}{"{}Signal line missing ':' : "{}} + line);}
|
|
\DoxyCodeLine{\Hypertarget{dbc__parser_8cpp_source_l00198}00198 }
|
|
\DoxyCodeLine{\Hypertarget{dbc__parser_8cpp_source_l00199}00199 signal.\mbox{\hyperlink{structSignalInfo_a379e422a00cad56f896cacf60455b088}{name}} = \mbox{\hyperlink{namespaceanonymous__namespace_02dbc__parser_8cpp_03_a5850f07ce5f4e5c4f3bf385ebcfcebbb}{TrimText}} (work.substr (0U, colonPos));}
|
|
\DoxyCodeLine{\Hypertarget{dbc__parser_8cpp_source_l00200}00200 std::string rest = \mbox{\hyperlink{namespaceanonymous__namespace_02dbc__parser_8cpp_03_a5850f07ce5f4e5c4f3bf385ebcfcebbb}{TrimText}} (work.substr (colonPos + 1U));}
|
|
\DoxyCodeLine{\Hypertarget{dbc__parser_8cpp_source_l00201}00201 }
|
|
\DoxyCodeLine{\Hypertarget{dbc__parser_8cpp_source_l00202}00202 \textcolor{keyword}{const} std::string::size\_type pipePos = rest.find (\textcolor{charliteral}{'|'});}
|
|
\DoxyCodeLine{\Hypertarget{dbc__parser_8cpp_source_l00203}00203 \textcolor{keyword}{const} std::string::size\_type atPos = rest.find (\textcolor{charliteral}{'@'});}
|
|
\DoxyCodeLine{\Hypertarget{dbc__parser_8cpp_source_l00204}00204 \textcolor{keyword}{const} std::string::size\_type signPos = rest.find\_first\_of (\textcolor{stringliteral}{"{}+-\/"{}}, atPos);}
|
|
\DoxyCodeLine{\Hypertarget{dbc__parser_8cpp_source_l00205}00205 \textcolor{keyword}{const} std::string::size\_type factorBegin = rest.find (\textcolor{charliteral}{'('});}
|
|
\DoxyCodeLine{\Hypertarget{dbc__parser_8cpp_source_l00206}00206 \textcolor{keyword}{const} std::string::size\_type factorComma = rest.find (\textcolor{charliteral}{','}, factorBegin);}
|
|
\DoxyCodeLine{\Hypertarget{dbc__parser_8cpp_source_l00207}00207 \textcolor{keyword}{const} std::string::size\_type factorEnd = rest.find (\textcolor{charliteral}{')'}, factorComma);}
|
|
\DoxyCodeLine{\Hypertarget{dbc__parser_8cpp_source_l00208}00208 \textcolor{keyword}{const} std::string::size\_type rangeBegin = rest.find (\textcolor{charliteral}{'['});}
|
|
\DoxyCodeLine{\Hypertarget{dbc__parser_8cpp_source_l00209}00209 \textcolor{keyword}{const} std::string::size\_type rangeSep = rest.find (\textcolor{charliteral}{'|'}, rangeBegin);}
|
|
\DoxyCodeLine{\Hypertarget{dbc__parser_8cpp_source_l00210}00210 \textcolor{keyword}{const} std::string::size\_type rangeEnd = rest.find (\textcolor{charliteral}{']'}, rangeSep);}
|
|
\DoxyCodeLine{\Hypertarget{dbc__parser_8cpp_source_l00211}00211 \textcolor{keyword}{const} std::string::size\_type unitBegin = rest.find (\textcolor{charliteral}{'"{}'}, rangeEnd);}
|
|
\DoxyCodeLine{\Hypertarget{dbc__parser_8cpp_source_l00212}00212 \textcolor{keyword}{const} std::string::size\_type unitEnd = rest.find (\textcolor{charliteral}{'"{}'}, unitBegin + 1U);}
|
|
\DoxyCodeLine{\Hypertarget{dbc__parser_8cpp_source_l00213}00213 }
|
|
\DoxyCodeLine{\Hypertarget{dbc__parser_8cpp_source_l00214}00214 \textcolor{keywordflow}{if} ((pipePos == std::string::npos) ||}
|
|
\DoxyCodeLine{\Hypertarget{dbc__parser_8cpp_source_l00215}00215 (atPos == std::string::npos) ||}
|
|
\DoxyCodeLine{\Hypertarget{dbc__parser_8cpp_source_l00216}00216 (signPos == std::string::npos) ||}
|
|
\DoxyCodeLine{\Hypertarget{dbc__parser_8cpp_source_l00217}00217 (factorBegin == std::string::npos) ||}
|
|
\DoxyCodeLine{\Hypertarget{dbc__parser_8cpp_source_l00218}00218 (factorComma == std::string::npos) ||}
|
|
\DoxyCodeLine{\Hypertarget{dbc__parser_8cpp_source_l00219}00219 (factorEnd == std::string::npos) ||}
|
|
\DoxyCodeLine{\Hypertarget{dbc__parser_8cpp_source_l00220}00220 (rangeBegin == std::string::npos) ||}
|
|
\DoxyCodeLine{\Hypertarget{dbc__parser_8cpp_source_l00221}00221 (rangeSep == std::string::npos) ||}
|
|
\DoxyCodeLine{\Hypertarget{dbc__parser_8cpp_source_l00222}00222 (rangeEnd == std::string::npos) ||}
|
|
\DoxyCodeLine{\Hypertarget{dbc__parser_8cpp_source_l00223}00223 (unitBegin == std::string::npos) ||}
|
|
\DoxyCodeLine{\Hypertarget{dbc__parser_8cpp_source_l00224}00224 (unitEnd == std::string::npos))}
|
|
\DoxyCodeLine{\Hypertarget{dbc__parser_8cpp_source_l00225}00225 \textcolor{keywordflow}{throw} std::runtime\_error (\textcolor{stringliteral}{"{}Unsupported signal syntax: "{}} + line);}
|
|
\DoxyCodeLine{\Hypertarget{dbc__parser_8cpp_source_l00226}00226 }
|
|
\DoxyCodeLine{\Hypertarget{dbc__parser_8cpp_source_l00227}00227 signal.\mbox{\hyperlink{structSignalInfo_ace290724f9801521609aedaa946d61f1}{startBit}} = \textcolor{keyword}{static\_cast<}std::uint32\_t\textcolor{keyword}{>} (}
|
|
\DoxyCodeLine{\Hypertarget{dbc__parser_8cpp_source_l00228}00228 std::stoul (\mbox{\hyperlink{namespaceanonymous__namespace_02dbc__parser_8cpp_03_a5850f07ce5f4e5c4f3bf385ebcfcebbb}{TrimText}} (rest.substr (0U, pipePos)))}
|
|
\DoxyCodeLine{\Hypertarget{dbc__parser_8cpp_source_l00229}00229 );}
|
|
\DoxyCodeLine{\Hypertarget{dbc__parser_8cpp_source_l00230}00230 }
|
|
\DoxyCodeLine{\Hypertarget{dbc__parser_8cpp_source_l00231}00231 signal.\mbox{\hyperlink{structSignalInfo_a1008b5201f71848177217bd52fb84baa}{length}} = \textcolor{keyword}{static\_cast<}std::uint32\_t\textcolor{keyword}{>} (}
|
|
\DoxyCodeLine{\Hypertarget{dbc__parser_8cpp_source_l00232}00232 std::stoul (\mbox{\hyperlink{namespaceanonymous__namespace_02dbc__parser_8cpp_03_a5850f07ce5f4e5c4f3bf385ebcfcebbb}{TrimText}} (rest.substr (pipePos + 1U, atPos -\/ pipePos -\/ 1U)))}
|
|
\DoxyCodeLine{\Hypertarget{dbc__parser_8cpp_source_l00233}00233 );}
|
|
\DoxyCodeLine{\Hypertarget{dbc__parser_8cpp_source_l00234}00234 }
|
|
\DoxyCodeLine{\Hypertarget{dbc__parser_8cpp_source_l00235}00235 \{}
|
|
\DoxyCodeLine{\Hypertarget{dbc__parser_8cpp_source_l00236}00236 \textcolor{keywordflow}{if} ((atPos + 1U) >= rest.size())}
|
|
\DoxyCodeLine{\Hypertarget{dbc__parser_8cpp_source_l00237}00237 \textcolor{keywordflow}{throw} std::runtime\_error (\textcolor{stringliteral}{"{}Invalid endianness in signal: "{}} + line);}
|
|
\DoxyCodeLine{\Hypertarget{dbc__parser_8cpp_source_l00238}00238 }
|
|
\DoxyCodeLine{\Hypertarget{dbc__parser_8cpp_source_l00239}00239 \textcolor{keyword}{const} \textcolor{keywordtype}{char} endianChar = rest[atPos + 1U];}
|
|
\DoxyCodeLine{\Hypertarget{dbc__parser_8cpp_source_l00240}00240 signal.\mbox{\hyperlink{structSignalInfo_af363b1563fb4c7cc8973f9a80c06846c}{isLittleEndian}} = (endianChar == \textcolor{charliteral}{'1'});}
|
|
\DoxyCodeLine{\Hypertarget{dbc__parser_8cpp_source_l00241}00241 \}}
|
|
\DoxyCodeLine{\Hypertarget{dbc__parser_8cpp_source_l00242}00242 }
|
|
\DoxyCodeLine{\Hypertarget{dbc__parser_8cpp_source_l00243}00243 \{}
|
|
\DoxyCodeLine{\Hypertarget{dbc__parser_8cpp_source_l00244}00244 \textcolor{keyword}{const} \textcolor{keywordtype}{char} signChar = rest[signPos];}
|
|
\DoxyCodeLine{\Hypertarget{dbc__parser_8cpp_source_l00245}00245 signal.\mbox{\hyperlink{structSignalInfo_a52a52b320eef92fbcb4626307f9a498f}{isSigned}} = (signChar == \textcolor{charliteral}{'-\/'});}
|
|
\DoxyCodeLine{\Hypertarget{dbc__parser_8cpp_source_l00246}00246 \}}
|
|
\DoxyCodeLine{\Hypertarget{dbc__parser_8cpp_source_l00247}00247 }
|
|
\DoxyCodeLine{\Hypertarget{dbc__parser_8cpp_source_l00248}00248 signal.\mbox{\hyperlink{structSignalInfo_ae4f78d99a2750aa564d7eba860171499}{factor}} = std::stod (}
|
|
\DoxyCodeLine{\Hypertarget{dbc__parser_8cpp_source_l00249}00249 \mbox{\hyperlink{namespaceanonymous__namespace_02dbc__parser_8cpp_03_a5850f07ce5f4e5c4f3bf385ebcfcebbb}{TrimText}} (rest.substr (factorBegin + 1U, factorComma -\/ factorBegin -\/ 1U))}
|
|
\DoxyCodeLine{\Hypertarget{dbc__parser_8cpp_source_l00250}00250 );}
|
|
\DoxyCodeLine{\Hypertarget{dbc__parser_8cpp_source_l00251}00251 }
|
|
\DoxyCodeLine{\Hypertarget{dbc__parser_8cpp_source_l00252}00252 signal.\mbox{\hyperlink{structSignalInfo_ab7d0769f47aa540656b22e4e49db517e}{offset}} = std::stod (}
|
|
\DoxyCodeLine{\Hypertarget{dbc__parser_8cpp_source_l00253}00253 \mbox{\hyperlink{namespaceanonymous__namespace_02dbc__parser_8cpp_03_a5850f07ce5f4e5c4f3bf385ebcfcebbb}{TrimText}} (rest.substr (factorComma + 1U, factorEnd -\/ factorComma -\/ 1U))}
|
|
\DoxyCodeLine{\Hypertarget{dbc__parser_8cpp_source_l00254}00254 );}
|
|
\DoxyCodeLine{\Hypertarget{dbc__parser_8cpp_source_l00255}00255 }
|
|
\DoxyCodeLine{\Hypertarget{dbc__parser_8cpp_source_l00256}00256 signal.\mbox{\hyperlink{structSignalInfo_ada7bf94fbeaa26bd08c73982b5af255b}{minimum}} = std::stod (}
|
|
\DoxyCodeLine{\Hypertarget{dbc__parser_8cpp_source_l00257}00257 \mbox{\hyperlink{namespaceanonymous__namespace_02dbc__parser_8cpp_03_a5850f07ce5f4e5c4f3bf385ebcfcebbb}{TrimText}} (rest.substr (rangeBegin + 1U, rangeSep -\/ rangeBegin -\/ 1U))}
|
|
\DoxyCodeLine{\Hypertarget{dbc__parser_8cpp_source_l00258}00258 );}
|
|
\DoxyCodeLine{\Hypertarget{dbc__parser_8cpp_source_l00259}00259 }
|
|
\DoxyCodeLine{\Hypertarget{dbc__parser_8cpp_source_l00260}00260 signal.\mbox{\hyperlink{structSignalInfo_adf1c4331b9eabced0d7fdda40ff0eb52}{maximum}} = std::stod (}
|
|
\DoxyCodeLine{\Hypertarget{dbc__parser_8cpp_source_l00261}00261 \mbox{\hyperlink{namespaceanonymous__namespace_02dbc__parser_8cpp_03_a5850f07ce5f4e5c4f3bf385ebcfcebbb}{TrimText}} (rest.substr (rangeSep + 1U, rangeEnd -\/ rangeSep -\/ 1U))}
|
|
\DoxyCodeLine{\Hypertarget{dbc__parser_8cpp_source_l00262}00262 );}
|
|
\DoxyCodeLine{\Hypertarget{dbc__parser_8cpp_source_l00263}00263 }
|
|
\DoxyCodeLine{\Hypertarget{dbc__parser_8cpp_source_l00264}00264 signal.\mbox{\hyperlink{structSignalInfo_a1f214f03e94ef5794de2d3367bfcbd01}{unit}} = rest.substr (unitBegin + 1U, unitEnd -\/ unitBegin -\/ 1U);}
|
|
\DoxyCodeLine{\Hypertarget{dbc__parser_8cpp_source_l00265}00265 }
|
|
\DoxyCodeLine{\Hypertarget{dbc__parser_8cpp_source_l00266}00266 \{}
|
|
\DoxyCodeLine{\Hypertarget{dbc__parser_8cpp_source_l00267}00267 \textcolor{keyword}{const} std::string receiversText = \mbox{\hyperlink{namespaceanonymous__namespace_02dbc__parser_8cpp_03_a5850f07ce5f4e5c4f3bf385ebcfcebbb}{TrimText}} (rest.substr (unitEnd + 1U));}
|
|
\DoxyCodeLine{\Hypertarget{dbc__parser_8cpp_source_l00268}00268 signal.\mbox{\hyperlink{structSignalInfo_a2c95562fd0b29327a7fd7b1e6feee7f3}{receivers}} = \mbox{\hyperlink{classDbcParser_a0c1cc3c58f33473bf426a77b7a25c529}{SplitReceivers}} (receiversText);}
|
|
\DoxyCodeLine{\Hypertarget{dbc__parser_8cpp_source_l00269}00269 \}}
|
|
\DoxyCodeLine{\Hypertarget{dbc__parser_8cpp_source_l00270}00270 }
|
|
\DoxyCodeLine{\Hypertarget{dbc__parser_8cpp_source_l00271}00271 \textcolor{keywordflow}{return} signal;}
|
|
\DoxyCodeLine{\Hypertarget{dbc__parser_8cpp_source_l00272}00272 \}}
|
|
\DoxyCodeLine{\Hypertarget{dbc__parser_8cpp_source_l00273}00273 }
|
|
\DoxyCodeLine{\Hypertarget{dbc__parser_8cpp_source_l00274}\mbox{\hyperlink{classDbcParser_aa662b34694fd8b3edd757f36cb064c5c}{00274}} \textcolor{keywordtype}{void} \mbox{\hyperlink{classDbcParser_aa662b34694fd8b3edd757f36cb064c5c}{DbcParser::ParseCommentLine}} (\textcolor{keyword}{const} std::string \&line, \mbox{\hyperlink{structDbcDatabase}{DbcDatabase}} \&database) \{}
|
|
\DoxyCodeLine{\Hypertarget{dbc__parser_8cpp_source_l00275}00275 \textcolor{comment}{/*}}
|
|
\DoxyCodeLine{\Hypertarget{dbc__parser_8cpp_source_l00276}00276 \textcolor{comment}{ * Examples:}}
|
|
\DoxyCodeLine{\Hypertarget{dbc__parser_8cpp_source_l00277}00277 \textcolor{comment}{ * CM\_ BO\_ 256 "{}Frame comment"{};}}
|
|
\DoxyCodeLine{\Hypertarget{dbc__parser_8cpp_source_l00278}00278 \textcolor{comment}{ * CM\_ SG\_ 256 EngineSpeed "{}Signal comment"{};}}
|
|
\DoxyCodeLine{\Hypertarget{dbc__parser_8cpp_source_l00279}00279 \textcolor{comment}{ */}}
|
|
\DoxyCodeLine{\Hypertarget{dbc__parser_8cpp_source_l00280}00280 }
|
|
\DoxyCodeLine{\Hypertarget{dbc__parser_8cpp_source_l00281}00281 std::istringstream stream (line);}
|
|
\DoxyCodeLine{\Hypertarget{dbc__parser_8cpp_source_l00282}00282 std::string token;}
|
|
\DoxyCodeLine{\Hypertarget{dbc__parser_8cpp_source_l00283}00283 stream >> token;}
|
|
\DoxyCodeLine{\Hypertarget{dbc__parser_8cpp_source_l00284}00284 }
|
|
\DoxyCodeLine{\Hypertarget{dbc__parser_8cpp_source_l00285}00285 \textcolor{keywordflow}{if} (token != \textcolor{stringliteral}{"{}CM\_"{}})}
|
|
\DoxyCodeLine{\Hypertarget{dbc__parser_8cpp_source_l00286}00286 \textcolor{keywordflow}{return};}
|
|
\DoxyCodeLine{\Hypertarget{dbc__parser_8cpp_source_l00287}00287 }
|
|
\DoxyCodeLine{\Hypertarget{dbc__parser_8cpp_source_l00288}00288 stream >> token;}
|
|
\DoxyCodeLine{\Hypertarget{dbc__parser_8cpp_source_l00289}00289 }
|
|
\DoxyCodeLine{\Hypertarget{dbc__parser_8cpp_source_l00290}00290 \textcolor{keywordflow}{if} (token == \textcolor{stringliteral}{"{}BO\_"{}}) \{}
|
|
\DoxyCodeLine{\Hypertarget{dbc__parser_8cpp_source_l00291}00291 std::uint32\_t rawCanId = 0U;}
|
|
\DoxyCodeLine{\Hypertarget{dbc__parser_8cpp_source_l00292}00292 std::uint32\_t canId = 0U;}
|
|
\DoxyCodeLine{\Hypertarget{dbc__parser_8cpp_source_l00293}00293 \textcolor{keywordtype}{bool} isExtended = \textcolor{keyword}{false};}
|
|
\DoxyCodeLine{\Hypertarget{dbc__parser_8cpp_source_l00294}00294 }
|
|
\DoxyCodeLine{\Hypertarget{dbc__parser_8cpp_source_l00295}00295 stream >> rawCanId;}
|
|
\DoxyCodeLine{\Hypertarget{dbc__parser_8cpp_source_l00296}00296 \mbox{\hyperlink{classDbcParser_a94d140d9442e4989b5b2ea7662c2debf}{NormalizeCanId}} (rawCanId, canId, isExtended);}
|
|
\DoxyCodeLine{\Hypertarget{dbc__parser_8cpp_source_l00297}00297 }
|
|
\DoxyCodeLine{\Hypertarget{dbc__parser_8cpp_source_l00298}00298 \textcolor{keyword}{const} std::string::size\_type quoteBegin = line.find (\textcolor{charliteral}{'"{}'});}
|
|
\DoxyCodeLine{\Hypertarget{dbc__parser_8cpp_source_l00299}00299 \textcolor{keyword}{const} std::string::size\_type quoteEnd = line.rfind (\textcolor{charliteral}{'"{}'});}
|
|
\DoxyCodeLine{\Hypertarget{dbc__parser_8cpp_source_l00300}00300 }
|
|
\DoxyCodeLine{\Hypertarget{dbc__parser_8cpp_source_l00301}00301 \textcolor{keywordflow}{if} ((quoteBegin == std::string::npos) ||}
|
|
\DoxyCodeLine{\Hypertarget{dbc__parser_8cpp_source_l00302}00302 (quoteEnd == std::string::npos) ||}
|
|
\DoxyCodeLine{\Hypertarget{dbc__parser_8cpp_source_l00303}00303 (quoteEnd <= quoteBegin))}
|
|
\DoxyCodeLine{\Hypertarget{dbc__parser_8cpp_source_l00304}00304 \textcolor{keywordflow}{return};}
|
|
\DoxyCodeLine{\Hypertarget{dbc__parser_8cpp_source_l00305}00305 }
|
|
\DoxyCodeLine{\Hypertarget{dbc__parser_8cpp_source_l00306}00306 \mbox{\hyperlink{structFrameInfo}{FrameInfo}} *frame = \mbox{\hyperlink{classDbcParser_ab1fee32cb845573ce10949b4bec721f9}{FindFrameById}} (database, canId, isExtended);}
|
|
\DoxyCodeLine{\Hypertarget{dbc__parser_8cpp_source_l00307}00307 \textcolor{keywordflow}{if} (frame != \textcolor{keyword}{nullptr})}
|
|
\DoxyCodeLine{\Hypertarget{dbc__parser_8cpp_source_l00308}00308 frame-\/>\mbox{\hyperlink{structFrameInfo_ace75121294f9d89b762080ab5643293c}{comment}} = line.substr (quoteBegin + 1U, quoteEnd -\/ quoteBegin -\/ 1U);}
|
|
\DoxyCodeLine{\Hypertarget{dbc__parser_8cpp_source_l00309}00309 \} \textcolor{keywordflow}{else} \textcolor{keywordflow}{if} (token == \textcolor{stringliteral}{"{}SG\_"{}}) \{}
|
|
\DoxyCodeLine{\Hypertarget{dbc__parser_8cpp_source_l00310}00310 std::uint32\_t rawCanId = 0U;}
|
|
\DoxyCodeLine{\Hypertarget{dbc__parser_8cpp_source_l00311}00311 std::uint32\_t canId = 0U;}
|
|
\DoxyCodeLine{\Hypertarget{dbc__parser_8cpp_source_l00312}00312 \textcolor{keywordtype}{bool} isExtended = \textcolor{keyword}{false};}
|
|
\DoxyCodeLine{\Hypertarget{dbc__parser_8cpp_source_l00313}00313 std::string signalName;}
|
|
\DoxyCodeLine{\Hypertarget{dbc__parser_8cpp_source_l00314}00314 }
|
|
\DoxyCodeLine{\Hypertarget{dbc__parser_8cpp_source_l00315}00315 stream >> rawCanId;}
|
|
\DoxyCodeLine{\Hypertarget{dbc__parser_8cpp_source_l00316}00316 stream >> signalName;}
|
|
\DoxyCodeLine{\Hypertarget{dbc__parser_8cpp_source_l00317}00317 }
|
|
\DoxyCodeLine{\Hypertarget{dbc__parser_8cpp_source_l00318}00318 \mbox{\hyperlink{classDbcParser_a94d140d9442e4989b5b2ea7662c2debf}{NormalizeCanId}} (rawCanId, canId, isExtended);}
|
|
\DoxyCodeLine{\Hypertarget{dbc__parser_8cpp_source_l00319}00319 }
|
|
\DoxyCodeLine{\Hypertarget{dbc__parser_8cpp_source_l00320}00320 \textcolor{keyword}{const} std::string::size\_type quoteBegin = line.find (\textcolor{charliteral}{'"{}'});}
|
|
\DoxyCodeLine{\Hypertarget{dbc__parser_8cpp_source_l00321}00321 \textcolor{keyword}{const} std::string::size\_type quoteEnd = line.rfind (\textcolor{charliteral}{'"{}'});}
|
|
\DoxyCodeLine{\Hypertarget{dbc__parser_8cpp_source_l00322}00322 }
|
|
\DoxyCodeLine{\Hypertarget{dbc__parser_8cpp_source_l00323}00323 \textcolor{keywordflow}{if} ((quoteBegin == std::string::npos) ||}
|
|
\DoxyCodeLine{\Hypertarget{dbc__parser_8cpp_source_l00324}00324 (quoteEnd == std::string::npos) ||}
|
|
\DoxyCodeLine{\Hypertarget{dbc__parser_8cpp_source_l00325}00325 (quoteEnd <= quoteBegin))}
|
|
\DoxyCodeLine{\Hypertarget{dbc__parser_8cpp_source_l00326}00326 \textcolor{keywordflow}{return};}
|
|
\DoxyCodeLine{\Hypertarget{dbc__parser_8cpp_source_l00327}00327 }
|
|
\DoxyCodeLine{\Hypertarget{dbc__parser_8cpp_source_l00328}00328 \mbox{\hyperlink{structFrameInfo}{FrameInfo}} *frame = \mbox{\hyperlink{classDbcParser_ab1fee32cb845573ce10949b4bec721f9}{FindFrameById}} (database, canId, isExtended);}
|
|
\DoxyCodeLine{\Hypertarget{dbc__parser_8cpp_source_l00329}00329 \textcolor{keywordflow}{if} (frame != \textcolor{keyword}{nullptr}) \{}
|
|
\DoxyCodeLine{\Hypertarget{dbc__parser_8cpp_source_l00330}00330 \mbox{\hyperlink{structSignalInfo}{SignalInfo}} *signal = \mbox{\hyperlink{classDbcParser_ab7b95be4433c56cc855bedb08b96a71a}{FindSignalByName}} (*frame, signalName);}
|
|
\DoxyCodeLine{\Hypertarget{dbc__parser_8cpp_source_l00331}00331 \textcolor{keywordflow}{if} (signal != \textcolor{keyword}{nullptr})}
|
|
\DoxyCodeLine{\Hypertarget{dbc__parser_8cpp_source_l00332}00332 signal-\/>\mbox{\hyperlink{structSignalInfo_ac99ba7563a5dad01e39c4257216953f5}{comment}} = line.substr (quoteBegin + 1U, quoteEnd -\/ quoteBegin -\/ 1U);}
|
|
\DoxyCodeLine{\Hypertarget{dbc__parser_8cpp_source_l00333}00333 \}}
|
|
\DoxyCodeLine{\Hypertarget{dbc__parser_8cpp_source_l00334}00334 \}}
|
|
\DoxyCodeLine{\Hypertarget{dbc__parser_8cpp_source_l00335}00335 \}}
|
|
\DoxyCodeLine{\Hypertarget{dbc__parser_8cpp_source_l00336}00336 }
|
|
\DoxyCodeLine{\Hypertarget{dbc__parser_8cpp_source_l00337}\mbox{\hyperlink{classDbcParser_ab1fee32cb845573ce10949b4bec721f9}{00337}} \mbox{\hyperlink{structFrameInfo}{FrameInfo}} *\mbox{\hyperlink{classDbcParser_ab1fee32cb845573ce10949b4bec721f9}{DbcParser::FindFrameById}} (\mbox{\hyperlink{structDbcDatabase}{DbcDatabase}} \&database,}
|
|
\DoxyCodeLine{\Hypertarget{dbc__parser_8cpp_source_l00338}00338 std::uint32\_t canId,}
|
|
\DoxyCodeLine{\Hypertarget{dbc__parser_8cpp_source_l00339}00339 \textcolor{keywordtype}{bool} isExtended) \{}
|
|
\DoxyCodeLine{\Hypertarget{dbc__parser_8cpp_source_l00340}00340 \textcolor{keywordflow}{for} (std::size\_t index = 0U; index < database.\mbox{\hyperlink{structDbcDatabase_a2cade5d0234ee816132127542f8c612b}{frames}}.size(); ++index) \{}
|
|
\DoxyCodeLine{\Hypertarget{dbc__parser_8cpp_source_l00341}00341 \textcolor{keywordflow}{if} ((database.\mbox{\hyperlink{structDbcDatabase_a2cade5d0234ee816132127542f8c612b}{frames}}[index].canId == canId) \&\&}
|
|
\DoxyCodeLine{\Hypertarget{dbc__parser_8cpp_source_l00342}00342 (database.\mbox{\hyperlink{structDbcDatabase_a2cade5d0234ee816132127542f8c612b}{frames}}[index].isExtended == isExtended))}
|
|
\DoxyCodeLine{\Hypertarget{dbc__parser_8cpp_source_l00343}00343 \textcolor{keywordflow}{return} \&database.\mbox{\hyperlink{structDbcDatabase_a2cade5d0234ee816132127542f8c612b}{frames}}[index];}
|
|
\DoxyCodeLine{\Hypertarget{dbc__parser_8cpp_source_l00344}00344 \}}
|
|
\DoxyCodeLine{\Hypertarget{dbc__parser_8cpp_source_l00345}00345 }
|
|
\DoxyCodeLine{\Hypertarget{dbc__parser_8cpp_source_l00346}00346 \textcolor{keywordflow}{return} \textcolor{keyword}{nullptr};}
|
|
\DoxyCodeLine{\Hypertarget{dbc__parser_8cpp_source_l00347}00347 \}}
|
|
\DoxyCodeLine{\Hypertarget{dbc__parser_8cpp_source_l00348}00348 }
|
|
\DoxyCodeLine{\Hypertarget{dbc__parser_8cpp_source_l00349}\mbox{\hyperlink{classDbcParser_ab7b95be4433c56cc855bedb08b96a71a}{00349}} \mbox{\hyperlink{structSignalInfo}{SignalInfo}} *\mbox{\hyperlink{classDbcParser_ab7b95be4433c56cc855bedb08b96a71a}{DbcParser::FindSignalByName}} (\mbox{\hyperlink{structFrameInfo}{FrameInfo}} \&frame, \textcolor{keyword}{const} std::string \&signalName) \{}
|
|
\DoxyCodeLine{\Hypertarget{dbc__parser_8cpp_source_l00350}00350 \textcolor{keywordflow}{for} (std::size\_t index = 0U; index < frame.\mbox{\hyperlink{structFrameInfo_a942937027f1af06536f98cc23b2bf6ce}{signals}}.size(); ++index) \{}
|
|
\DoxyCodeLine{\Hypertarget{dbc__parser_8cpp_source_l00351}00351 \textcolor{keywordflow}{if} (frame.\mbox{\hyperlink{structFrameInfo_a942937027f1af06536f98cc23b2bf6ce}{signals}}[index].name == signalName)}
|
|
\DoxyCodeLine{\Hypertarget{dbc__parser_8cpp_source_l00352}00352 \textcolor{keywordflow}{return} \&frame.\mbox{\hyperlink{structFrameInfo_a942937027f1af06536f98cc23b2bf6ce}{signals}}[index];}
|
|
\DoxyCodeLine{\Hypertarget{dbc__parser_8cpp_source_l00353}00353 \}}
|
|
\DoxyCodeLine{\Hypertarget{dbc__parser_8cpp_source_l00354}00354 }
|
|
\DoxyCodeLine{\Hypertarget{dbc__parser_8cpp_source_l00355}00355 \textcolor{keywordflow}{return} \textcolor{keyword}{nullptr};}
|
|
\DoxyCodeLine{\Hypertarget{dbc__parser_8cpp_source_l00356}00356 \}}
|
|
|
|
\end{DoxyCode}
|