ContRap-Core
Public Member Functions | Protected Attributes

crp::Call Class Reference

Class Call is a command which calls a function. More...

#include <call.h>

Inheritance diagram for crp::Call:
crp::Command crp::Object

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 DPtrget_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< Listarguments
 Arguments list.
std::map< std::string, DPtroptions
 Options list.

Detailed Description

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.


Constructor & Destructor Documentation

crp::Call::Call ( ) [inline]

Empty constructor.

crp::Call::Call ( const DPtr function,
const SPtr< List > &  arguments = 0 
)

Creates a new call statement.

Parameters:
functionFunction statement
argumentsList of arguments
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.

Parameters:
nameName of the operator to call
firstFirst argument
secondFirst argument
thirdFirst argument
virtual crp::Call::~Call ( ) [virtual]

Destructur.


Member Function Documentation

void crp::Call::add_argument ( const DPtr argument) [inline]

Adds a new argument.

Parameters:
argumentArgument
void crp::Call::add_option ( const std::string &  name,
const DPtr argument 
) [inline]

Adds a new argument.

Parameters:
nameIdentifier name
argumentArgument
const SPtr<List>& crp::Call::get_arguments ( ) const [inline]

Returns the arguments list.

Returns:
List of the arguments
SPtr<List>& crp::Call::get_arguments ( ) [inline]

Returns the arguments list.

Returns:
List of the arguments
virtual CommandType crp::Call::get_command_type ( ) const [inline, virtual]

Returns the enumerated type of the command.

Returns:
Type of the object

Implements crp::Command.

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.

Returns:
Name of the operator if the function is a call to an identifier.
const DPtr& crp::Call::get_operator ( ) const [inline]

Returns the the function operator.

Returns:
Operator of the function
std::map<std::string, DPtr>& crp::Call::get_options ( ) [inline]

Returns the arguments list.

Returns:
List of the arguments
const std::map<std::string, DPtr>& crp::Call::get_options ( ) const [inline]

Returns the arguments list.

Returns:
List of the arguments
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.

Returns:
String representation of the object

Reimplemented from crp::Command.


Field Documentation

Arguments list.

Operator object.

std::string crp::Call::name [protected]

Name of the operator (cached)

std::map<std::string, DPtr> crp::Call::options [protected]

Options list.


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