fwConfigurationDB_Recipes.ctl File Reference


Public Functions for Recipe Handling

Naming conventions:
  • operations:
    • load/save From/To Cache/DB
    • extract/apply
    • get Recipes In DB/Cache
    • get/set Description In Cache/DB
  • parameters:
    • recipeObject , recipeObject1, recipeObject2, diffRecipeObject, templateRecipeObject deviceName, deviceList, hierarchyType, recipeName, recipeList

Note that the functions used in version 3.0.X will still be supported in 3.1.X, yet their use is deprecated.

void fwConfigurationDB_loadRecipeFromCache (string recipeName, dyn_string deviceList, string hierarchyType, dyn_dyn_mixed &recipeObject, dyn_string &exceptionInfo, string systemName="")
void fwConfigurationDB_loadRecipeFromDB (string recipeName, dyn_string deviceList, string hierarchyType, dyn_dyn_mixed &recipeObject, dyn_string &exceptionInfo, string systemName="", string topDevice="", time validAt=0)
void fwConfigurationDB_saveRecipeToDB (dyn_dyn_mixed recipeObject, string hierarchyType, string recipeName, dyn_string &exceptionInfo, string versionDescription="", bool autoSaveDevices=FALSE)
void fwConfigurationDB_saveRecipeToCache (dyn_dyn_mixed recipeObject, string hierarchyType, string recipeName, dyn_string &exceptionInfo)
void fwConfigurationDB_saveDiffRecipeToDB (dyn_dyn_mixed recipeObject, string hierarchyType, string recipeName, dyn_string &exceptionInfo, string versionDescription="")
void fwConfigurationDB_extractRecipe (dyn_string deviceList, string hierarchyType, dyn_dyn_mixed &recipeObject, dyn_string &exceptionInfo, string recipeType="")
void fwConfigurationDB_applyRecipe (dyn_dyn_mixed recipeObject, string hierarchyType, dyn_string &exceptionInfo, bool allowApplyRemote=FALSE)
void fwConfigurationDB_getRecipeDescriptionInCache (string recipeName, string &recipeDescription, dyn_string &exceptionInfo)
void fwConfigurationDB_getRecipeDescriptionInDB (string recipeName, string &recipeDescription, dyn_string &exceptionInfo)
void fwConfigurationDB_setRecipeDescriptionInCache (string recipeName, string recipeDescription, dyn_string &exceptionInfo)
void fwConfigurationDB_setRecipeDescriptionInDB (string recipeName, string recipeDescription, dyn_string &exceptionInfo)
void fwConfigurationDB_setRecipeTypeInfoInDB (string recipeName, string recipeTypeName, dyn_string &exceptionInfo)
void fwConfigurationDB_getRecipesInDB (dyn_string &recipeList, dyn_string &exceptionInfo, string deviceName="")
void fwConfigurationDB_getRecipesInCache (dyn_string &recipeList, dyn_string &exceptionInfo, string deviceName="", string system="")
void fwConfigurationDB_getRecipeMetaInfoInCache (string recipeName, dyn_string &exceptionInfo, string &hierarchyType, string &recipeComment, string &recipeType)
void fwConfigurationDB_getRecipeMetaInfoInDB (string recipeName, dyn_string &exceptionInfo, string &hierarchyType, string &recipeComment, string &recipeType)
int fwConfigurationDB_findRecipesInCache (dyn_string &recipeNames, dyn_string &exceptionInfo, string recipeName="*", string hierarchyType="*", string recipeComment="*", string recipeType="*", string deviceName="*")
int fwConfigurationDB_findRecipesInDB (dyn_string &recipeNames, dyn_string &exceptionInfo, string recipeName="*", string hierarchyType="", string recipeComment="*", string recipeType="*", string deviceName="*")
bool fwConfigurationDB_editRecipe (dyn_dyn_mixed &recipeObject, bool readOnly=FALSE, string description="")
void fwConfigurationDB_makeRecipeFromTemplate (dyn_string deviceNames, string hierarchyType, dyn_dyn_mixed templRecipeObject, dyn_dyn_mixed &recipeObject, dyn_string &exceptionInfo)
void fwConfigurationDB_setRecipeType (string recipeType, dyn_string &exceptionInfo, string systemName="")
void fwConfigurationDB_combineRecipes (dyn_dyn_mixed &dstRecipeObject, dyn_dyn_mixed srcRecipeObject1, dyn_dyn_mixed srcRecipeObject2, dyn_string &exceptionInfo, string mergeMode="")

Error Codes in Recipes package

see also Error Codes overview module.

const int fwConfigurationDB_ERROR_CantLoadPartOfRecipeType = -51
const int fwConfigurationDB_ERROR_NoValuesDataInRT = -52
const int fwConfigurationDB_ERROR_NoAlertsDataInRT = -53
const int fwConfigurationDB_ERROR_NoRecipeType = -103
const int fwConfigurationDB_ERROR_CantLoadRecipeType = -104
const int fwConfigurationDB_ERROR_InvalidDataPointName = -105
const int fwConfigurationDB_ERROR_StoreRecipeDataToCache = -106
const int fwConfigurationDB_ERROR_NoRecipeCache = -107
const int fwConfigurationDB_ERROR_GetRecipeFromCache = -108
const int fwConfigurationDB_ERROR_CreateRecipeCache = -109
const int fwConfigurationDB_ERROR_RecipeCacheExists = -110
const int fwConfigurationDB_ERROR_DPENotInRecipe = -111

Indexing constants for recipeObject variables

The following constants are used to refer to the data in a single row of a recipeObject variable (a recipeRow).

const int fwConfigurationDB_RO_DPE_NAME = 1
const int fwConfigurationDB_RO_DP_NAME = 2
const int fwConfigurationDB_RO_DP_TYPE = 3
const int fwConfigurationDB_RO_ELEMENT_NAME = 4
const int fwConfigurationDB_RO_ELEMENT_TYPE = 5
const int fwConfigurationDB_RO_HIERARCHY = 6
const int fwConfigurationDB_RO_HAS_VALUE = 7
const int fwConfigurationDB_RO_HAS_ALERT = 8
const int fwConfigurationDB_RO_VALUE = 9
const int fwConfigurationDB_RO_ALERT_ACTIVE = 10
const int fwConfigurationDB_RO_ALERT_TEXTS = 11
const int fwConfigurationDB_RO_ALERT_LIMITS = 12
const int fwConfigurationDB_RO_ALERT_CLASSES = 13
const int fwConfigurationDB_RO_ALERT_TYPE = 14
const int fwConfigurationDB_RO_ALERT_MINIDX = 10
const int fwConfigurationDB_RO_ALERT_MAXIDX = 14
const int fwConfigurationDB_RO_REC_VERSIONID = 15
const int fwConfigurationDB_RO_RECDATA_PROPID = 16
const int fwConfigurationDB_RO_DATECREATED = 17
const int fwConfigurationDB_RO_MAXIDX = 17
const int fwConfigurationDB_RO_METAINFO_START = 18
const int fwConfigurationDB_RO_META_ORIGNAME = 18
const int fwConfigurationDB_RO_META_COMMENT = 19
const int fwConfigurationDB_RO_META_RECIPETYPE = 20
const int fwConfigurationDB_RO_METAINFO_END = 20

Functions

void fwConfigurationDB_GetRecipeFromSystem (dyn_dyn_mixed &recipeObject, dyn_string deviceList, string hierarchyType, dyn_string &exceptionInfo)
void fwConfigurationDB_ApplyRecipe (dyn_dyn_mixed recipeObject, string hierarchyType, dyn_string &exceptionInfo, bool allowApplyRemote=FALSE)
string fwConfigurationDB_createRecipeCache (string recipeName, dyn_string &exceptionInfo, string recipeComment="", string hierarchyType="")
void fwConfigurationDB_storeRecipeInCache (dyn_dyn_mixed recipeObject, string cacheName, string hierarchyType, dyn_string &exceptionInfo)
void fwConfigurationDB_getRecipeFromCache (string cacheName, dyn_string deviceList, string hierarchyType, dyn_dyn_mixed &recipeObject, dyn_string &exceptionInfo, string systemName="")
void fwConfigurationDB_storeDiffRecipeInDB (dyn_dyn_mixed recipeObject, string hierarchyType, string versionDescription, dyn_string &exceptionInfo, string tag, string system="")
void fwConfigurationDB_storeRecipeInDB (dyn_dyn_mixed recipeObject, string hierarchyType, string versionDescription, dyn_string &exceptionInfo, string tag)
void _fwConfigurationDB_storeRecipeInDB (dyn_dyn_mixed recipeObject, string recipeName, string versionDescription, dyn_string &exceptionInfo)
void fwConfigurationDB_getRecipeFromDB (string topDevice, dyn_string deviceList, string hierarchyType, string tag, dyn_dyn_mixed &recipeObject, dyn_string &exceptionInfo, string system="", time validAt=0)
void _fwConfigurationDB_getRecipeMetaInformationFromDB (string recipeName, string hierarchyType, dyn_dyn_mixed &recipeObject, dyn_string &exceptionInfo)
void _fwConfigurationDB_getRecipeDataFromDB (string topDevice, dyn_string deviceList, string hierarchyType, string recipeName, dyn_dyn_mixed &dbRecipeObject, dyn_string &exceptionInfo, string system, dyn_int &prop_ids, time validAt=0)
dyn_string fwConfigurationDB_getRTValues (string dataPointType, dyn_string &exceptionInfo)
dyn_string fwConfigurationDB_getRTAlerts (string dataPointType, dyn_string &exceptionInfo)
bool _fwConfigurationDB_HandleMissingRT (string dataPoint, string dpType, dyn_string &exceptionInfo)
void _fwConfigurationDB_recipeObjectToAlertObject (dyn_mixed recipeObject, string dpe, dyn_dyn_anytype &alertObject, dyn_string &exceptionInfo)
void _fwConfigurationDB_alertObjectToRecipeObject (dyn_dyn_anytype alertObject, dyn_dyn_mixed &recipeObject, dyn_string &exceptionInfo)
void _fwConfigurationDB_ClearRecipeObject (dyn_dyn_mixed &recipeObject)
string _fwConfigurationDB_getRecipeCacheDP (string recipeCache, dyn_string &exceptionInfo, bool create=FALSE)
void fwConfigurationDB_GetRecipeCacheMetaInfo (string recipeCache, string &recipeComment, int &numDevices, int &numValues, int &numAlerts, dyn_string &exceptionInfo)
void fwConfigurationDB_adoptRecipeObjectToSystem (dyn_dyn_mixed &recipeObject, string systemName, dyn_string &exceptionInfo)
bool fwConfigurationDB_compareRecipes (dyn_dyn_mixed recipeObject1, dyn_dyn_mixed recipeObject2, dyn_dyn_mixed &diffRecipeObject, string hierarchyType, dyn_string &exceptionInfo)
void fwConfigurationDB_dropRecipeInDB (string recipeName, string hierarchyType, dyn_string &exceptionInfo)
void fwConfigurationDB_dropRecipeInCache (string recipeName, string hierarchyType, dyn_string &exceptionInfo)
void _fwConfigurationDB_setRecipeComment (dyn_dyn_mixed &recipeObject, string recipeComment, dyn_string &exceptionInfo)
void _fwConfigurationDB_setRecipeOriginalName (dyn_dyn_mixed &recipeObject, string recipeName, dyn_string &exceptionInfo)
void _fwConfigurationDB_setRecipeOriginalRecipeType (dyn_dyn_mixed &recipeObject, string recipeType, dyn_string &exceptionInfo)
int _fwConfigurationDB_getRecipeComment (dyn_dyn_mixed &recipeObject, string &recipeComment, dyn_string &exceptionInfo)
int _fwConfigurationDB_getRecipeOriginalName (dyn_dyn_mixed &recipeObject, string &recipeName, dyn_string &exceptionInfo)
int _fwConfigurationDB_getRecipeOriginalRecipeType (dyn_dyn_mixed &recipeObject, string &recipeType, dyn_string &exceptionInfo)
int fwConfigurationDB_getRecipeMetaInfo (dyn_dyn_mixed &recipeObject, int idx, string &info, dyn_string &exceptionInfo)
void fwConfigurationDB_setRecipeMetaInfo (dyn_dyn_mixed &recipeObject, int idx, string info, dyn_string &exceptionInfo)
void fwConfigurationDB_makeRecipe (dyn_string deviceElements, dyn_mixed settings, dyn_dyn_mixed &recipeObject, dyn_string &exceptionInfo, bool checkExists=TRUE)
void fwConfigurationDB_extractSettingFromRecipe (dyn_dyn_mixed recipeObject, dyn_string &deviceElements, dyn_mixed &values, dyn_mixed &exceptionInfo)

Variables

global string _fwConfigurationDB_fileVersion_fwConfigurationDB_Recipes_ctl = "3.4.0"
global string fwConfigurationDB_defaultRecipeMergeMode = "ELEMENT"

Detailed Description

This package contains recipes-related functions of the Configuration Database tool

Author:
Piotr Golonka (IT-CO/BE)
Date:
May 2009

Function Documentation

void _fwConfigurationDB_storeRecipeInDB ( dyn_dyn_mixed  recipeObject,
string  recipeName,
string  versionDescription,
dyn_string &  exceptionInfo 
)

void _fwConfigurationDB_getRecipeMetaInformationFromDB ( string  recipeName,
string  hierarchyType,
dyn_dyn_mixed &  recipeObject,
dyn_string &  exceptionInfo 
)

void _fwConfigurationDB_getRecipeDataFromDB ( string  topDevice,
dyn_string  deviceList,
string  hierarchyType,
string  recipeName,
dyn_dyn_mixed &  dbRecipeObject,
dyn_string &  exceptionInfo,
string  system,
dyn_int &  prop_ids,
time  validAt = 0 
)

dyn_string fwConfigurationDB_getRTValues ( string  dataPointType,
dyn_string &  exceptionInfo 
)

gets the properties (DPEs) to be saved, according to the current recipeType

Parameters:
dataPointType the data point type for which properties are queried
exceptionInfo standard exception handling variable
Returns:
the list of data point elements for specified dataPointType

dyn_string fwConfigurationDB_getRTAlerts ( string  dataPointType,
dyn_string &  exceptionInfo 
)

gets the properties (DPEs) for which alert settings shoul be saved, according to the current recipeType

Parameters:
dataPointType the data point type for which properties are queried
exceptionInfo standard exception handling variable
Returns:
the list of data point elements for specified dataPointType

bool _fwConfigurationDB_HandleMissingRT ( string  dataPoint,
string  dpType,
dyn_string &  exceptionInfo 
)

Handles the situation where the Recipe Type is missing

This function handles the situation when missing Recipe Type data for some device type is encountered, which is signaled by the fwConfigurationDB_ERROR_NoValuesDataInRT exception.

It displays the dialog that allows to edit the properties to be stored, etc.

Parameters:
dataPoint the name of the data point that causes the problem
dpType the data point type for dataPoint
exceptionInfo standard exception handling variable
Returns:
FALSE if the situation could not be recovered (i.e. user cancelled the dialog), TRUE otherwise.

void _fwConfigurationDB_recipeObjectToAlertObject ( dyn_mixed  recipeObject,
string  dpe,
dyn_dyn_anytype &  alertObject,
dyn_string &  exceptionInfo 
)

void _fwConfigurationDB_alertObjectToRecipeObject ( dyn_dyn_anytype  alertObject,
dyn_dyn_mixed &  recipeObject,
dyn_string &  exceptionInfo 
)

void _fwConfigurationDB_ClearRecipeObject ( dyn_dyn_mixed &  recipeObject  ) 

Returns an empty recipe object.

This function creates (or clears) the variable passed as the argument, and sets its structure appropriately, so all the columns are defined.

string _fwConfigurationDB_getRecipeCacheDP ( string  recipeCache,
dyn_string &  exceptionInfo,
bool  create = FALSE 
)

void fwConfigurationDB_GetRecipeCacheMetaInfo ( string  recipeCache,
string &  recipeComment,
int &  numDevices,
int &  numValues,
int &  numAlerts,
dyn_string &  exceptionInfo 
)

Gets meta-information concerning the recipe cache

void fwConfigurationDB_adoptRecipeObjectToSystem ( dyn_dyn_mixed &  recipeObject,
string  systemName,
dyn_string &  exceptionInfo 
)

bool fwConfigurationDB_compareRecipes ( dyn_dyn_mixed  recipeObject1,
dyn_dyn_mixed  recipeObject2,
dyn_dyn_mixed &  diffRecipeObject,
string  hierarchyType,
dyn_string &  exceptionInfo 
)

Produces differential recipe

This function compares two recipeObject's and creates a recipe which contains differences between them. The differences are calculated in the (recipe2 - recipe1) manner, i.e.:

Parameters:
recipeObject1 - first of the compared recipe objects
recipeObject2 - second of the compared recipe objects
diffRecipeObject - on return will contain the difference between the two recipes
exceptionInfo - standard exception handling variable.
hierarchyType - dummy now
Returns:
TRUE if recipes differ, FALSE if they are the same

void fwConfigurationDB_dropRecipeInDB ( string  recipeName,
string  hierarchyType,
dyn_string &  exceptionInfo 
)

void fwConfigurationDB_dropRecipeInCache ( string  recipeName,
string  hierarchyType,
dyn_string &  exceptionInfo 
)

void _fwConfigurationDB_setRecipeComment ( dyn_dyn_mixed &  recipeObject,
string  recipeComment,
dyn_string &  exceptionInfo 
)

void _fwConfigurationDB_setRecipeOriginalName ( dyn_dyn_mixed &  recipeObject,
string  recipeName,
dyn_string &  exceptionInfo 
)

void _fwConfigurationDB_setRecipeOriginalRecipeType ( dyn_dyn_mixed &  recipeObject,
string  recipeType,
dyn_string &  exceptionInfo 
)

int _fwConfigurationDB_getRecipeComment ( dyn_dyn_mixed &  recipeObject,
string &  recipeComment,
dyn_string &  exceptionInfo 
)

int _fwConfigurationDB_getRecipeOriginalName ( dyn_dyn_mixed &  recipeObject,
string &  recipeName,
dyn_string &  exceptionInfo 
)

int _fwConfigurationDB_getRecipeOriginalRecipeType ( dyn_dyn_mixed &  recipeObject,
string &  recipeType,
dyn_string &  exceptionInfo 
)

int fwConfigurationDB_getRecipeMetaInfo ( dyn_dyn_mixed &  recipeObject,
int  idx,
string &  info,
dyn_string &  exceptionInfo 
)

Return values:
0 if recipe comment was present in the recipeObject
1 if meta information was not present in the recipeObject
-1 if recipeObject structure was incorrect...
-2 if data idx was wrong

void fwConfigurationDB_setRecipeMetaInfo ( dyn_dyn_mixed &  recipeObject,
int  idx,
string  info,
dyn_string &  exceptionInfo 
)

void fwConfigurationDB_extractSettingFromRecipe ( dyn_dyn_mixed  recipeObject,
dyn_string &  deviceElements,
dyn_mixed &  values,
dyn_mixed &  exceptionInfo 
)

Extracts value(s) from a recipe

The function extracts a value ("setting") from an exising recipe, for a set of dp-elements.

Parameters:
[in] recipeObject contains the recipe data, from which the values are to be extracted
[in,out] deviceElements on entry, it should contain the list of dp-elements for which the values are queried; note that these deviceElemets may contain wildcard characters, so that, for instance, all elements for a device could be specified, without actually naming them explicitely, or a list of devices matching some naming convention may be specified. Note that if element is not specified (i.e. only the dp name is passed, not followed by a dot and the element name, all elements for matching device will be returned as well.
on exit, the original contents will be replaced by the expanded list of identified data point elements, for which the corresponding settings will be stored in the settings parameter.
[out] settings on return i'th row will contain the settings (values) for i'th deviceElement of deviceElements
[in] exceptionInfo standard exception handling variable
Example: extract all settings for a device with alias "myDevice", that are stored in a recipeObject. Note that alias "myDevice" is not resolved to hardware name, but kept as is in the name (unlike when reading directly from the recipeObject's column fwConfigurationDB_RO_DPE_NAME)
  dyn_string deviceElements=makeDynString("myDevice.*");
  dyn_string exceptionInfo;
  dyn_mixed  values;
  fwConfigurationDB_extractSettingFromRecipe(deviceElements, values, exceptionInfo);

  // on return one would get a data such as
  // deviceElements[1]="myDevice.settings.v0";     settings[1]=10.0;
  // deviceElements[2]="myDevice.settings.i0";     settings[2]=20.0;
  // deviceElements[3]="myDevice.commands.OnOff";  settings[3]=30.0;

Example: extract the voltages for all channels in board01 and board13 of crate1 and board05 of crate2. Note the use of wildcard characters: "*" replacing any part of name, "?" replacing one character, and "[,]" specifying a set of values.

  dyn_string deviceElements;
  dyn_string exceptionInfo;
  dyn_mixed  values;

  deviceElements[1] = "dist_1:CAEN/crate1/board[01,13]/channel*.settings.v?";
  deviceElements[2] = "dist_1:CAEN/crate2/board05/channel*.settings.v?";

  fwConfigurationDB_extractSettingFromRecipe(deviceElements, values, exceptionInfo);

  // on return one would get a data such as
  // deviceElements[1]  = "dist_1:CAEN/crate1/board01/channel001.settings.v0";     settings[1]  =10.0;
  // deviceElements[2]  = "dist_1:CAEN/crate1/board01/channel001.settings.v0";     settings[2]  =20.0;
  // deviceElements[3]  = "dist_1:CAEN/crate1/board01/channel002.settings.v0";     settings[3]  =10.0;
  // deviceElements[4]  = "dist_1:CAEN/crate1/board01/channel002.settings.v0";     settings[4]  =20.0;
  // ...
  // deviceElements[n-1]= "dist_1:CAEN/crate1/board13/channel005.settings.v0";     settings[n-1]=90.0;
  // deviceElements[n]  = "dist_1:CAEN/crate1/board13/channel006.settings.v0";     settings[n]  =90.0;
  // ...
  // deviceElements[k-1]= "dist_1:CAEN/crate2/board05/channel005.settings.v0";     settings[k-1]=90.0;
  // deviceElements[k]  = "dist_1:CAEN/crate2/board05/channel006.settings.v0";     settings[k]  =99.0;
  // ... etc


Variable Documentation

global string _fwConfigurationDB_fileVersion_fwConfigurationDB_Recipes_ctl = "3.4.0"

global string fwConfigurationDB_defaultRecipeMergeMode = "ELEMENT"

Determines the default mode for recipe merge...

fwConfigurationDB_ERROR_CantLoadPartOfRecipeType = -51

part of specified recipe type (refering to some device type) cannot be loaded (warning)

This a warning (i.e. processing is not aborted); a part of recipe type could not be retrieved, either because corresponding data point does not exist, or it exists, but the data cannot be loaded. This usually means that the recipe type should be re-viewed/edited in the fwConfigurationDB/EditRecipeType panel.

fwConfigurationDB_ERROR_NoAlertsDataInRT = -53

in the current recipe, there is no information about alerts to be stored for queried DPT (warning)

fwConfigurationDB_ERROR_NoRecipeType = -103

specified recipe type does not exist (critical)

fwConfigurationDB_ERROR_CantLoadRecipeType = -104

specified recipe type cannot be loaded (critical)

fwConfigurationDB_ERROR_InvalidDataPointName = -105

invalid data point name specified

fwConfigurationDB_ERROR_StoreRecipeDataToCache = -106

cannot store recipe data in recipe cache

fwConfigurationDB_ERROR_NoRecipeCache = -107

recipe cache does not exist

fwConfigurationDB_ERROR_GetRecipeFromCache = -108

error getting recipe data from the cache

fwConfigurationDB_ERROR_CreateRecipeCache = -109

error while creating recipe cache datapoint

fwConfigurationDB_ERROR_RecipeCacheExists = -110

recipe cache with the same name already exists

fwConfigurationDB_ERROR_DPENotInRecipe = -111

specified DPE is not defined in the recipe...


Generated on Thu May 14 12:06:05 2009 for Configuration Database component by  doxygen 1.4.7