Public Member Functions | Private Member Functions | Private Attributes | Friends | List of all members
CommunicationConfig Class Reference

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< SerialInterfaceParamsgetSerialInterfaceParams () const
 SerialInterfaceParams object getter. More...
 
const std::shared_ptr< SyntaxgetSyntax () 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...
 

Detailed Description

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.

Constructor & Destructor Documentation

CommunicationConfig::CommunicationConfig ( )

CommunicationConfig default constructor.

Definition at line 9 of file communicationconfig.cpp.

CommunicationConfig::CommunicationConfig ( std::string  configPath)

CommunicationConfig constructor.

Parameters
[in]configPathpath to the config folder containing all required config files
Exceptions
std::exception

Definition at line 11 of file communicationconfig.cpp.

Member Function Documentation

const std::unordered_map< std::string, std::shared_ptr< Command > > & CommunicationConfig::getCommands ( ) const

Command map getter.

Returns
a shared pointer to the Command map object

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.

Returns
a shared pointer to the SensorGroup map object

Definition at line 296 of file communicationconfig.cpp.

const std::shared_ptr< SerialInterfaceParams > CommunicationConfig::getSerialInterfaceParams ( ) const

SerialInterfaceParams object getter.

Returns
a shared pointer to the SerialInterfaceParams object

Definition at line 284 of file communicationconfig.cpp.

const std::shared_ptr< Syntax > CommunicationConfig::getSyntax ( ) const

Syntax object getter.

Returns
a shared pointer to the Syntax object

Definition at line 279 of file communicationconfig.cpp.

void CommunicationConfig::insertCommand ( const YAML::Node &  node)
private

Parses Command parameters from a YAML::Node and inserts a new Command object into the Command map.

Parameters
[in]nodeYaml::Node containing Command definitions
Exceptions
std::exception

Definition at line 136 of file communicationconfig.cpp.

void CommunicationConfig::insertSensorGroup ( const YAML::Node &  node)
private

Parses SensorGroup parameters from a YAML::Node and inserts a new SensorGroup object into the SensorGroup map.

Parameters
[in]nodeYaml::Node containing SensorGroup definitions
Exceptions
std::exception

Definition at line 170 of file communicationconfig.cpp.

void CommunicationConfig::readChannels ( )
private

Parses all Channel defnitions from file.

Exceptions
std::exception

Definition at line 239 of file communicationconfig.cpp.

void CommunicationConfig::readCommands ( )
private

Parses all Command definitions from file.

Exceptions
std::exception

Definition at line 259 of file communicationconfig.cpp.

void CommunicationConfig::readGeneralSyntax ( )
private

Parses Syntax defnition from file.

Exceptions
std::exception

Definition at line 233 of file communicationconfig.cpp.

void CommunicationConfig::readOptions ( )
private

Parses all CommandOptions definitions from file.

Exceptions
std::exception

Definition at line 249 of file communicationconfig.cpp.

void CommunicationConfig::readSensorGroups ( )
private

Parses all SensorGroup definitions from file.

Exceptions
std::exception

Definition at line 269 of file communicationconfig.cpp.

void CommunicationConfig::readSerialInterfaceConfig ( )
private

Parses serial interface coniguration from file.

Exceptions
std::exception

Definition at line 226 of file communicationconfig.cpp.

Friends And Related Function Documentation

void operator>> ( const YAML::Node &  node,
Syntax syntax 
)
friend

Assing operator for YAML::Node to Syntax object.

Parameters
[in]nodeYaml::Node containing Syntax parameters
[out]syntaxSyntax object to be configured by given parameters
Exceptions
std::exception

Definition at line 23 of file communicationconfig.cpp.

void operator>> ( const YAML::Node &  node,
SerialInterfaceParams serialParams 
)
friend

Assing operator for YAML::Node to SerialInterfaceParams object.

Parameters
[in]nodeYaml::Node containing SerialInterfaceParams parameters
[out]serialParamsSerialInterfaceParams object to be configured by given parameters
Exceptions
std::exception

Definition at line 72 of file communicationconfig.cpp.

void operator>> ( const YAML::Node &  node,
std::unordered_map< std::string, std::shared_ptr< Channel >> &  channels 
)
friend

Assing operator for YAML::Node to Channel map object.

Parameters
[in]nodeYaml::Node containing Channel definitions
[out]channelsmap of Channel objects to be configured by given definitions
Exceptions
std::exception

Definition at line 84 of file communicationconfig.cpp.

void operator>> ( const YAML::Node &  node,
std::unordered_map< std::string, std::shared_ptr< CommandOptions >> &  options 
)
friend

Assing operator for YAML::Node to CommandOptions map object.

Parameters
[in]nodeYaml::Node containing CommandOptions definitions
[out]optionsmap of CommandOptions objects to be configured by given definitions
Exceptions
std::exception

Definition at line 101 of file communicationconfig.cpp.

Member Data Documentation

std::unordered_map<std::string, std::shared_ptr<Channel> > CommunicationConfig::channels
private

Channel map (first: channel name, second: Channel)

Definition at line 131 of file communicationconfig.h.

std::unordered_map<std::string, std::shared_ptr<Command> > CommunicationConfig::commands
private

Command map (first: command name, second: Command)

Definition at line 126 of file communicationconfig.h.

std::string CommunicationConfig::configPath
private

Path to configuration folder

Definition at line 124 of file communicationconfig.h.

std::unordered_map<std::string, std::shared_ptr<CommandOptions> > CommunicationConfig::options
private

CommandOption map (first: option name, second: CommandOptions)

Definition at line 133 of file communicationconfig.h.

std::unordered_map<unsigned char, std::shared_ptr<SensorGroup> > CommunicationConfig::sensorGroups
private

SensorGroup map (first: group number, second: SensorGroup)

Definition at line 128 of file communicationconfig.h.

SerialInterfaceParams CommunicationConfig::serialParams
private

Serial communication parameter

Definition at line 136 of file communicationconfig.h.

Syntax CommunicationConfig::syntax
private

Syntax object

Definition at line 135 of file communicationconfig.h.


The documentation for this class was generated from the following files:


pses_ucbridge
Author(s): Sebastian Ehmes
autogenerated on Sat Oct 28 2017 19:16:13