ContRap-Core
|
Class Executable composes an expression, an engine and an evaluation scope. More...
#include <engine.h>
Public Member Functions | |
Executable () | |
Empty constructor defines an invalid command. | |
Executable (const DPtr &expression, const SPtr< Scope > &scope, Engine *engine) | |
Creates a new command from components. | |
Executable (const Executable &executable) | |
Copy constructor. | |
~Executable () | |
void | operator= (const Executable &executable) |
Assignment operator. | |
bool | is_valid () const |
Returns true if the command is valid. | |
DPtr | evaluate () const |
Evaluates the expression. | |
DPtr | call (const SPtr< List > &arguments, std::map< std::string, DPtr > &options=Interpreter::empty_options) const |
Calls the expression if the expression is a function. | |
void | assign (const std::string &name, const DPtr &value) |
Assigns a value within the command scope. | |
Data Fields | |
DPtr | expression |
Expression to evaluate. | |
SPtr< Scope > | scope |
Evaluation scope. | |
Engine * | engine |
Engine. |
Class Executable composes an expression, an engine and an evaluation scope.
Instances of the Executable class can be evaluated on their own, since they comprise all necessary information.
crp::Executable::Executable | ( | ) | [inline] |
Empty constructor defines an invalid command.
crp::Executable::Executable | ( | const DPtr & | expression, |
const SPtr< Scope > & | scope, | ||
Engine * | engine | ||
) | [inline] |
Creates a new command from components.
expression | Expression to evaluate |
scope | Evaluation scope |
engine | Evaluating engine |
crp::Executable::Executable | ( | const Executable & | executable | ) | [inline] |
Copy constructor.
executable | Different expression |
crp::Executable::~Executable | ( | ) | [inline] |
void crp::Executable::assign | ( | const std::string & | name, |
const DPtr & | value | ||
) |
Assigns a value within the command scope.
If no value is declared the value is declared locally.
name | Name to declare |
value | Value to declare |
DPtr crp::Executable::call | ( | const SPtr< List > & | arguments, |
std::map< std::string, DPtr > & | options = Interpreter::empty_options |
||
) | const [inline] |
Calls the expression if the expression is a function.
arguments | List of arguments |
DPtr crp::Executable::evaluate | ( | ) | const [inline] |
Evaluates the expression.
bool crp::Executable::is_valid | ( | ) | const [inline] |
Returns true if the command is valid.
void crp::Executable::operator= | ( | const Executable & | executable | ) | [inline] |
Assignment operator.
executable | Different executable |
Expression to evaluate.
Evaluation scope.