ContRap-Core
|
Class AtomicFunction is the base interface for ContRap atomic functions. More...
#include <function.h>
Public Member Functions | |
AtomicFunction (XMLDataPool *meta_info, SPtr< List > parameters, std::list< Option > &options, const std::string &type, const DPtr &condition=DPtr::bottom) | |
Creates a function from code specifications. | |
std::string | get_name () |
Returns the name of the function. | |
XMLDataPool * | get_meta_info () |
Returns the meta info of the function. | |
const XMLDataPool * | get_meta_info () const |
Returns the meta info of the function. | |
const std::string & | get_hash () const |
Returns the hash of the function. | |
const std::string & | get_key () const |
Returns the key of the function which uniquely identifies the function in ContRap. | |
virtual Type | get_type () const |
Returns the enumerated type of the object. | |
virtual DPtr | execute (SPtr< List > &arguments, SPtr< List > &options, SPtr< Scope > &scope, Engine *engine) const =0 |
Executes the function. | |
const SPtr< List > & | get_parameters () const |
Returns the parameters. | |
const std::list< Option > & | get_options () const |
Returns the options. | |
const std::string & | get_output_type () const |
Returns the output type. | |
const std::string & | get_string_condition () const |
Returns the string value of the condition. | |
const DPtr & | get_condition () const |
Returns the condition. | |
void | set_condition (const std::string &condition) |
Sets the condition as a string. | |
void | parse_values (Engine *engine) |
Parses the defaults and conditions. | |
void | set_loaded (bool status=false) |
Invalidates the function contents. | |
bool | is_loaded () const |
Returns if the function is valid. | |
virtual std::string | to_string () const |
Converts the object to a string. | |
Protected Attributes | |
XMLDataPool * | meta_info |
Meta info of the function. | |
SPtr< List > | parameters |
Function parameters. | |
std::list< Option > | options |
Function options. | |
std::string | type |
Output type. | |
DPtr | condition |
Conditions. | |
std::string | str_condition |
Condition string. | |
std::string | hash |
Hash. | |
bool | loaded |
Validity flag. |
Class AtomicFunction is the base interface for ContRap atomic functions.
crp::AtomicFunction::AtomicFunction | ( | XMLDataPool * | meta_info, |
SPtr< List > | parameters, | ||
std::list< Option > & | options, | ||
const std::string & | type, | ||
const DPtr & | condition = DPtr::bottom |
||
) |
virtual DPtr crp::AtomicFunction::execute | ( | SPtr< List > & | arguments, |
SPtr< List > & | options, | ||
SPtr< Scope > & | scope, | ||
Engine * | engine | ||
) | const [pure virtual] |
Executes the function.
arguments | Arguments list |
scope | Evaluation scope |
engine | Evaluation engine |
Implemented in crp::ExternalFunction, and crp::InternalFunction.
const DPtr& crp::AtomicFunction::get_condition | ( | ) | const [inline] |
Returns the condition.
const std::string& crp::AtomicFunction::get_hash | ( | ) | const [inline] |
Returns the hash of the function.
const std::string& crp::AtomicFunction::get_key | ( | ) | const |
Returns the key of the function which uniquely identifies the function in ContRap.
XMLDataPool* crp::AtomicFunction::get_meta_info | ( | ) | [inline] |
Returns the meta info of the function.
const XMLDataPool* crp::AtomicFunction::get_meta_info | ( | ) | const [inline] |
Returns the meta info of the function.
std::string crp::AtomicFunction::get_name | ( | ) |
Returns the name of the function.
const std::list<Option>& crp::AtomicFunction::get_options | ( | ) | const [inline] |
Returns the options.
const std::string& crp::AtomicFunction::get_output_type | ( | ) | const [inline] |
Returns the output type.
Returns the parameters.
const std::string& crp::AtomicFunction::get_string_condition | ( | ) | const [inline] |
Returns the string value of the condition.
This should not be confused with the application of the to_string() method to the evaluated condition pointer. The condition string is set by the library when it loads the function.
virtual Type crp::AtomicFunction::get_type | ( | ) | const [inline, virtual] |
Returns the enumerated type of the object.
Reimplemented from crp::Object.
bool crp::AtomicFunction::is_loaded | ( | ) | const [inline] |
Returns if the function is valid.
void crp::AtomicFunction::parse_values | ( | Engine * | engine | ) |
Parses the defaults and conditions.
engine | Engine of the evaluation |
void crp::AtomicFunction::set_condition | ( | const std::string & | condition | ) | [inline] |
Sets the condition as a string.
condition | Condition string |
void crp::AtomicFunction::set_loaded | ( | bool | status = false | ) |
Invalidates the function contents.
The function can not be called afterwards.
status | Loaded status of the function |
virtual std::string crp::AtomicFunction::to_string | ( | ) | const [virtual] |
Converts the object to a string.
Reimplemented from crp::Object.
DPtr crp::AtomicFunction::condition [protected] |
Conditions.
std::string crp::AtomicFunction::hash [protected] |
Hash.
bool crp::AtomicFunction::loaded [protected] |
Validity flag.
XMLDataPool* crp::AtomicFunction::meta_info [protected] |
Meta info of the function.
std::list<Option> crp::AtomicFunction::options [protected] |
Function options.
SPtr<List> crp::AtomicFunction::parameters [protected] |
Function parameters.
std::string crp::AtomicFunction::str_condition [protected] |
Condition string.
std::string crp::AtomicFunction::type [protected] |
Output type.