ContRap-Core
|
Class Function is the main structure for representing polymorphic functions of ContRap. More...
#include <function.h>
Public Member Functions | |
Function (const SPtr< AtomicFunction > &function=0) | |
Creates a new empty function list. | |
std::string | get_name () |
Faked name. | |
void | add_function (const SPtr< AtomicFunction > &function) |
Adds a new atomic function to the list. | |
const std::list< SPtr < AtomicFunction > > & | get_atomic_functions () const |
Returns the list of atomic functions. | |
virtual std::string | to_string () const |
Converts the object to a string. | |
Protected Attributes | |
std::list< SPtr< AtomicFunction > > | functions |
List of atomic functions. |
Class Function is the main structure for representing polymorphic functions of ContRap.
A function is internally a list of atomic functions. You can add atomic function using the add_function() method.
The insertion order of the functions in the list gives the reverse order of trying the atomic functions when the function is evaluated.
Notice that there may exist invalid (DPtr::bottom) atomic function pointers inside the list obtained by calling the get_atomic_functions() method. This occurs when the library which contains the functions implementation was unloaded. The implementation of Function will try to remove the invalid pointers as fast as possible. Be sure to check the pointers to be valid, when you traverse the atomic function manually.
crp::Function::Function | ( | const SPtr< AtomicFunction > & | function = 0 | ) |
Creates a new empty function list.
function | One function |
void crp::Function::add_function | ( | const SPtr< AtomicFunction > & | function | ) |
Adds a new atomic function to the list.
If you add an atomic function with an interface (hash) which is already inside the function list, the corresponding entry is overwritten. Otherwise a new atomic function is appended to the end of the list.
function | Atomic function to add |
const std::list<SPtr<AtomicFunction> >& crp::Function::get_atomic_functions | ( | ) | const [inline] |
Returns the list of atomic functions.
std::string crp::Function::get_name | ( | ) | [inline] |
Faked name.
virtual std::string crp::Function::to_string | ( | ) | const [virtual] |
Converts the object to a string.
Reimplemented from crp::Object.
std::list<SPtr<AtomicFunction> > crp::Function::functions [protected] |
List of atomic functions.