fwConfigs
|
Modules | |
fwDpFunction common functions and variables | |
Files | |
file | fwDpFunction.ctl |
Utility functions | |
Used to access the configuration object attributes (object of type dyn_anytype). | |
fwDpFunction_objectCreateDpeConnection (dyn_mixed &functionObject, dyn_string functionParams, dyn_string functionGlobals, string functionDefinition, dyn_string &exceptionInfo, bool runChecks=true) | |
fwDpFunction_objectExtractDpeConnection (dyn_mixed functionObject, dyn_string &functionParams, dyn_string &functionGlobals, string &functionDefinition, dyn_string &exceptionInfo) | |
bool | fwDpFunction_objectIsDpeConnection (dyn_mixed functionObject) |
Define dpFunctions of type dpe Connection. Please refer also to fwDpFunction common functions and variables. For type statistical, refer to fwDpFunction Statistical.
The fwDpFunctions library makes use of a configuration object. In order to configure a dpe with a dp function, the configuration setting object must be previously initialized with the dp function parameterization (using utility functions). Such object is then passed to the set function that will make the necessary dpSet.
A function of type DPE Connection can be set in the following way: one should declare a configuration object of type dyn_anytype, then fill it with the dpFunction settings using the function fwDpFunction_objectCreateDpeConnection(), then set the setting to the dpe using the function fwDpFunction_objectSet().
Example:
dyn_string exc; string dpe; //func object containing one dpfunc set dyn_mixed dpFuncObject; //dp func parameters dyn_string functionParams; dyn_string functionGlobals; string functionDefinition; //dp function setting: //parameters p1, p2 dynAppend(functionParams,"sys1:dp1.val2:_original.._value"); dynAppend(functionParams,"sys1:dp1.val3:_original.._value"); //global parameters g1, g2 dynAppend(functionGlobals,"sys1:dp1.val4:_original.._value"); dynAppend(functionGlobals,"sys1:dp1.val5:_original.._value"); //the function definition using the parameters functionDefinition = "p1+p2+g1+g2"; //create the func object fwDpFunction_objectCreateDpeConnection( dpFuncObject, functionParams, functionGlobals, functionDefinition, exc); //dpe where to set the dp function dpe = "sys1:dp1.val"; //set the func object to the dpe fwDpFunction_objectSet(dpe, dpFuncObject, exc, true);
A function of type DPE Connection can be retrieved from a dpe in the following way: one should declare a configuration object of type dyn_anytype, then fill it with the dpFunction settings from the dpe using the function fwDpFunction_objectGet(), then extract the settings from the configuration object using the function fwDpFunction_objectExtractDpeConnection().. Before extracting the settings, it is possible to check that the settings are really of type dpeConnection (function fwDpFunction_objectIsDpeConnection()).
Example:
dyn_string exc; string dpe; dyn_mixed dpFuncObject; dyn_string functionParams; dyn_string functionGlobals; string functionDefinition; bool configExists; //dpe containing the dp function dpe = "sys1:dpe1.val"; //get the dp function, store it to the dp function settings object fwDpFunction_objectGet(dpe, configExists, dpFuncObject, exc); //extract the statistical function settings, if it exists if(fwDpFunction_objectIsDpeConnection(dpFuncObject))) fwDpFunction_objectExtractDpeConnection(dpFuncObject, functionParams, functionGlobals, functionDefinition, exc); DebugN( "fwDpFunction_objectGet():", functionParams, functionGlobals, functionDefinition, exc);
Functions of type DPE Connection can be set in batch in the following way: one should declare a configuration object of type dyn_anytype (dpFuncObject). This object will be contained in an array of object (one object per dpe), of type dyn_anytype (call it dpFuncObjects). Each dpFuncObject then must be filled with the function fwDpFunction_objectCreateDpeConnection(), and stored into the array of objects dpFuncObjects. The array of objects is then passed together with the array of dpes to the function fwDpFunction_objectSetMany().
Example: set 2 dp configs into 2 dpes:
dyn_string exc, dpe; //func object containing one dpfunc set dyn_mixed dpFuncObject; //this contains all the func objects dyn_mixed dpFuncObjects; //dp func parameters dyn_string functionParams; dyn_string functionGlobals; string functionDefinition; //dp function settings for dpe1: //parameters p1, p2 dynAppend(functionParams,"sys1:dp1.val2:_original.._value"); dynAppend(functionParams,"sys1:dp1.val3:_original.._value"); //global parameters g1, g2 dynAppend(functionGlobals,"sys1:dp1.val4:_original.._value"); dynAppend(functionGlobals,"sys1:dp1.val5:_original.._value"); //the function definition using the parameters functionDefinition = "p1+p2+g1+g2"; //create the func object fwDpFunction_objectCreateDpeConnection( dpFuncObject, functionParams, functionGlobals, functionDefinition, exc); //add the first func object to the objects array dpFuncObjects[1] = dpFuncObject; //dp function settings for dpe2: //clear temp parameters dynClear(functionParams); dynClear(functionGlobals); dynClear(statTypes); //parameters p1, p2 dynAppend(functionParams,"sys1:dp2.float2:_original.._value"); dynAppend(functionParams,"sys1:dp2.float3:_original.._value"); //global parameters g1, g2 dynAppend(functionGlobals,"sys1:dp2.float4:_original.._value"); dynAppend(functionGlobals,"sys1:dp2.int1:_original.._value"); //the function definition using the parameters functionDefinition = "p1+p2/(g1-g2)"; //create the func object fwDpFunction_objectCreateDpeConnection( dpFuncObject, functionParams, functionGlobals, functionDefinition, exc); //add the second func object to the objects array dpFuncObjects[2] = dpFuncObject; //list of dpes where to set the dp function dpe = makeDynString("sys1:dp1.val", "sys1:dp2.val"); //set the func object array to the dpe array fwDpFunction_objectSetMany(dpe, dpFuncObjects, exc, true);
It is also possible to set many dpes with the same dp function settings. In this case, the array of settings objects must contain one only object, at the index 1. * Example: set the same dp function into 2 dpes:
dyn_string exc, dpe; //func object containing one dpfunc set dyn_mixed dpFuncObject; //this contains all the func objects dyn_mixed dpFuncObjects; //dp func parameters dyn_string functionParams; dyn_string functionGlobals; string functionDefinition; //the dp function settings: //parameters p1, p2 dynAppend(functionParams,"sys1:dp1.val2:_original.._value"); dynAppend(functionParams,"sys1:dp1.val3:_original.._value"); //global parameters g1, g2 dynAppend(functionGlobals,"sys1:dp1.val4:_original.._value"); dynAppend(functionGlobals,"sys1:dp1.val5:_original.._value"); //the function definition using the parameters functionDefinition = "p1+p2+g1+g2"; //create the func object fwDpFunction_objectCreateDpeConnection( dpFuncObject, functionParams, functionGlobals, functionDefinition, exc); //add the first func object to the objects array dpFuncObjects[1] = dpFuncObject; //list of dpes where to set the dp function dpe = makeDynString("sys1:dp1.val", "sys1:dp2.val"); //set the func object to the dpe array fwDpFunction_objectSetMany(dpe, dpFuncObjects, exc, true);
Functions of type DPE Connection can be retrieved in batch. This is more performing than looping into the dpes with the function fwDpFunction_objectGet(). It can be done in the following way: one should declare a configuration object of type dyn_anytype (dpFuncObject). This object will be contained in an array of object (one object per dpe), of type dyn_anytype (call it dpFuncObjects). The array of objects dpFuncObjects then must be filled with the function fwDpFunction_objectGetMany(). The array is the accessed in a loop, getting each element dpFuncObject inside dpFunctionObject. The parameters can be then accessed using fwDpFunction_objectEctractDpeConnection().
Example: get 2 dp configs into 2 dpes:
dyn_string exc; dyn_string dpe; dyn_mixed dpFuncObjects; int i; dyn_string functionParams; dyn_string functionGlobals; string functionDefinition; dyn_bool configExists; //list of dpes makeDynString("sys1:dpe1.val","sys1:dpe2.val"); fwDpFunction_objectGetMany(dpe, configExists, dpFuncObjects, exc); for(i=1 ; i<=dynlen(dpe) ; i++) { if(fwDpFunction_objectIsDpeConnection(dpFuncObject[i])) fwDpFunction_objectExtractDpeConnection(dpFuncObjects[i], functionParams, functionGlobals, functionDefinition, exc); DebugN( "fwDpFunction_objectGetMany():", dpe[i], functionParams, functionGlobals, functionDefinition, exc); }
fwDpFunction_objectCreateDpeConnection | ( | dyn_mixed & | functionObject, |
dyn_string | functionParams, | ||
dyn_string | functionGlobals, | ||
string | functionDefinition, | ||
dyn_string & | exceptionInfo, | ||
bool | runChecks = true |
||
) |
Configures the dp function object with dpe connection parameters See fwDpFunction_objectSet() for an example.
functionObject | This object will contain the dp function parameters. |
functionParams | The list of dp elements to be used as parameters in the dp function. The # of elements must be = to the # of elements in fwDpFunction_OBJ_STAT_TYPE. |
functionGlobals | The list of dp elements to be used as globals in the dp function |
functionDefinition | The dp function is given here (in terms of p's (parameters) and g's (globals)) |
exceptionInfo | Details of any exceptions are returned here |
runChecks | Perform some consistency checks. Optional. Default value = true (recommended) |
References fwDpFunction_OBJ_FUNCTION, fwDpFunction_OBJ_GLOBAL, fwDpFunction_OBJ_PARAM, fwDpFunction_OBJ_TYPE, and fwDpFunction_objectInitialize().
fwDpFunction_objectExtractDpeConnection | ( | dyn_mixed | functionObject, |
dyn_string & | functionParams, | ||
dyn_string & | functionGlobals, | ||
string & | functionDefinition, | ||
dyn_string & | exceptionInfo | ||
) |
Reads the dp function object
functionObject | This object will contain the dp function parameters. |
functionParams | The list of dp elements to be used as parameters in the dp function. |
functionGlobals | The list of dp elements to be used as globals in the dp function |
functionDefinition | The dp function is given here (in terms of p's (parameters) and g's (globals)) |
exceptionInfo | Details of any exceptions are returned here |
References fwDpFunction_OBJ_FUNCTION, fwDpFunction_OBJ_GLOBAL, fwDpFunction_OBJ_PARAM, fwDpFunction_OBJ_TYPE, and fwDpFunction_objectInitialize().
bool fwDpFunction_objectIsDpeConnection | ( | dyn_mixed | functionObject | ) |
Check wether the configuration object contains dpe connection function.
functionObject | This object containing the dp function parameters. |
References fwDpFunction_OBJ_TYPE.