COOLFluiD  Release kernel
COOLFluiD is a Collaborative Simulation Environment (CSE) focused on complex MultiPhysics simulations.
Public Member Functions | Private Types | Private Attributes | List of all members
Interpreter Class Reference

Command Line and script interpreter. More...

#include <Interpreter.hpp>

Public Member Functions

 Interpreter (const commands_description &desc)
 Constructor, taking description of commands. More...
 
 Interpreter (const commands_description &desc, const prompt_function_pointer_t &prompt)
 Constructor taking description of commands and prompt function. More...
 
std::vector< std::string > split_command_line (const std::string &input)
 splits a command_line in words More...
 
void handle_read_line (std::string line)
 function that handles a command-line More...
 
void interpret (std::istream &input_stream)
 Start interpreting an input_stream. More...
 
void interpret (std::istream &input_stream, readline_function_pointer_t f)
 
void interpret (int argc, char *argv[])
 interpret command line style arguments More...
 
void write_prompt ()
 Output the prompt. More...
 
void description (const commands_description &desc)
 
void notify (boost::program_options::variables_map &vm)
 
void alias (const std::string &arg)
 
void interpret_alias (std::vector< std::string > &unrecognized_commands)
 

Private Types

typedef std::string(* prompt_function_pointer_t) ()
 
typedef std::string(* readline_function_pointer_t) (const std::string &line)
 
typedef boost::function< void(std::vector< std::string > &) > unrecognized_commands_handler_t
 

Private Attributes

commands_description m_desc
 
const prompt_function_pointer_t m_prompt
 
std::vector< unrecognized_commands_handler_tm_handle_unrecognized_commands
 
std::deque< std::string > m_history
 
std::map< std::string, std::string > m_alias
 

Detailed Description

Command Line and script interpreter.

Based on boost::program_options. Line by line from a script is interpreted, treating every line as boost::program_options arguments

Author
Willem Deconinck

Definition at line 43 of file Interpreter.hpp.

Member Typedef Documentation

typedef std::string(* prompt_function_pointer_t) ()
private

Definition at line 47 of file Interpreter.hpp.

typedef std::string(* readline_function_pointer_t) (const std::string &line)
private

Definition at line 48 of file Interpreter.hpp.

typedef boost::function< void (std::vector<std::string>&) > unrecognized_commands_handler_t
private

Definition at line 51 of file Interpreter.hpp.

Constructor & Destructor Documentation

Interpreter ( const commands_description desc)

Constructor, taking description of commands.

Definition at line 56 of file Interpreter.cpp.

Interpreter ( const commands_description desc,
const prompt_function_pointer_t prompt 
)

Constructor taking description of commands and prompt function.

Definition at line 67 of file Interpreter.cpp.

Member Function Documentation

void alias ( const std::string &  arg)

Definition at line 115 of file Interpreter.cpp.

void description ( const commands_description desc)

Definition at line 77 of file Interpreter.cpp.

void handle_read_line ( std::string  line)

function that handles a command-line

Definition at line 204 of file Interpreter.cpp.

void interpret ( std::istream &  input_stream)

Start interpreting an input_stream.

Definition at line 413 of file Interpreter.cpp.

void interpret ( std::istream &  input_stream,
readline_function_pointer_t  f 
)

Start interpreting and input_stream, and use a function to modify each line before it gets handled.

Definition at line 438 of file Interpreter.cpp.

void interpret ( int  argc,
char *  argv[] 
)

interpret command line style arguments

Definition at line 270 of file Interpreter.cpp.

void interpret_alias ( std::vector< std::string > &  unrecognized_commands)

Definition at line 94 of file Interpreter.cpp.

void notify ( boost::program_options::variables_map &  vm)

Definition at line 344 of file Interpreter.cpp.

std::vector< std::string > split_command_line ( const std::string &  input)

splits a command_line in words

Definition at line 127 of file Interpreter.cpp.

void write_prompt ( )

Output the prompt.

Definition at line 466 of file Interpreter.cpp.

Member Data Documentation

std::map<std::string,std::string> m_alias
private

Definition at line 94 of file Interpreter.hpp.

commands_description m_desc
private

Definition at line 90 of file Interpreter.hpp.

std::vector<unrecognized_commands_handler_t> m_handle_unrecognized_commands
private

Definition at line 92 of file Interpreter.hpp.

std::deque<std::string> m_history
private

Definition at line 93 of file Interpreter.hpp.

const prompt_function_pointer_t m_prompt
private

Definition at line 91 of file Interpreter.hpp.


The documentation for this class was generated from the following files:
Send comments to:
COOLFluiD Web Admin