A wrapper class for a Tcl interpreter.
More...
#include </home/jenkins/workspace/orxonox_doxygen_trunk/src/libraries/core/command/TclBind.h>
|
| TclBind (const std::string &datapath) |
| Constructor: Initializes the Tcl-interpreter with a given data path. More...
|
|
| ~TclBind () |
| Destructor: Deletes the Tcl-interpreter. More...
|
|
const std::string & | getTclDataPath () const |
| Returns the path to the Orxonox-specific Tcl-files. More...
|
|
Tcl::interpreter * | getTclInterpreter () const |
| Returns the Tcl-interpreter. More...
|
|
void | initializeTclInterpreter () |
| Creates and initializes the Tcl-interpreter by registering all callbacks and defining some useful functions. More...
|
|
void | setDataPath (const std::string &datapath) |
| Defines the path to the directory that contains the Orxonox-specific Tcl-files and initializes the Tcl-interpreter accordingly. More...
|
|
|
static void | bgerror (const std::string &error) |
| Console command and implementation of the Tcl-feature "bgerror" which is called if an error occurred in the background of a Tcl-script. More...
|
|
static Tcl::interpreter * | createTclInterpreter () |
| Creates and initializes a new Tcl-interpreter and calls the Orxonox-specific init.tcl script that defines some special functions which are required by Orxonox. More...
|
|
static std::string | eval (const std::string &tclcode, int *error=nullptr) |
| Executes Tcl-code and returns the return-value. More...
|
|
static std::string | getTclLibraryPath () |
| Returns the path to the Tcl-library (not the Orxonox-specific Tcl-files). More...
|
|
static std::string | tcl (const std::string &tclcode) |
| Console command, executes Tcl code. More...
|
|
static void | tcl_execute (Tcl::object const &args) |
| Callback: Used to send an Orxonox-command from Tcl to the CommandExecutor. More...
|
|
static std::string | tcl_query (Tcl::object const &args) |
| Callback: Used to send an Orxonox-command from Tcl to the CommandExecutor and to send its result back to Tcl. More...
|
|
static bool | exists () |
| Tells whether the singleton has been created. More...
|
|
static TclBind & | getInstance () |
| Returns a reference to the singleton instance. More...
|
|
A wrapper class for a Tcl interpreter.
Used to execute Tcl commands.
TclBind is used to execute Tcl commands, for example if sent to CommandExecutor::execute(). It also defines different callbacks for Tcl, which allows to combine Orxonox-console-commands and Tcl-function without problems.
- See also
- See TclBind.h for more information and an example.
orxonox::TclBind::TclBind |
( |
const std::string & |
datapath | ) |
|
Constructor: Initializes the Tcl-interpreter with a given data path.
- Parameters
-
datapath | Path to the directory that contains the Orxonox-specific Tcl-files |
orxonox::TclBind::~TclBind |
( |
| ) |
|
Destructor: Deletes the Tcl-interpreter.
orxonox::TclBind::TclBind |
( |
const TclBind & |
| ) |
|
|
privatedelete |
void orxonox::TclBind::bgerror |
( |
const std::string & |
error | ) |
|
|
static |
Console command and implementation of the Tcl-feature "bgerror" which is called if an error occurred in the background of a Tcl-script.
Tcl::interpreter * orxonox::TclBind::createTclInterpreter |
( |
| ) |
|
|
static |
Creates and initializes a new Tcl-interpreter and calls the Orxonox-specific init.tcl script that defines some special functions which are required by Orxonox.
std::string orxonox::TclBind::eval |
( |
const std::string & |
tclcode, |
|
|
int * |
error = nullptr |
|
) |
| |
|
static |
Executes Tcl-code and returns the return-value.
- Parameters
-
tclcode | A string that contains Tcl-code |
error | A pointer to an integer (or nullptr) that is used to write an error-code (see CommandExecutor error codes) |
- Returns
- Returns the return-value of the executed code (or an empty string if there's no return-value)
const std::string& orxonox::TclBind::getTclDataPath |
( |
| ) |
const |
|
inline |
Returns the path to the Orxonox-specific Tcl-files.
Tcl::interpreter* orxonox::TclBind::getTclInterpreter |
( |
| ) |
const |
|
inline |
Returns the Tcl-interpreter.
std::string orxonox::TclBind::getTclLibraryPath |
( |
| ) |
|
|
static |
Returns the path to the Tcl-library (not the Orxonox-specific Tcl-files).
void orxonox::TclBind::initializeTclInterpreter |
( |
| ) |
|
Creates and initializes the Tcl-interpreter by registering all callbacks and defining some useful functions.
void orxonox::TclBind::setDataPath |
( |
const std::string & |
datapath | ) |
|
Defines the path to the directory that contains the Orxonox-specific Tcl-files and initializes the Tcl-interpreter accordingly.
std::string orxonox::TclBind::tcl |
( |
const std::string & |
tclcode | ) |
|
|
static |
Console command, executes Tcl code.
Can be used to bind Tcl-commands to a key, because native Tcl-commands can not be evaluated and are thus not supported by the key-binder.
void orxonox::TclBind::tcl_execute |
( |
Tcl::object const & |
args | ) |
|
|
static |
std::string orxonox::TclBind::tcl_helper |
( |
Tcl::object const & |
args, |
|
|
bool |
bQuery |
|
) |
| |
|
staticprivate |
std::string orxonox::TclBind::tcl_query |
( |
Tcl::object const & |
args | ) |
|
|
static |
Callback: Used to send an Orxonox-command from Tcl to the CommandExecutor and to send its result back to Tcl.
bool orxonox::TclBind::bSetTclDataPath_ |
|
private |
Tcl::interpreter* orxonox::TclBind::interpreter_ |
|
private |
The wrapped Tcl interpreter.
TclBind * orxonox::TclBind::singletonPtr_s = nullptr |
|
staticprivate |
std::string orxonox::TclBind::tclDataPath_ |
|
private |
The path to the directory that contains the Orxonox-specific Tcl-files.
The documentation for this class was generated from the following files: