As it was explained in the introduction an application can add a new information to the IS repository, update an existing information and remove it if necessary. The update function has two working modes:
The number of history values, which can be stored by the IS repository for a single information object is limited by the dedicated parameter of the IS server application, which implements the corresponding part of the IS repository. This limit is the same for all the information items, which are stored on that IS server. In the current implementation this number is defined at the server start up time and can not be changed dynamically. When the number of history values for any information object exceeds the limit the IS server removes the oldest value from the history list and destroy it.
"Listing 2.1" shows how an application can make several instances of the simple information available for any other interesting application via IS, i.e. publish information.
First the user program has to include the is/infoT.h header file. This file contains declarations for the simple IS information types and also includes internally the main IS header file is/info.h which declares the ISInfoDictionary class which provides the main interface for the information providers. Then the program creates an instance of the IPCPartition class. This instance represents the partition in which the Information Service will be used. For more information about IPCPartition class see [9]. The ISInfoDictionary class constructor takes this partition object as parameter. Then, lines 22-23 show how the ISInfoDictionary object can be used to insert new information to the IS.
When the published information is changed, it is necessary to inform the IS about those changes. Next chapters explain how one can do this. This can be done in two ways: one can instruct the IS repository to keep the previous value of the updated information or to drop it. The next two chapters explain how this can be done.
The update method of the ISInfoDictionary class tells to the IS that already existing information, identified by the first parameter of the update call, has been changed. If there is no information with this name in the IS the update returns ISInfo::NotFound status and does not change the content of the information repository.
This example asks the IS repository to store the new information value and drop the previous one. The previous information value will be lost forever.
Contrary to the example in the previous chapter the one, which is shown on Listing 2.3. requests the IS repository to keep the old information value, which can be retrieved later by using the technic described in the Listing 2.5.
Note the use of an additional parameter for the update function. It is set to true, which means that the old information value has to be kept. If this parameter is omitted then the default value, which is false, is taken and the old information value is removed from the IS.
2 July 1998 - WebMaster | Copyright © CERN 1998 |