Public Types | Public Member Functions | Protected Member Functions

Function Class Reference

Represents a generic function. More...

Inheritance diagram for Function:
Inheritance graph
[legend]

List of all members.

Public Types

enum  Type { TypeInvalid, TypeInfixFunction, TypePredicateFunction, TypePrefixFunction }

Public Member Functions

 Function ()
 Constructs an invalid Function.
Type functionType () const
 Returns the type of the Function.
void setParameters (const ValueChain &parameters)
 Replaces the function parameters with the contents of parameters.
ValueChain parameters () const
 Returns the currently set parameters.

Protected Member Functions

 Function (FunctionData *data)
const FunctionData * data () const
FunctionData * data ()

Detailed Description

Represents a generic function.

The Function class is very versatile in Cubi. It can be used for predicate functions in a projection, as an operator ("=" is an infix function with two parameters), or as a normal function in a FILTER block.

Generally speaking, Function represents a n-ary operator (but it's not as scary as it looks).

The Function class also holds the function parameters' values, that is why apply() also returns a Function. If you have a PrefixFunction f, and call f.apply(2), you get f(2), which is also a function. You could then call PrefixFunction::apply() again with the value 3, and you would get f(2, 3).

You will never use the Function class directly, but rather one of its subclasses.


Member Function Documentation

ValueChain Function::parameters (  )  const

Returns the currently set parameters.

Note that the lib does not do any check on the number of parameters, you just add as many parameters as you want.


The documentation for this class was generated from the following files:
 All Classes Functions Enumerations