ContRap-Core
Public Member Functions | Data Fields

crp::Executable Class Reference

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< Scopescope
 Evaluation scope.
Engineengine
 Engine.

Detailed Description

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.


Constructor & Destructor Documentation

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.

Parameters:
expressionExpression to evaluate
scopeEvaluation scope
engineEvaluating engine
crp::Executable::Executable ( const Executable executable) [inline]

Copy constructor.

Parameters:
executableDifferent expression
crp::Executable::~Executable ( ) [inline]

Member Function Documentation

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.

Parameters:
nameName to declare
valueValue 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.

Parameters:
argumentsList 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.

Returns:
True if the command is valid
void crp::Executable::operator= ( const Executable executable) [inline]

Assignment operator.

Parameters:
executableDifferent executable

Field Documentation

Expression to evaluate.

Evaluation scope.


The documentation for this class was generated from the following file: