| |
libFAUDES
Sections
Index
|
faudes::Function Class Reference |
Public Member Functions | |
Function (const FunctionDefinition *fdef) | |
Constructor For the function to be operational, a valid reference to the corresponding FunctionDefinition is required. | |
~Function () | |
Destructor. | |
virtual Function * | New () const =0 |
Construct on heap. | |
void | Definition (const FunctionDefinition *fdef) |
Set function definition. | |
const FunctionDefinition * | Definition (void) const |
Get function definition. | |
int | VariantsSize (void) const |
Return number of variants. | |
void | Variant (int n) |
Set signature from function definition. | |
void | Variant (const std::string &rVariantName) |
Set signature from function definition. | |
const Signature * | Variant () const |
Return pointer to assigned faudes::Signature. | |
int | ParamsSize (void) const |
Return number of parameters with current signature. | |
void | ParamValue (int n, Type *param) |
Set parameter at certain position. | |
Type * | ParamValue (int n) const |
Get parameter value. | |
void | AllocateValues (void) |
Construct parameter values. | |
void | AllocateValue (int i) |
void | FreeValues (void) |
Destruct parameter values. | |
void | TypeCheck (void) |
Perform a type check on the current parameter values. | |
bool | StrictTypeCheck (void) const |
Depreciated / untested. | |
void | Execute (void) |
Perform operation. | |
Protected Member Functions | |
void | Variant (const Signature *pVar) |
Set signature as specified. | |
template<class T> | |
void | DoTypeCast (int n, T *&rTypedRef) |
Helper: generate typed reference for parameter. | |
virtual void | DoTypeCheck ()=0 |
Method to compare types of arguments with arguments of assigned faudes::Signature (i.e. | |
virtual void | DoExecute ()=0 |
Executes code of reimplemented method of child class(es). | |
void | DoWrite (TokenWriter &rTw, const std::string &rLabel="", const Type *pContext=0) const |
Write function-data (typeid-name of arguments) to TokenWriter. | |
Protected Attributes | |
const FunctionDefinition * | pFuncDef |
corresponding function definition | |
const Signature * | pVariant |
current variant aka signature | |
std::vector< Type * > | mParameterValues |
Vector of arguments. |
faudes::Function::Function | ( | const FunctionDefinition * | fdef | ) |
Constructor For the function to be operational, a valid reference to the corresponding FunctionDefinition is required.
The only exception is the prototype function object used in the FunctionDefinition itself.
faudes::Function::~Function | ( | ) | [inline] |
Destructor.
virtual Function* faudes::Function::New | ( | ) | const [pure virtual] |
Construct on heap.
Create a new instance of this function class and return pointer. The new instance will use the same function definition as this instance.
Reimplemented from faudes::Type.
Implemented in faudes::TSimpleFunction1< FTYPE0, CFNCT >, faudes::TSimpleFunction2< FTYPE0, FTYPE1, CFNCT >, faudes::TSimpleFunction3< FTYPE0, FTYPE1, FTYPE2, CFNCT >, and faudes::TNestedFunction< FTYPE, CFNCT >.
void faudes::Function::Definition | ( | const FunctionDefinition * | fdef | ) |
Set function definition.
Normally, functions are provided with a function definition on construction. The only exception are prototype objects used in function definitions themselfs and in the function registry.
fdef | Function definition to set. |
const FunctionDefinition * faudes::Function::Definition | ( | void | ) | const |
int faudes::Function::VariantsSize | ( | void | ) | const |
Return number of variants.
void faudes::Function::Variant | ( | int | n | ) |
Set signature from function definition.
The index n refers this function's FunctionDefinition. An exception is thrown if no such FunctionDefinition is set, as it is the case for prototype instances.
n | Variant index |
Exception |
|
void faudes::Function::Variant | ( | const std::string & | rVariantName | ) |
Set signature from function definition.
The name refers to this function's FunctionDefinition. An exception is thrown if no such FunctionDefinition is set, as it is the case for prototype instances.
rVariantName | Variant name |
Exception |
|
const Signature * faudes::Function::Variant | ( | void | ) | const |
int faudes::Function::ParamsSize | ( | void | ) | const |
Return number of parameters with current signature.
void faudes::Function::ParamValue | ( | int | n, | |
Type * | param | |||
) |
Set parameter at certain position.
Sets the internal refernce of the parameter value at the spcefied index. The ownership of the value remains with the caller, ie it will not be deleted in the destructor of the function object. You may set the parameter value to any faudes type (classes derived from Type). A type check will be performed before the function is executed.
n | Position index of parameter | |
param | Pointer to faudes object. |
Exception |
|
Type * faudes::Function::ParamValue | ( | int | n | ) | const |
Get parameter value.
Returns a reference to the parameter value at the specified position.
n | Position index of parameter. |
Exception |
|
void faudes::Function::AllocateValues | ( | void | ) |
Construct parameter values.
This is a convenience method to allocate faudes objects for parameter values with the type specified by the current signature. Note that the function does not take ownetship of the parameter values and it is the callers responsibility to delete them when no longer required.
void faudes::Function::AllocateValue | ( | int | i | ) |
void faudes::Function::FreeValues | ( | void | ) |
Destruct parameter values.
This is a convenience method to delete the assigned paramer values.
void faudes::Function::TypeCheck | ( | void | ) |
bool faudes::Function::StrictTypeCheck | ( | void | ) | const |
Depreciated / untested.
void faudes::Function::Execute | ( | void | ) |
void faudes::Function::Variant | ( | const Signature * | pVar | ) | [protected] |
Set signature as specified.
This method allows to set any signature. Since the function will only support particular signatures, you should use Variant(int n) whenever possible.
pVar | Pointer to faudes::Signature. |
void faudes::Function::DoTypeCast | ( | int | n, | |
T *& | rTypedRef | |||
) | [inline, protected] |
virtual void faudes::Function::DoTypeCheck | ( | ) | [protected, pure virtual] |
Method to compare types of arguments with arguments of assigned faudes::Signature (i.e.
their TypeDefinition label).
NOTE: Method is called by Function::Execute().
Implemented in faudes::TSimpleFunction1< FTYPE0, CFNCT >, faudes::TSimpleFunction2< FTYPE0, FTYPE1, CFNCT >, faudes::TSimpleFunction3< FTYPE0, FTYPE1, FTYPE2, CFNCT >, and faudes::TNestedFunction< FTYPE, CFNCT >.
virtual void faudes::Function::DoExecute | ( | ) | [protected, pure virtual] |
Executes code of reimplemented method of child class(es).
Implemented in faudes::TSimpleFunction1< FTYPE0, CFNCT >, faudes::TSimpleFunction2< FTYPE0, FTYPE1, CFNCT >, faudes::TSimpleFunction3< FTYPE0, FTYPE1, FTYPE2, CFNCT >, and faudes::TNestedFunction< FTYPE, CFNCT >.
void faudes::Function::DoWrite | ( | TokenWriter & | rTw, | |
const std::string & | rLabel = "" , |
|||
const Type * | pContext = 0 | |||
) | const [protected, virtual] |
Write function-data (typeid-name of arguments) to TokenWriter.
rTw | Reference to Tokenwriter. | |
rLabel | Label of section to write. | |
pContext | Context pointer, ignored |
Exception |
|
Reimplemented from faudes::Type.
const FunctionDefinition* faudes::Function::pFuncDef [protected] |
corresponding function definition
const Signature* faudes::Function::pVariant [protected] |
current variant aka signature
std::vector<Type*> faudes::Function::mParameterValues [protected] |
Vector of arguments.
libFAUDES 2.13a c++ source docu by doxygen 1.5.6