GECKO 1.0
Human-computer interface based on hand gesture recognition
void AppLauncher::configFileParser ( std::string  config_file) [private]

Reads and parses a configuration file containing the commands and values that trigger them.

Parameters:
config_filePath to the configuration file

{

    //-- Clear data:
    _commands_to_launch.clear();
    _values_to_track.clear();

    //-- Open config file
    std::ifstream file(config_file.c_str() );

    if ( !file.is_open() )
    {
        std::cerr << "[AppLauncher] Error opening file: " << config_file << std::endl;
        return;
    }

    while( !file.eof() )
    {
        //-- Read command:
        std::string newCommand;
        file >> newCommand;

        //-- Read value:
        int newValue;
        file >> newValue;

        //-- Save those values:
        _values_to_track.push_back( newValue );

        for( int i = 0; i < newCommand.length(); i++)
            if ( newCommand[i] == '$' )
                newCommand.erase( i, 1);

        _commands_to_launch.push_back(newCommand);

       // std::cout << "[AppLauncher][Debug] Read: " << newCommand << " " << newValue << std::endl;
    }

    file.close();
}
 All Classes Functions Variables