RTT::ScriptingAccess Class Reference

This interface allows to load program scripts and state machines and allows execution of code. More...

#include <rtt/ScriptingAccess.hpp>

List of all members.

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

TaskContextmparent

Detailed Description

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.


Member Function Documentation

virtual int RTT::ScriptingAccess::execute ( const std::string &  code  )  [virtual]

Parse and execute a statement.

Parameters:
code A single statement to execute.
Returns:
A ticket number.
Return values:
-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.
See also:
getCommand
virtual DispatchInterface::shared_ptr RTT::ScriptingAccess::getCommand ( int  ticket  )  [virtual]

Get the associated command with a given ticket number.

Parameters:
ticket The ticket number returned by execute().
Returns:
An object which represents the command.
virtual std::string RTT::ScriptingAccess::getCurrentState ( std::string  name  )  const [virtual]

Get the current state of an activated state machine.

Parameters:
name The name of the state machine
Returns:
The current state.
virtual int RTT::ScriptingAccess::getProgramLine ( std::string  name  )  const [virtual]

Get the current line of execution of a loaded program script.

Parameters:
name The name of the program.
Returns:
The line number.
Return values:
-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.

Returns:
A list of program names.
virtual std::string RTT::ScriptingAccess::getProgramStatus ( std::string  name  )  const [virtual]

Get the status of the program in a human readable form.

Parameters:
name The name of the program.
Returns:
The ProgramInterface::Status as a string.
virtual std::string RTT::ScriptingAccess::getProgramText ( std::string  name  )  const [virtual]

Get the original script description of a loaded program.

Parameters:
name The name of the program.
Returns:
A string containing only that program.
virtual int RTT::ScriptingAccess::getStateMachineLine ( std::string  name  )  const [virtual]

Get the current line of execution of a loaded state machine script.

Parameters:
name The name of the state machine.
Returns:
The line number.
Return values:
-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.

Returns:
A list of state machine names.
virtual std::string RTT::ScriptingAccess::getStateMachineStatus ( std::string  name  )  const [virtual]

Get the status of the state machine in a human readable form.

Parameters:
name The name of the state machine.
Returns:
The State MachineInterface::Status as a string.
virtual std::string RTT::ScriptingAccess::getStateMachineText ( std::string  name  )  const [virtual]

Get the original script description of a loaded state machine.

Parameters:
name The name of the state machine.
Returns:
A string containing only that state machine.
virtual bool RTT::ScriptingAccess::hasProgram ( std::string  name  )  const [virtual]

Check if a program was loaded.

Parameters:
name The name of the program.
Returns:
True if so.
virtual bool RTT::ScriptingAccess::hasStateMachine ( std::string  name  )  const [virtual]

Check if a state machine was loaded.

Parameters:
name The name of the state machine.
Returns:
True if so.
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.

Parameters:
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.
Returns:
A list of functions loaded in the ProgramProcessor.
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.

Parameters:
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.
Returns:
A list of functions loaded in the ProgramProcessor.
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.

Parameters:
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.
Returns:
true if all state machines could be loaded in the ProgramProcessor.
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.

Parameters:
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.
Returns:
true if all state machines could be loaded in the ProgramProcessor.
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.

Parameters:
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.
Returns:
true if all state machines could be loaded in the StateMachineProcessor.
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.

Parameters:
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.
Returns:
true if all state machines could be loaded in the StateMachineProcessor.
virtual bool RTT::ScriptingAccess::unloadProgram ( std::string  name,
bool  do_throw = false 
) [virtual]

Unload a program from the Program Processor.

Parameters:
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.
Returns:
true if it could be unloaded
virtual bool RTT::ScriptingAccess::unloadStateMachine ( std::string  name,
bool  do_throw = false 
) [virtual]

Unload a state machine from the StateMachineProcessor.

Parameters:
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.
Returns:
true if it could be unloaded

The documentation for this class was generated from the following file:
Generated on Thu Dec 23 13:22:44 2010 for Orocos Real-Time Toolkit by  doxygen 1.6.3