ContRap-Core
|
Class Call is a command which calls a function. More...
#include <call.h>
Public Member Functions | |
Call () | |
Empty constructor. | |
Call (const DPtr &function, const SPtr< List > &arguments=0) | |
Creates a new call statement. | |
Call (const std::string &name, const DPtr &first=DPtr::bottom, const DPtr &second=DPtr::bottom, const DPtr &third=DPtr::bottom) | |
Creates a new call statement. | |
virtual | ~Call () |
Destructur. | |
const std::string & | get_name () const |
Returns the name of the function operator if there is one and an empty string else. | |
const DPtr & | get_operator () const |
Returns the the function operator. | |
SPtr< List > & | get_arguments () |
Returns the arguments list. | |
const SPtr< List > & | get_arguments () const |
Returns the arguments list. | |
std::map< std::string, DPtr > & | get_options () |
Returns the arguments list. | |
const std::map< std::string, DPtr > & | get_options () const |
Returns the arguments list. | |
void | add_argument (const DPtr &argument) |
Adds a new argument. | |
void | add_option (const std::string &name, const DPtr &argument) |
Adds a new argument. | |
virtual CommandType | get_command_type () const |
Returns the enumerated type of the command. | |
virtual std::string | to_string () const |
Converts the object to a non-formatted string. | |
Protected Attributes | |
std::string | name |
Name of the operator (cached) | |
DPtr | function |
Operator object. | |
SPtr< List > | arguments |
Arguments list. | |
std::map< std::string, DPtr > | options |
Options list. |
Class Call is a command which calls a function.
A function call is applied to the function operator given the arguments list. The operator must evaluate to a crp::Function class, crp::AtomicFunction class, or to a crp::Scope. Calls to other objects are ignored by the interpreter resulting in a symbolic expression or an error in the strict mode.
When the call command is evaluated, the operator and the arguments are evaluated first in the current scope. Atomic functions are evaluated directly. A crp::Function is evaluated by checking which suitable atomic function should be called. The crp::Scope instances are treated as constructor scopes for objects. In other words, the interpreter searches within the scope for a function with the same name as the scope and proceeds with it.
crp::Call::Call | ( | ) | [inline] |
Empty constructor.
crp::Call::Call | ( | const std::string & | name, |
const DPtr & | first = DPtr::bottom , |
||
const DPtr & | second = DPtr::bottom , |
||
const DPtr & | third = DPtr::bottom |
||
) |
Creates a new call statement.
name | Name of the operator to call |
first | First argument |
second | First argument |
third | First argument |
virtual crp::Call::~Call | ( | ) | [virtual] |
Destructur.
void crp::Call::add_argument | ( | const DPtr & | argument | ) | [inline] |
Adds a new argument.
argument | Argument |
void crp::Call::add_option | ( | const std::string & | name, |
const DPtr & | argument | ||
) | [inline] |
Adds a new argument.
name | Identifier name |
argument | Argument |
Returns the arguments list.
Returns the arguments list.
virtual CommandType crp::Call::get_command_type | ( | ) | const [inline, virtual] |
const std::string& crp::Call::get_name | ( | ) | const [inline] |
Returns the name of the function operator if there is one and an empty string else.
const DPtr& crp::Call::get_operator | ( | ) | const [inline] |
Returns the the function operator.
std::map<std::string, DPtr>& crp::Call::get_options | ( | ) | [inline] |
Returns the arguments list.
const std::map<std::string, DPtr>& crp::Call::get_options | ( | ) | const [inline] |
Returns the arguments list.
virtual std::string crp::Call::to_string | ( | ) | const [virtual] |
Converts the object to a non-formatted string.
This method is thought to be used for debugging purposes only.
Reimplemented from crp::Command.
SPtr<List> crp::Call::arguments [protected] |
Arguments list.
DPtr crp::Call::function [protected] |
Operator object.
std::string crp::Call::name [protected] |
Name of the operator (cached)
std::map<std::string, DPtr> crp::Call::options [protected] |
Options list.