|
|
||||||
|
faudes::Function Class Referenceabstract Detailed DescriptionA faudes-function hosts parameter values of some faudes type and provides a method to perform an operation on the specified paramters, e.g. the parallel composition on two generators. The class Function is the base for all faudes-functions, which essenitally differ in the operation method. The base class provides an application interface to
Derivates of the base class, that acually implement an operation, are required to cast the parameter values to the corresponding c types and then call the respective c function. To derive a class from Function, one will reimplment three virtual functions:
See IntegerSum in the autogenerated ./include/rtiautoload.h" for a simple example of a derived faudes-function. Technichal note: In contrast to faudes objects (derivates from Type), a faudes-function must be provided a reference to the corresponding FunctionDefinition. This is because a function must be aware of its signature(s). You must not delete the FunctionDefinition object during the lifetime of a faudes-function. Definition at line 720 of file cfl_functions.h.
Constructor & Destructor Documentation◆ Function()
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. Definition at line 567 of file cfl_functions.cpp. ◆ ~Function()
Destructor. Definition at line 734 of file cfl_functions.h. Member Function Documentation◆ AllocateValue()
Definition at line 695 of file cfl_functions.cpp. ◆ AllocateValues()
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. Definition at line 711 of file cfl_functions.cpp. ◆ Definition() [1/2]
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.
Reimplemented in faudes::LuaFunction. Definition at line 584 of file cfl_functions.cpp. ◆ Definition() [2/2]
Get function definition.
Definition at line 600 of file cfl_functions.cpp. ◆ DoExecute()
Executes code of reimplemented method of child class(es). Implemented in faudes::LuaFunction. ◆ DoTypeCast()
template<class T >
Helper: generate typed reference for parameter.
Definition at line 950 of file cfl_functions.h. ◆ DoTypeCheck()
Method to test the type of an assigned parameter with the specified faudes::Signature (i.e. their TypeDefinition label). Note: this method is called by Function::Execute() before actual function execution via DoExecute(). It may be used to perform a dynamic cast in preparation of DoExecute(). The latter is only called, if all types match.
Implemented in faudes::LuaFunction. ◆ DoVariant()
Reimplemented in faudes::LuaFunction. Definition at line 618 of file cfl_functions.cpp. ◆ DoWrite()
Write function-data (typeid-name of arguments) to TokenWriter.
Reimplemented from faudes::Type. Definition at line 781 of file cfl_functions.cpp. ◆ Execute()
Perform operation. Runs a type check and then the actual function.
Definition at line 760 of file cfl_functions.cpp. ◆ FreeValues()
Destruct parameter values. This is a convenience method to delete the assigned paramer values. Definition at line 718 of file cfl_functions.cpp. ◆ New()
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::LuaFunction. ◆ operator=()
Assign configurationdata from other object. Derived classes should implement the operator form for the assignment for each source type which allows for a non-trivial assignment. This includes the particular case were the source and destination types match exactly. In the latter case the DoAssign method should be invoked. In contrast to the Assign function, the operator form must not be reimplemented for missmatched source types: the operator form only accepts sensible source types. This allows for compiletime typeckecking. However, the downside is that when the type is not known at compiletime, configuration is not properly assigned. Re-implementation can be done via the convenience macros FAUDES_TYPE_DECLARATION and FAUDES_TYPE_IMPLEMENTATION.
Definition at line 340 of file cfl_types.cpp. ◆ ParamsSize()
Return number of parameters with current signature.
Definition at line 669 of file cfl_functions.cpp. ◆ ParamValue() [1/2]
Get parameter value. Returns a reference to the parameter value at the specified position.
Definition at line 684 of file cfl_functions.cpp. ◆ ParamValue() [2/2]
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.
Definition at line 674 of file cfl_functions.cpp. ◆ TypeCheck() [1/2]
Perform a type check one parameter value. The type check is based on c type cast and should accept any types derived from the type given in the signature.
Definition at line 728 of file cfl_functions.cpp. ◆ TypeCheck() [2/2]
Perform a type check on the list of current parameter values. The type check is based on c type cast and should accept any types derived from those given in the signature.
Definition at line 746 of file cfl_functions.cpp. ◆ Variant() [1/3]
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.
Definition at line 642 of file cfl_functions.cpp. ◆ Variant() [2/3]
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.
Definition at line 612 of file cfl_functions.cpp. ◆ Variant() [3/3]
Return pointer to assigned faudes::Signature.
Definition at line 662 of file cfl_functions.cpp. ◆ VariantsSize()
Member Data Documentation◆ mParameterValues
Vector of arguments. Definition at line 1027 of file cfl_functions.h. ◆ mVariantIndex
current variant aka signature as index w.r.t. the function definition Definition at line 1024 of file cfl_functions.h. ◆ pFuncDef
corresponding function definition Definition at line 1021 of file cfl_functions.h. The documentation for this class was generated from the following files: libFAUDES 2.32f --- 2024.12.22 --- c++ api documentaion by doxygen |