Once an information is published any other application can read it. "Listing 2.4" shows how a C++ program can get the latest information value. This program uses the getValue method of the ISInfoDictionary class in order to get the value of the specific information from the IS.
"Listing 2.5" shows how a C++ program can get the all information values, including the latest value and also all or some history values This program uses the getValues template method of the ISInfoDictionary class in order to get the all the value of the specific information from the IS.
The lines 21-27 shows how to read all the history values for the "MyServer.DeviceVoltage" and "MyServer.DeviceTemperature" information respectively. The history values are stored in the vector, which is provided as second argument of the getValues function. The information values in the resulting vector are sorted by their time with the most recent value in the first element of the vector.
The list of history values might be long and one may want to read only the last N history values instead of reading all of them. This can be done by using the 3d parameter of the getValues function as it is shown in "Listing 2.6".
This 3d parameter has a default value set to -1, which means that all history values have to be read. Setting this parameter to some other positive value N will result in reading at most the N last information values. If the current history size is less than N, then the number of elements in the vector will be equal to the current history size.
2 July 1998 - WebMaster | Copyright © CERN 1998 |