ContRap-Core
Public Member Functions | Protected Attributes

crp::AtomicFunction Class Reference

Class AtomicFunction is the base interface for ContRap atomic functions. More...

#include <function.h>

Inheritance diagram for crp::AtomicFunction:
crp::Object crp::ExternalFunction crp::InternalFunction

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.
XMLDataPoolget_meta_info ()
 Returns the meta info of the function.
const XMLDataPoolget_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 DPtrget_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

XMLDataPoolmeta_info
 Meta info of the function.
SPtr< Listparameters
 Function parameters.
std::list< Optionoptions
 Function options.
std::string type
 Output type.
DPtr condition
 Conditions.
std::string str_condition
 Condition string.
std::string hash
 Hash.
bool loaded
 Validity flag.

Detailed Description

Class AtomicFunction is the base interface for ContRap atomic functions.


Constructor & Destructor Documentation

crp::AtomicFunction::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.

Parameters:
meta_infoMeta info of the function
parametersFunction parameters
optionsFunction options
typeOutput type
conditionFunction execution condition

Member Function Documentation

virtual DPtr crp::AtomicFunction::execute ( SPtr< List > &  arguments,
SPtr< List > &  options,
SPtr< Scope > &  scope,
Engine engine 
) const [pure virtual]

Executes the function.

Parameters:
argumentsArguments list
scopeEvaluation scope
engineEvaluation engine
Returns:
Result of the evaluation

Implemented in crp::ExternalFunction, and crp::InternalFunction.

const DPtr& crp::AtomicFunction::get_condition ( ) const [inline]

Returns the condition.

Returns:
Conditions
const std::string& crp::AtomicFunction::get_hash ( ) const [inline]

Returns the hash of the function.

Returns:
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.

Returns:
Key of the function
XMLDataPool* crp::AtomicFunction::get_meta_info ( ) [inline]

Returns the meta info of the function.

Returns:
Meta info
const XMLDataPool* crp::AtomicFunction::get_meta_info ( ) const [inline]

Returns the meta info of the function.

Returns:
Meta info
std::string crp::AtomicFunction::get_name ( )

Returns the name of the function.

Returns:
Function name
const std::list<Option>& crp::AtomicFunction::get_options ( ) const [inline]

Returns the options.

Returns:
Parameter list
const std::string& crp::AtomicFunction::get_output_type ( ) const [inline]

Returns the output type.

Returns:
Output type
const SPtr<List>& crp::AtomicFunction::get_parameters ( ) const [inline]

Returns the parameters.

Returns:
Parameter list
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.

Returns:
Conditions
virtual Type crp::AtomicFunction::get_type ( ) const [inline, virtual]

Returns the enumerated type of the object.

Returns:
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.

Parameters:
engineEngine of the evaluation
void crp::AtomicFunction::set_condition ( const std::string &  condition) [inline]

Sets the condition as a string.

Parameters:
conditionCondition string
void crp::AtomicFunction::set_loaded ( bool  status = false)

Invalidates the function contents.

The function can not be called afterwards.

Parameters:
statusLoaded status of the function
virtual std::string crp::AtomicFunction::to_string ( ) const [virtual]

Converts the object to a string.

Returns:
String representation of the object

Reimplemented from crp::Object.


Field Documentation

Conditions.

std::string crp::AtomicFunction::hash [protected]

Hash.

bool crp::AtomicFunction::loaded [protected]

Validity flag.

Meta info of the function.

std::list<Option> crp::AtomicFunction::options [protected]

Function options.

Function parameters.

std::string crp::AtomicFunction::str_condition [protected]

Condition string.

std::string crp::AtomicFunction::type [protected]

Output type.


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