fwConfigurationDB
8.4.0
|
Functions | |
void | fwConfigurationDB_getHierarchyFromPVSS (string rootNode, string hierarchyType, dyn_string &nodeList, dyn_string &exceptionInfo, string system="", string includeRootNode=TRUE) |
void | _fwConfigurationDB_copyDeviceListObjectEntry (dyn_dyn_mixed &srcObject, int src_idx, dyn_dyn_mixed &dstObject, int dst_idx, dyn_string &exceptionInfo) |
void | fwConfigurationDB_expandToDeviceListObject (string hierarchyType, dyn_string deviceList, dyn_dyn_mixed &deviceListObject, dyn_string &exceptionInfo) |
void | _fwConfigurationDB_completeDevicesInHierarchy (dyn_string &deviceList, string hierarchyType, string system, dyn_string &exceptionInfo) |
void | _fwConfigurationDB_verifyDatapoints (string hierarchyType, dyn_dyn_mixed &deviceListObject, dyn_dyn_mixed &missingDevicesListObject, dyn_string &exceptionInfo, bool checkDeviceLocal=FALSE) |
void | fwConfigurationDB_getReferencesHistory (string configName, string hierarchyType, time startTime, time endTime, dyn_string itemNames, dyn_dyn_mixed &references, dyn_string &exceptionInfo) |
void | fwConfigurationDB_updateDeviceModelsInDB (dyn_string dpList, dyn_string &exceptionInfo, bool updateAliases=TRUE) |
int | _fwConfigurationDB_selectDevicesToLoad (string configurationName, string hierarchyType, dyn_string &deviceList, dyn_string &exceptionInfo, string topNode="") |
int | fwConfigurationDB_saveDevicesToDBMinimal (dyn_string &deviceList, dyn_string &exceptionInfo, bool abortWhenDeviceMissing=FALSE) |
void | fwConfigurationDB_resolveDevices (dyn_string &deviceList, dyn_string &devHierarchies, dyn_string &devDatapoints, dyn_string &exceptionInfo, bool errorOnNotFound=TRUE, dyn_string deviceSystems="") |
void | fwConfigurationDB_findDPsFromAliases (dyn_string devices, dyn_string &dp_names, dyn_string &aliases, dyn_string &exceptionInfo, dyn_string systems="*", bool errorOnNotFound=TRUE) |
Variables | |
Indexing constants for deviceListObject variables | |
The following constants are used to refer to the data in a single row of a deviceListObject variable (a recipeRow). | |
const int | fwConfigurationDB_DLO_DPNAME = 1 |
const int | fwConfigurationDB_DLO_DPTYPE = 2 |
const int | fwConfigurationDB_DLO_NAME = 3 |
const int | fwConfigurationDB_DLO_MODEL = 5 |
const int | fwConfigurationDB_DLO_COMMENT = 6 |
const int | fwConfigurationDB_DLO_ITEMID = 7 |
const int | fwConfigurationDB_DLO_PARENTID = 8 |
const int | fwConfigurationDB_DLO_PARENTDPNAME = 9 |
const int | fwConfigurationDB_DLO_DPID = 10 |
const int | fwConfigurationDB_DLO_REFDP = 11 |
const int | fwConfigurationDB_DLO_REFID = 12 |
const int | fwConfigurationDB_DLO_REF_STATUS = 13 |
const int | fwConfigurationDB_DLO_PROPIDS = 14 |
const int | fwConfigurationDB_DLO_PROPNAMES = 15 |
const int | fwConfigurationDB_DLO_CITEM_ID = 16 |
const int | fwConfigurationDB_DLO_MAX_IDX = 16 |
This package contains hierarchy-related functions of the Configuration Database tool
(c) Copyright CERN, All Rights Reserved
void fwConfigurationDB_getHierarchyFromPVSS | ( | string | rootNode, |
string | hierarchyType, | ||
dyn_string & | nodeList, | ||
dyn_string & | exceptionInfo, | ||
string | system = "" , |
||
string | includeRootNode = TRUE |
||
) |
Gets the list of children items, in specified hierarchy
rootNode | the name of the parent device (item) |
hierarchyType | the Framework hierarchy type:
|
nodeList | the resulting list of child items will be stored in this variable. Note that this is "append" operation, i.e. the contents of the variable are not cleared from previous content! |
exceptionInfo | standard exception handling variable |
system | (optional) the name of the system (for distributed systems); when not specified, the local system is assumed |
includeRootNode | (optional) determined if the rootNode will be included in the list; if TRUE (default) rootNode will be included, if FALSE - it will not. |
void _fwConfigurationDB_copyDeviceListObjectEntry | ( | dyn_dyn_mixed & | srcObject, |
int | src_idx, | ||
dyn_dyn_mixed & | dstObject, | ||
int | dst_idx, | ||
dyn_string & | exceptionInfo | ||
) |
Copies one entry (line) of device object to another device object.
if dst_idx=0 this is "append" operation
void fwConfigurationDB_expandToDeviceListObject | ( | string | hierarchyType, |
dyn_string | deviceList, | ||
dyn_dyn_mixed & | deviceListObject, | ||
dyn_string & | exceptionInfo | ||
) |
For devices in the deviceList, the DeviceListObject is created,
filled with complete information. Note that the function works for the devices that are already in the system (i.e. the function is used when saving hierarchy to DB)
void _fwConfigurationDB_completeDevicesInHierarchy | ( | dyn_string & | deviceList, |
string | hierarchyType, | ||
string | system, | ||
dyn_string & | exceptionInfo | ||
) |
adds the required (parent) devices to the list, puts the hierarchy in order
void _fwConfigurationDB_verifyDatapoints | ( | string | hierarchyType, |
dyn_dyn_mixed & | deviceListObject, | ||
dyn_dyn_mixed & | missingDevicesListObject, | ||
dyn_string & | exceptionInfo, | ||
bool | checkDeviceLocal = FALSE |
||
) |
check if datapoints exist and verify that existing ones have appropriate types and models. Find and group in the missingDevicesListObject the ones that does not exist, report (with exceptionInfo) if some of them exist with incompatible type
void fwConfigurationDB_getReferencesHistory | ( | string | configName, |
string | hierarchyType, | ||
time | startTime, | ||
time | endTime, | ||
dyn_string | itemNames, | ||
dyn_dyn_mixed & | references, | ||
dyn_string & | exceptionInfo | ||
) |
Returns the history of hierarchies mapping for specipied period of time,
and for certain configuration.
configName | the name of static configuration |
hierarchyType | type of hierarchy (eg. fwDevice_LOGICAL) |
startTime | start of queried period of time |
endTime | end of queried period of time. Passing 0 as a parameter means: up to now |
itemNames | list of logical names of devices being queried |
references | the result will be put in this variable on return; explanation of the output format below |
exceptionInfo | standard exception handling variable |
The data returned by the function has a format of 4-column array:
The rows are sorted by logical dpname and start of validity.
Example:
references[1] | references[2] | references[3] | references[4] |
SubSys/straw1 | dist_1:CAEN/crate01/board00/channel001 | 5 Jan 2006 | 6 Jan 2006 |
SubSys/straw1 | dist_1:CAEN/crate01/board00/channel011 | 6 Jan 2006 | 10 Jan 2006 |
SubSys/straw1 | dist_1:CAEN/crate01/board10/channel001 | 10 Jan 2006 | |
SubSys/straw2 | dist_1:CAEN/crate01/board01/channel002 | 5 Jan 2006 | |
SubSys/straw3 | dist_1:CAEN/crate01/board01/channel003 | 5 Jan 2006 |
In this example, one can see that the SubSys/straw1 aparently had some problems: it was initially mapped to first channel of first board, then on 6th of January 2006, reconnected to eleventh channel of first board, then again, on 10th of January 2006 it was reconnected to first channel of tenth board, and stays as such since then. The other two straws were not touched and stay connected to channel 2 and 3 on first board...
void fwConfigurationDB_updateDeviceModelsInDB | ( | dyn_string | dpList, |
dyn_string & | exceptionInfo, | ||
bool | updateAliases = TRUE |
||
) |
Updates the device models in the database to the current ones
dpList | the list of datapoint names, for which the model is to be changed. Note that if the datapoin |
exceptionInfo | standard framework exception-handling variable |
updateAliases | (optional, default TRUE), determines if the models for LOGICAL devices which correspond to the specified datapoints should also be updated. |
: Use with care and cautiously, of what the implications could be! To be used from the dedicated device-conversion panels, such as the ones for the fwWiener component.
int _fwConfigurationDB_selectDevicesToLoad | ( | string | configurationName, |
string | hierarchyType, | ||
dyn_string & | deviceList, | ||
dyn_string & | exceptionInfo, | ||
string | topNode = "" |
||
) |
Selects the devices to be loaded, prepares the data in ConfDB data-exchange tables.
There are two ways to specify the list of devices:
Then a cross-check is done on the deviceList passed on input: if all devices indeed exist in the specified configuration, the deviceList parameter, then they are sorted alphabeticaly (so that on return the deviceList param DIFFERS than the one on input) all the preparation is done and return code of zero is returned. However, if some of devices passed in deviceList are not present in the database, they will be skipped - on return a modified deviceList parameter will have the valid one, and the return value from the function will be 1
Return codes less than zero signify an error - details in exceptionInfo
int fwConfigurationDB_saveDevicesToDBMinimal | ( | dyn_string & | deviceList, |
dyn_string & | exceptionInfo, | ||
bool | abortWhenDeviceMissing = FALSE |
||
) |
Stores "minimal" information about the devices to DB
This function stores minimal information about devices into the DB, so that recipes for these devices may also be stored.
[in,out] | deviceList | - list of names of devices; may include a mixture of devices from the HARDWARE and LOGICAL hierarchies; on exit, it will contain the list of devices that were actually stored/verified, namely: the non-existing devices are removed from the list, and devices that are needed to satisfy the hierarchical constraints (parents, grandparents,...) are added to the list |
[out] | exceptionInfo | - standard exception-handling parameter |
[in] | abortWhenDeviceMissing | (optional, default FALSE) - if set to TRUE, the function will abort (and return an error) if some of specified devices does not exist, i.e. it will not store the good ones in the database; otherwise (the default behaviour), the missing devices will be skipped, the good ones will be stored in the database, and the return value of 1 will signify that there were missing devices. |
0 | - everything OK: all devices are in DB now |
1 | - some devices in the deviceList do not exist, and were skipped; the list of them is in the exceptionInfo; apart from that, everything was OK |
-1 | - there was an error while storing the devices; details in the exceptionInfo |
How to handle the return value and the exceptionInfo, when the abortWhenDeviceMissing
parameter is FALSE
. This example shows how to make sure that the recipeObject can be saved to DB. The devices that exist - are saved. For all devices that are missing, we post-process the recipeObject to remove the data for non-existing devices, then save the recipeObject to DB
void fwConfigurationDB_resolveDevices | ( | dyn_string & | deviceList, |
dyn_string & | devHierarchies, | ||
dyn_string & | devDatapoints, | ||
dyn_string & | exceptionInfo, | ||
bool | errorOnNotFound = TRUE , |
||
dyn_string | deviceSystems = "" |
||
) |
Resolves device names
This functions takes the list of device names - devices being in either hierarchy, and tells what are the actual hierarchy to which they belong, and what are the datapoint to which they refer
deviceList | list of devices to be resolved; on return contains a modified list of resolved devices (ie those that are not resolved are skipped; could be useful if errorOnNotFound is set to false, because otherwise exceptionInfo is generated and the list is not modified |
devHierarchies | on exit will contain the name of hierarchy for all the elements of deviceList |
devDatapoints | on return will contain the name of datapoints for all the elements of deviceList |
exceptionInfo | standard exception handling variable |
errorOnNotFound | determines if an exception should be generated when a non-resolved device is encountered (default: true) |
deviceSystems | (optional) list of systems on which devices should be resolved. by default (empty dyn_string, or a dyn_string with one element being an empty string would look up on the local system only; if set to a "*" (ie. dyn_string with 1 element being "*"), it will look up in all known systems |
void fwConfigurationDB_findDPsFromAliases | ( | dyn_string | devices, |
dyn_string & | dp_names, | ||
dyn_string & | aliases, | ||
dyn_string & | exceptionInfo, | ||
dyn_string | systems = "*" , |
||
bool | errorOnNotFound = TRUE |
||
) |
Resolve aliases to datapoints
this function resolves a list of aliases to datapoints, allowing to choose in which systems to try to resolve the aliases, and allowing to select different methods (eg. searching on all systems at once or searching for each of the selected systems at a time) to resolve the aliases which depending on the use-case may have a significant difference in performance.
[in] | devices | - list of names of devices; Any HARDWARE devices are ignored, only LOGICAL hierarchie devices are considered. may include a mixture of devices from the HARDWARE and LOGICAL hierarchies; |
[out] | dp_names | - the returned list of datapoints |
[out] | aliases | - the returned list of aliases |
[out] | exceptionInfo | - standard exception-handling parameter |
[in] | systems | - (optional) A list of the system where to try to resolve the aliases; "" or an empty list can be passed to resolve only for the local system, and "*" for all systems (default). |
[in] | errorOnNotFound | - (optional, default TRUE) Return an error on exceptionInfo in case it is not possible to resolve any of the devices. |
fwConfigurationDB_DLO_MODEL = 5 |
{@ contains model name for framework devices, "DATAPOINT" if this is a non-framework data point, "SYSTEM" if this is a top-node of hierarchy