This interface allows to load program scripts and state machines and allows execution of code. More...
#include <rtt/ScriptingAccess.hpp>
Public Types | |
typedef std::vector < ProgramInterfacePtr > | Functions |
List of executed functions. | |
Public Member Functions | |
ScriptingAccess (TaskContext *parent) | |
virtual int | execute (const std::string &code) |
Parse and execute a statement. | |
virtual DispatchInterface::shared_ptr | getCommand (int ticket) |
Get the associated command with a given ticket number. | |
virtual Functions | loadFunctions (std::string filename, bool do_throw=false) |
Load and execute a set of functions into the Program Processor for execution. | |
virtual Functions | loadFunctions (std::string code, std::string filename, bool do_throw=false) |
Load and execute a set of functions into the Program Processor for execution. | |
virtual bool | loadPrograms (std::string filename, bool do_throw=false) |
Load a set of programs into the Program Processor for execution. | |
virtual bool | loadPrograms (std::string code, std::string filename, bool do_throw=false) |
Load a set of programs into the Program Processor for execution. | |
virtual bool | unloadProgram (std::string name, bool do_throw=false) |
Unload a program from the Program Processor. | |
virtual std::vector< std::string > | getPrograms () const |
Get a list of the loaded programs. | |
virtual bool | hasProgram (std::string name) const |
Check if a program was loaded. | |
virtual int | getProgramLine (std::string name) const |
Get the current line of execution of a loaded program script. | |
virtual std::string | getProgramText (std::string name) const |
Get the original script description of a loaded program. | |
virtual std::string | getProgramStatus (std::string name) const |
Get the status of the program in a human readable form. | |
virtual bool | loadStateMachines (std::string filename, bool do_throw=false) |
Load a set of state machines into the StateMachineProcessor for execution. | |
virtual bool | loadStateMachines (std::string code, std::string filename, bool do_throw=false) |
Load a set of state machines into the StateMachineProcessor for execution. | |
virtual bool | unloadStateMachine (std::string name, bool do_throw=false) |
Unload a state machine from the StateMachineProcessor. | |
virtual bool | hasStateMachine (std::string name) const |
Check if a state machine was loaded. | |
virtual std::vector< std::string > | getStateMachines () const |
Get a list of the loaded state machines. | |
virtual std::string | getStateMachineText (std::string name) const |
Get the original script description of a loaded state machine. | |
virtual std::string | getStateMachineStatus (std::string name) const |
Get the status of the state machine in a human readable form. | |
virtual int | getStateMachineLine (std::string name) const |
Get the current line of execution of a loaded state machine script. | |
virtual std::string | getCurrentState (std::string name) const |
Get the current state of an activated state machine. | |
Protected Attributes | |
TaskContext * | mparent |
This interface allows to load program scripts and state machines and allows execution of code.
It can be found as the scripting object of a TaskContext.
Definition at line 56 of file ScriptingAccess.hpp.
virtual int RTT::ScriptingAccess::execute | ( | const std::string & | code | ) | [virtual] |
Parse and execute a statement.
code | A single statement to execute. |
-1 | if the code could not be parsed. | |
0 | if the code was an expression and could be executed. | |
>0 | if the code was a command and is being executed. |
virtual DispatchInterface::shared_ptr RTT::ScriptingAccess::getCommand | ( | int | ticket | ) | [virtual] |
Get the associated command with a given ticket number.
ticket | The ticket number returned by execute(). |
virtual std::string RTT::ScriptingAccess::getCurrentState | ( | std::string | name | ) | const [virtual] |
Get the current state of an activated state machine.
name | The name of the state machine |
virtual int RTT::ScriptingAccess::getProgramLine | ( | std::string | name | ) | const [virtual] |
Get the current line of execution of a loaded program script.
name | The name of the program. |
-1 | if the program does not exist. | |
0 | if the program is not running. | |
n | the line number if the program is executing. |
virtual std::vector<std::string> RTT::ScriptingAccess::getPrograms | ( | ) | const [virtual] |
Get a list of the loaded programs.
virtual std::string RTT::ScriptingAccess::getProgramStatus | ( | std::string | name | ) | const [virtual] |
Get the status of the program in a human readable form.
name | The name of the program. |
virtual std::string RTT::ScriptingAccess::getProgramText | ( | std::string | name | ) | const [virtual] |
Get the original script description of a loaded program.
name | The name of the program. |
virtual int RTT::ScriptingAccess::getStateMachineLine | ( | std::string | name | ) | const [virtual] |
Get the current line of execution of a loaded state machine script.
name | The name of the state machine. |
-1 | if the state machine does not exist. | |
0 | if the state machine is not running. | |
n | the line number if the state machine is executing. |
virtual std::vector<std::string> RTT::ScriptingAccess::getStateMachines | ( | ) | const [virtual] |
Get a list of the loaded state machines.
virtual std::string RTT::ScriptingAccess::getStateMachineStatus | ( | std::string | name | ) | const [virtual] |
Get the status of the state machine in a human readable form.
name | The name of the state machine. |
virtual std::string RTT::ScriptingAccess::getStateMachineText | ( | std::string | name | ) | const [virtual] |
Get the original script description of a loaded state machine.
name | The name of the state machine. |
virtual bool RTT::ScriptingAccess::hasProgram | ( | std::string | name | ) | const [virtual] |
Check if a program was loaded.
name | The name of the program. |
virtual bool RTT::ScriptingAccess::hasStateMachine | ( | std::string | name | ) | const [virtual] |
Check if a state machine was loaded.
name | The name of the state machine. |
virtual Functions RTT::ScriptingAccess::loadFunctions | ( | std::string | code, | |
std::string | filename, | |||
bool | do_throw = false | |||
) | [virtual] |
Load and execute a set of functions into the Program Processor for execution.
code | A string containing the function definitions. | |
filename | The file name to use in the error messages. | |
do_throw | Set to yes to cause the parse errors to be thrown instead of being printed to the Logger interface. |
virtual Functions RTT::ScriptingAccess::loadFunctions | ( | std::string | filename, | |
bool | do_throw = false | |||
) | [virtual] |
Load and execute a set of functions into the Program Processor for execution.
filename | The file to load | |
do_throw | Set to yes to cause the parse errors to be thrown instead of being printed to the Logger interface. |
virtual bool RTT::ScriptingAccess::loadPrograms | ( | std::string | code, | |
std::string | filename, | |||
bool | do_throw = false | |||
) | [virtual] |
Load a set of programs into the Program Processor for execution.
The programs are just loaded, not started yet.
code | A string containing the function definitions. | |
filename | The file name to use in the error messages. | |
do_throw | Set to yes to cause the parse errors to be thrown instead of being printed to the Logger interface. |
virtual bool RTT::ScriptingAccess::loadPrograms | ( | std::string | filename, | |
bool | do_throw = false | |||
) | [virtual] |
Load a set of programs into the Program Processor for execution.
The programs are just loaded, not started yet.
filename | The file to load | |
do_throw | Set to yes to cause the parse errors to be thrown instead of being printed to the Logger interface. |
virtual bool RTT::ScriptingAccess::loadStateMachines | ( | std::string | code, | |
std::string | filename, | |||
bool | do_throw = false | |||
) | [virtual] |
Load a set of state machines into the StateMachineProcessor for execution.
The state machines are just loaded, not started yet.
code | A string containing the function definitions. | |
filename | The file name to use in the error messages. | |
do_throw | Set to yes to cause the parse errors to be thrown instead of being printed to the Logger interface. |
virtual bool RTT::ScriptingAccess::loadStateMachines | ( | std::string | filename, | |
bool | do_throw = false | |||
) | [virtual] |
Load a set of state machines into the StateMachineProcessor for execution.
The state machines are just loaded, not started yet.
filename | The file to load | |
do_throw | Set to yes to cause the parse errors to be thrown instead of being printed to the Logger interface. |
virtual bool RTT::ScriptingAccess::unloadProgram | ( | std::string | name, | |
bool | do_throw = false | |||
) | [virtual] |
Unload a program from the Program Processor.
name | The name of the loaded program. | |
do_throw | Set to yes to cause the unloading errors to be thrown instead of being printed to the Logger interface. |
virtual bool RTT::ScriptingAccess::unloadStateMachine | ( | std::string | name, | |
bool | do_throw = false | |||
) | [virtual] |
Unload a state machine from the StateMachineProcessor.
name | The name of the loaded program. | |
do_throw | Set to yes to cause the unloading errors to be thrown instead of being printed to the Logger interface. |