CommandFileParser Class Reference

Parser implementation that parses command a fileThe current implementation retrieves the list of commands from a file. More...

Inheritance diagram for CommandFileParser:
ICommandParser

Public Member Functions

 CommandFileParser (const std::string &commandFile)
 Constructor. More...
 
virtual void initialize () override
 Initialize parser.
 
virtual void uninitialize () override
 Unitialize parser.
 
virtual std::vector< std::shared_ptr< ICommand > > getCommandList () const override
 Retrieve the list of commands. More...
 
virtual PlayerReturnCode parse () override
 Retrieve the list of commands. More...
 

Detailed Description

Parser implementation that parses command a file

The current implementation retrieves the list of commands from a file.

Author
cgarraud (INRIA)
Date
2016-01-27 Input file format requirements:
  • Command names are defined within brackets [InitCommand] on a single line
  • Each command parameter is defined on a single line below the command name:
    • Single value parameters are defined as: parameterName: value
    • Simple list parameters are defined as: parameterName: {val1,val2,...}
    • Token list parameters are defined as: parameterName: { (token1:val1),(token2:val2) } (no ',' authorized in (token, value) pair)
Todo:
The implementation uses a lot of string utility functions that need more testing
Note
Use of regex would simplify the implementation but boost::regex is not header-only and std::regex not implemented in gcc 4.8

Constructor & Destructor Documentation

CommandFileParser ( const std::string &  commandFile)
explicit

Constructor.

Parameters
[in]commandFilepath to the command file

Member Function Documentation

std::vector< std::shared_ptr< ICommand > > getCommandList ( ) const
overridevirtual

Retrieve the list of commands.

Precondition
This method should be called after the parse() method

Implements ICommandParser.

PlayerReturnCode parse ( )
overridevirtual

Retrieve the list of commands.

Precondition
This method should be called after the initialize() method

Implements ICommandParser.

References OpenViBE::OpeningFileFailure, OpenViBE::ParsingCommandFailure, and OpenViBE::Success.