The CommunicationConfig class parses config files and provides configuration parameters to a Communcation object and creates Command objects as well as SensorGroup objects. More...
#include <communicationconfig.h>
Public Member Functions | |
CommunicationConfig () | |
CommunicationConfig default constructor. More... | |
CommunicationConfig (std::string configPath) | |
CommunicationConfig constructor. More... | |
const std::unordered_map< std::string, std::shared_ptr< Command > > & | getCommands () const |
Command map getter. More... | |
const std::unordered_map< unsigned char, std::shared_ptr< SensorGroup > > & | getSensorGroups () const |
SensorGroup map object getter. More... | |
const std::shared_ptr< SerialInterfaceParams > | getSerialInterfaceParams () const |
SerialInterfaceParams object getter. More... | |
const std::shared_ptr< Syntax > | getSyntax () const |
Syntax object getter. More... | |
Private Member Functions | |
void | insertCommand (const YAML::Node &node) |
Parses Command parameters from a YAML::Node and inserts a new Command object into the Command map. More... | |
void | insertSensorGroup (const YAML::Node &node) |
Parses SensorGroup parameters from a YAML::Node and inserts a new SensorGroup object into the SensorGroup map. More... | |
void | readChannels () |
Parses all Channel defnitions from file. More... | |
void | readCommands () |
Parses all Command definitions from file. More... | |
void | readGeneralSyntax () |
Parses Syntax defnition from file. More... | |
void | readOptions () |
Parses all CommandOptions definitions from file. More... | |
void | readSensorGroups () |
Parses all SensorGroup definitions from file. More... | |
void | readSerialInterfaceConfig () |
Parses serial interface coniguration from file. More... | |
Private Attributes | |
std::unordered_map< std::string, std::shared_ptr< Channel > > | channels |
std::unordered_map< std::string, std::shared_ptr< Command > > | commands |
std::string | configPath |
std::unordered_map< std::string, std::shared_ptr< CommandOptions > > | options |
std::unordered_map< unsigned char, std::shared_ptr< SensorGroup > > | sensorGroups |
SerialInterfaceParams | serialParams |
Syntax | syntax |
Friends | |
void | operator>> (const YAML::Node &node, Syntax &syntax) |
Assing operator for YAML::Node to Syntax object. More... | |
void | operator>> (const YAML::Node &node, SerialInterfaceParams &serialParams) |
Assing operator for YAML::Node to SerialInterfaceParams object. More... | |
void | operator>> (const YAML::Node &node, std::unordered_map< std::string, std::shared_ptr< Channel >> &channels) |
Assing operator for YAML::Node to Channel map object. More... | |
void | operator>> (const YAML::Node &node, std::unordered_map< std::string, std::shared_ptr< CommandOptions >> &options) |
Assing operator for YAML::Node to CommandOptions map object. More... | |
The CommunicationConfig class parses config files and provides configuration parameters to a Communcation object and creates Command objects as well as SensorGroup objects.
To instantiate an object of this class, a valid path to a config folder is required. The folder must contain the following files: channels.yml, command_options.yml, commands.yml, gerneral_syntax.yml, sensor_groups.yml, serial_interface_config.yml
Definition at line 48 of file communicationconfig.h.
CommunicationConfig::CommunicationConfig | ( | ) |
CommunicationConfig default constructor.
Definition at line 9 of file communicationconfig.cpp.
CommunicationConfig::CommunicationConfig | ( | std::string | configPath | ) |
CommunicationConfig constructor.
[in] | configPath | path to the config folder containing all required config files |
std::exception |
Definition at line 11 of file communicationconfig.cpp.
const std::unordered_map< std::string, std::shared_ptr< Command > > & CommunicationConfig::getCommands | ( | ) | const |
Command map getter.
Definition at line 290 of file communicationconfig.cpp.
const std::unordered_map< unsigned char, std::shared_ptr< SensorGroup > > & CommunicationConfig::getSensorGroups | ( | ) | const |
SensorGroup map object getter.
Definition at line 296 of file communicationconfig.cpp.
const std::shared_ptr< SerialInterfaceParams > CommunicationConfig::getSerialInterfaceParams | ( | ) | const |
SerialInterfaceParams object getter.
Definition at line 284 of file communicationconfig.cpp.
const std::shared_ptr< Syntax > CommunicationConfig::getSyntax | ( | ) | const |
Syntax object getter.
Definition at line 279 of file communicationconfig.cpp.
|
private |
|
private |
Parses SensorGroup parameters from a YAML::Node and inserts a new SensorGroup object into the SensorGroup map.
[in] | node | Yaml::Node containing SensorGroup definitions |
std::exception |
Definition at line 170 of file communicationconfig.cpp.
|
private |
Parses all Channel defnitions from file.
std::exception |
Definition at line 239 of file communicationconfig.cpp.
|
private |
Parses all Command definitions from file.
std::exception |
Definition at line 259 of file communicationconfig.cpp.
|
private |
Parses Syntax defnition from file.
std::exception |
Definition at line 233 of file communicationconfig.cpp.
|
private |
Parses all CommandOptions definitions from file.
std::exception |
Definition at line 249 of file communicationconfig.cpp.
|
private |
Parses all SensorGroup definitions from file.
std::exception |
Definition at line 269 of file communicationconfig.cpp.
|
private |
Parses serial interface coniguration from file.
std::exception |
Definition at line 226 of file communicationconfig.cpp.
|
friend |
Assing operator for YAML::Node to Syntax object.
[in] | node | Yaml::Node containing Syntax parameters |
[out] | syntax | Syntax object to be configured by given parameters |
std::exception |
Definition at line 23 of file communicationconfig.cpp.
|
friend |
Assing operator for YAML::Node to SerialInterfaceParams object.
[in] | node | Yaml::Node containing SerialInterfaceParams parameters |
[out] | serialParams | SerialInterfaceParams object to be configured by given parameters |
std::exception |
Definition at line 72 of file communicationconfig.cpp.
|
friend |
Assing operator for YAML::Node to Channel map object.
[in] | node | Yaml::Node containing Channel definitions |
[out] | channels | map of Channel objects to be configured by given definitions |
std::exception |
Definition at line 84 of file communicationconfig.cpp.
|
friend |
Assing operator for YAML::Node to CommandOptions map object.
[in] | node | Yaml::Node containing CommandOptions definitions |
[out] | options | map of CommandOptions objects to be configured by given definitions |
std::exception |
Definition at line 101 of file communicationconfig.cpp.
|
private |
Channel map (first: channel name, second: Channel)
Definition at line 131 of file communicationconfig.h.
|
private |
Command map (first: command name, second: Command)
Definition at line 126 of file communicationconfig.h.
|
private |
Path to configuration folder
Definition at line 124 of file communicationconfig.h.
|
private |
CommandOption map (first: option name, second: CommandOptions)
Definition at line 133 of file communicationconfig.h.
|
private |
SensorGroup map (first: group number, second: SensorGroup)
Definition at line 128 of file communicationconfig.h.
|
private |
Serial communication parameter
Definition at line 136 of file communicationconfig.h.
|
private |
Syntax object
Definition at line 135 of file communicationconfig.h.