Interpreter Class Reference

Command interface specific to interpreter plug-ins. More...

#include <Interpreter.h>

Inheritance diagram for Interpreter:

Inheritance graph

List of all members.

Public Member Functions

virtual std::string getPrompt () const =0
virtual bool executeCommand (const std::string &command)=0
virtual bool executeScopedCommand (const std::string &command, const Slot &output, const Slot &error, Progress *pProgress)=0
virtual bool isGlobalOutputShown () const =0
virtual void showGlobalOutput (bool newValue)=0

Static Public Member Functions

static const std::string & signalOutputText ()
static const std::string & signalErrorText ()

Protected Member Functions

virtual ~Interpreter ()


Detailed Description

Command interface specific to interpreter plug-ins.

Interpreter implementations implement this interface and this interface is used to execute commands for a given interpreter implementation.

An instance of this class should be retrieved by calling InterpreterManager::getInterpreter() on a InterpreterManager plug-in instance or using InterpreterUtilities::getInterpreter().

Definition at line 32 of file Interpreter.h.


Constructor & Destructor Documentation

virtual Interpreter::~Interpreter (  )  [protected, virtual]

This Interpreter instance is owned by a InterpreterManager instance.

Definition at line 167 of file Interpreter.h.


Member Function Documentation

static const std::string& Interpreter::signalOutputText (  )  [static]

Emitted with boost::any<std::string> with output text generated from executing commands provided to executeCommand().

May also be emitted with output text generated from executing commands provided to executeScopedCommand() if isGlobalOutputShown() returns true.

Definition at line 42 of file Interpreter.h.

static const std::string& Interpreter::signalErrorText (  )  [static]

Emitted with boost::any<std::string> with error text generated from executing commands provided to executeCommand().

May also be emitted with error text generated from executing commands provided to executeScopedCommand() if isGlobalOutputShown() returns true.

Definition at line 51 of file Interpreter.h.

virtual std::string Interpreter::getPrompt (  )  const [pure virtual]

Retrieves the current prompt.

Returns:
The current prompt that will be displayed to the user.

virtual bool Interpreter::executeCommand ( const std::string &  command  )  [pure virtual]

Execute the given command.

Regardless of the return value, future calls can be made to this function. This function blocks and will not return until all provided statements have been executed to completion.

Variables created while executing the command persist after command execution in a global scope. This global scope should persist for an Interpreter instance so that later commands can access variables created during execution of earlier commands. Please read executeScopedCommand() which supports different scoping rules.

Subject Notifications:
Output and error text from executing this command will cause SIGNAL_NAME(Interpreter, OutputText) and SIGNAL_NAME(Interpreter, ErrorText) to be emitted. The output and error text is still valid regardless of the return value of this function.
Parameters:
command The command to execute, this command can be a single statement or multi-statements. The syntax for single statements and multi-statements is defined by the given interpreter implementation.
Returns:
False if there was a syntatic problem with the given command, the interpreter is not running, or an exception. was thrown from the interpreter. True will be returned otherwise.

virtual bool Interpreter::executeScopedCommand ( const std::string &  command,
const Slot output,
const Slot error,
Progress pProgress 
) [pure virtual]

Execute the given command.

Regardless of the return value, future calls can be made to this function. This function blocks and will not return until all provided statements have been executed to completion.

Output and error text from executing this command will be be sent to the provided output and error Slot instances. The output and error text is still valid regardless of the return value of this function.

Variables created while executing the provided command can be created in a nested scope that is closed at command completion causing local variables to be freed. A given interpreter implementation can support this nested scope behavior or can share the global and persistent scope used by executeCommand().

Subject Notifications:
Output and error text from executing this command will cause SIGNAL_NAME(Interpreter, OutputText) and SIGNAL_NAME(Interpreter, ErrorText) to be emitted if isGlobalOutputShown() returns true.
Parameters:
command The command to execute, this command can be a single statement or multi-statements. The syntax for single statements and multi-statements is defined by the given interpreter implementation.
output This Slot will be called as output text is generated from executing this command. The boost::any provided to the slot will contain a std::string with the output text.
error This Slot will be called as error text is generated from executing this command. The boost::any provided to the slot will contain a std::string with the error text.
pProgress If a non-NULL progress is provided, the execution of the provided command may report progress to this instance. A given interpreter implementation is permitted to ignore this parameter. An interpreter will only report progress to this progress instance while executing the provided command.
Returns:
False if there was a syntatic problem with the given command, the interpreter is not running, or an exception. was thrown from the interpreter. True will be returned otherwise.

virtual bool Interpreter::isGlobalOutputShown (  )  const [pure virtual]

Returns the last value provided to showGlobalOutput().

The default value for a given interpreter implementation may be true or false.

Returns:
The last value provided to showGlobalOutput().

virtual void Interpreter::showGlobalOutput ( bool  newValue  )  [pure virtual]

Controls whether output from executeScopedCommand() is emitted from SIGNAL_NAME(Interpreter, OutputText) and SIGNAL_NAME(Interpreter, ErrorText).

Parameters:
newValue A value of true will cause any ouput or error text generated from calling executeScopedCommand() to also be emitted from SIGNAL_NAME(Interpreter, OutputText) and SIGNAL_NAME(Interpreter, ErrorText). A value of false causes output or error text generated from calling executeScopedCommand() to only be sent to the Slot instances passed to executeScopedCommand().


Software Development Kit - Opticks 4.9.0 Build 16218