ContRap-Core
Public Member Functions | Protected Attributes

crp::Function Class Reference

Class Function is the main structure for representing polymorphic functions of ContRap. More...

#include <function.h>

Inheritance diagram for crp::Function:
crp::Object

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.

Detailed Description

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.


Constructor & Destructor Documentation

crp::Function::Function ( const SPtr< AtomicFunction > &  function = 0)

Creates a new empty function list.

Parameters:
functionOne function

Member Function Documentation

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.

Parameters:
functionAtomic 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.

Returns:
String representation of the object

Reimplemented from crp::Object.


Field Documentation

std::list<SPtr<AtomicFunction> > crp::Function::functions [protected]

List of atomic functions.


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