Class CDbcParser#
Defined in File dbcparser.h
Class Documentation#
-
class CDbcParser#
DBC parser class allowing access to the defined data structures.
Public Functions
-
CDbcParser(bool bNoDefaultDef = false)#
Default constructor.
- Parameters:
bNoDefaultDef – [in] When set, no default definitions should be made.
-
void Parse(CDbcSource &rSource)#
Parse the DBC content. The current content will be concatenated to the already existing content.
- Parameters:
rSource – [in] Reference to the DBC source. The position within the source will be updated.
-
void Clear()#
Clears the DBC information. Allowing new content to be added.
-
const std::vector<CDbcSource> &GetSources() const#
Return a reference to the list of sources.
- Returns:
The reference to the vector containing the sources.
-
const std::vector<std::string> &GetVersions() const#
Get the vector containing the version strings of all parsed DBC sources.
- Returns:
Reference to the vector containing the version strings.
-
bool HasNodeDef(const std::string &rssNodeDefName) const#
Has a node been defined?
- Parameters:
rssNodeDefName – [in] Reference to the string containing the name of the node.
- Returns:
Returns ‘true’ when a node has been defined; ‘false’ otherwise.
-
const std::vector<std::string> GetNodeDefNames() const#
Get the vector containing the node definitions of all parsed DBC sources.
- Returns:
Vector containing the node definition strings.
-
std::pair<SNodeDef, bool> GetNodeDef(const std::string &rssNodeDefName) const#
Get the node definition with the supplied name.
- Parameters:
rssNodeDefName – [in] Reference to the string containing the name of the node.
- Returns:
Pair of the node and a boolean indicating whether the node exists.
-
bool HasValueTable(const std::string &rssName) const#
Is the value table with the supplied name defined?
- Parameters:
rssName – [in] Reference to the table name string.
- Returns:
Returns ‘true’ when the table with the supplied name has been defined; ‘false’ otherwise.
-
bool HasValue(const std::string &rssTableName, uint32_t uiValue) const#
Is the value within the value table with the supplied table name defined?
- Parameters:
rssTableName – [in] Reference to the table name string.
uiValue – [in] Value within the table.
- Returns:
Returns ‘true’ when the value within the table has been defined; ‘false’ otherwise.
-
std::string GetValue(const std::string &rssTableName, uint32_t uiValue) const#
Get the value within the value table with the supplied table name defined?
- Parameters:
rssTableName – [in] Reference to the table name string.
uiValue – [in] Value within the table.
- Returns:
Returns the string when the value within the table has been defined; an empty string otherwise.
-
std::vector<std::string> GetValueTableNames() const#
Get a vector with all the value tables defined.
- Returns:
Vector with value table names.
-
std::pair<std::vector<uint32_t>, bool> GetValues(const std::string &rssTableName) const#
Get a vector with all values for a value table.
- Parameters:
rssTableName – [in] Reference to the table name string.
- Returns:
Pair of a vector with values and a boolean indicating whether the table exists.
-
bool HasMsgDef(const std::string &rssName) const#
Has a message been defined?
- Parameters:
rssName – [in] Reference to the string containing the name of the message.
- Returns:
Returns ‘true’ when a message has been defined; ‘false’ otherwise.
-
bool HasMsgDef(uint32_t uiRawId) const#
Has a message been defined?
- Parameters:
uiRawId – [in] ID of the message (covers both standard and extended ID).
- Returns:
Returns ‘true’ when a message has been defined; ‘false’ otherwise.
-
bool HasMsgDefStdId(uint32_t uiStdId) const#
Has a message been defined (lookup with standard ID)?
- Parameters:
uiStdId – [in] ID of the message (max 11 bits).
- Returns:
Returns ‘true’ when a message has been defined; ‘false’ otherwise.
-
bool HasMsgDefExtId(uint32_t uiExtId) const#
Has a message been defined (lookup with extended ID)?
- Parameters:
uiExtId – [in] ID of the message (max 29 bits).
- Returns:
Returns ‘true’ when a message has been defined; ‘false’ otherwise.
-
std::vector<uint32_t> GetMessageIDs() const#
Get the currently stored message IDs.
- Returns:
Vector containing the raw message IDs (covering both standard and extended IDs).
-
std::pair<SMessageDef, bool> GetMsgDef(const std::string &rssName) const#
Get the message definition.
- Parameters:
rssName – [in] Reference to the string containing the name of the message.
- Returns:
Returns a pair containing the message and a boolean. If the message was found, the boolean is ‘true’; otherwise the boolean was ‘false’ and an empty message was returned.
-
std::pair<SMessageDef, bool> GetMsgDef(uint32_t uiRawId) const#
Get the message definition.
- Parameters:
uiRawId – [in] ID of the message (covers both standard and extended ID).
- Returns:
Returns a pair containing the message and a boolean. If the message was found, the boolean is ‘true’; otherwise the boolean was ‘false’ and an empty message was returned.
-
std::pair<SMessageDef, bool> GetMsgDefStdId(uint32_t uiStdId) const#
Get the message definition (lookup with standard ID)?
- Parameters:
uiStdId – [in] ID of the message (max 11 bits).
- Returns:
Returns a pair containing the message and a boolean. If the message was found, the boolean is ‘true’; otherwise the boolean was ‘false’ and an empty message was returned.
-
std::pair<SMessageDef, bool> GetMsgDefExtId(uint32_t uiExtId) const#
Get the message definition (lookup with extended ID)?
- Parameters:
uiExtId – [in] ID of the message (max 29 bits).
- Returns:
Returns ‘true’ when a message has been defined; ‘false’ otherwise.
-
bool HasSignalDef(const std::string &rssMsgName, const std::string &rssSignalName) const#
Has a signal been defined?
- Parameters:
rssMsgName – [in] Reference to the string containing the name of the message.
rssSignalName – [in] Reference to the string containing the name of the signal.
- Returns:
Returns ‘true’ when a signal has been defined; ‘false’ otherwise.
-
bool HasSignalDef(uint32_t uiRawMsgId, const std::string &rssSignalName) const#
Has a signal been defined?
- Parameters:
uiRawMsgId – [in] ID of the message (covers both standard and extended ID).
rssSignalName – [in] Reference to the string containing the name of the signal.
- Returns:
Returns ‘true’ when a signal has been defined; ‘false’ otherwise.
-
bool HasSignalDefStdId(uint32_t uiStdMsgId, const std::string &rssSignalName) const#
Has a signal been defined?
- Parameters:
uiStdMsgId – [in] ID of the message (max 11 bits).
rssSignalName – [in] Reference to the string containing the name of the signal.
- Returns:
Returns ‘true’ when a signal has been defined; ‘false’ otherwise.
-
bool HasSignalDefExtId(uint32_t uiExtMsgId, const std::string &rssSignalName) const#
Has a signal been defined?
- Parameters:
uiExtMsgId – [in] ID of the message (max 29 bits).
rssSignalName – [in] Reference to the string containing the name of the signal.
- Returns:
Returns ‘true’ when a signal has been defined; ‘false’ otherwise.
-
std::vector<std::string> GetSignalNames(uint32_t uiRawMsgId) const#
Get the currently stored signal names for the supplied message.
- Parameters:
uiRawMsgId – [in] ID of the message (covers both standard and extended ID).
- Returns:
Vector containing the signal names.
-
std::pair<SSignalDef, bool> GetSignalDef(const std::string &rssMsgName, const std::string &rssSignalName) const#
Get the message definition.
- Parameters:
rssMsgName – [in] Reference to the string containing the name of the message.
rssSignalName – [in] Reference to the string containing the name of the signal.
- Returns:
Returns a pair containing the message and a boolean. If the message was found, the boolean is ‘true’; otherwise the boolean was ‘false’ and an empty message was returned.
-
std::pair<SSignalDef, bool> GetSignalDef(uint32_t uiRawMsgId, const std::string &rssSignalName) const#
Get the message definition.
- Parameters:
uiRawMsgId – [in] ID of the message (covers both standard and extended ID).
rssSignalName – [in] Reference to the string containing the name of the signal.
- Returns:
Returns a pair containing the message and a boolean. If the message was found, the boolean is ‘true’; otherwise the boolean was ‘false’ and an empty message was returned.
-
std::pair<SSignalDef, bool> GetSignalDefStdId(uint32_t uiStdMsgId, const std::string &rssSignalName) const#
Get the message definition.
- Parameters:
uiStdMsgId – [in] ID of the message (max 11 bits).
rssSignalName – [in] Reference to the string containing the name of the signal.
- Returns:
Returns a pair containing the message and a boolean. If the message was found, the boolean is ‘true’; otherwise the boolean was ‘false’ and an empty message was returned.
-
std::pair<SSignalDef, bool> GetSignalDefExtId(uint32_t uiExtMsgId, const std::string &rssSignalName) const#
Get the message definition.
- Parameters:
uiExtMsgId – [in] ID of the message (max 29 bits).
rssSignalName – [in] Reference to the string containing the name of the signal.
- Returns:
Returns a pair containing the message and a boolean. If the message was found, the boolean is ‘true’; otherwise the boolean was ‘false’ and an empty message was returned.
-
std::vector<std::string> GetEnvVarNames() const#
Get a vector with the environment variable names.
- Returns:
Vector with name strings.
-
std::pair<SEnvVarDef, bool> GetEnvVarDef(const std::string &rssVarName) const#
Get the environment variable definition.
- Parameters:
rssVarName – [in] Reference to the string containing the name of the environment variable.
- Returns:
Returns a pair containing the variable and a boolean. If the message was found, the boolean is ‘true’; otherwise the boolean is ‘false’ and an empty variable is returned.
-
std::vector<std::string> GetSignalTypeDefNames() const#
Get a vector with the names of the signal type definitions.
- Returns:
Vector with name strings.
-
std::pair<SSignalTypeDef, bool> GetSignalTypeDef(const std::string &rssSignalTypeDefName) const#
Get the signal type definition belonging to the provided definition name.
- Parameters:
rssSignalTypeDefName – [in] Reference to the string containing the name of the signal type definition to return.
- Returns:
Returns a pair containing the signal type definition and a boolean. If the type definition was found, the boolean is ‘true’; otherwise the boolean is ‘false’ and an empty type definition is returned.
-
std::vector<std::string> GetSignalGroupDefNames(uint32_t uiRawMsgId) const#
Get a vector with the names of the signal groups definitions.
- Parameters:
uiRawMsgId – [in] ID of the message (covers both standard and extended ID).
- Returns:
Vector with name strings.
-
std::pair<SSignalGroupDef, bool> GetSignalGroupDef(uint32_t uiRawMsgId, const std::string &rssSignalGroupDefName) const#
Get the signal group definition belonging to the provided name.
- Parameters:
uiRawMsgId – [in] ID of the message (covers both standard and extended ID).
rssSignalGroupDefName – [in] Reference to the string containing the name of the signal group definition to return.
- Returns:
Returns a pair containing the signal group definition and a boolean. If the group definition was found, the boolean is ‘true’; otherwise the boolean is ‘false’ and an empty group definition is returned.
-
const std::vector<std::string> &GetComments() const#
Get the global DBC file comments.
- Returns:
Reference to the vector with comment strings.
-
std::vector<std::string> GetAttributeDefNames() const#
Get a vector with the names of the global attribute definitions.
- Returns:
Vector with name strings.
-
std::pair<SAttributeDef, bool> GetAttributeDef(const std::string &rssAttributeDefName) const#
Get the attribute definition belonging to the provided name.
- Parameters:
rssAttributeDefName – [in] Reference to the string containing the name of the attribute definition to return.
- Returns:
Returns a pair containing the attribute definition and a boolean. If the attribute definition was found, the boolean is ‘true’; otherwise the boolean is ‘false’ and an empty attribute definition is returned.
-
const std::vector<SAttributeValue> &GetAttributes() const#
Get global attributes.
- Returns:
Reference to the vector with attribute values.
Public Static Functions
-
static std::pair<uint32_t, bool> ExtractMsgId(uint32_t uiRawId)#
Get the message ID from a raw ID.
- Parameters:
uiRawId – [in] ID of the message (covers both standard and extended ID).
- Returns:
Returns a pair with the message ID and a boolean indicating whether the ID is extended or not.
-
static uint32_t ComposeRawId(uint32_t uiMsgId, bool bExtended)#
Compose a raw ID from a message ID.
- Parameters:
uiMsgId – [in] The ID of the message.
bExtended – [in] When set, the message ID is an extended ID (29 bits); otherwise it is a standard ID (11 bits).
- Returns:
Returns the raw ID.
-
CDbcParser(bool bNoDefaultDef = false)#