If an attempt to read an IS object to an instance of the ISInfoDynAny object was successful, this instance will be filled up with the values of the attributes of the respective information object from the IS repository. Later on those values can be made available to the user space via the set of the get_xxx template functions, provided by the ISInfoDynAny class. There are two types of getters, provided by the ISInfoDynAny class. The first one returns the value of the attribute at the given index. A unique index (unsigned integer number) is associated with every attribute for a given IS object. The index zero corresponds to the very first attribute and then indexes are monotonically increasing following the order of the attributes declaration for the IS information object type. The getter functions have to be used in conjunction with the method which returns the type of the attribute at the given position. That is necessary because the template parameter for the getter function has to be explicitly specified when the function is called. "Listing 10.3" shows how to do that.
First this program gets the number of the information attributes using the getAttributesNumber method of the ISInfoDynAny class (line 6). Then, for each attribute it finds out the attribute type (line 10) and calls the getAttributeValue method with the appropriate template parameter. This method returns the value of the attribute at the given position of the ISInfoDynAny object.
The ISInfoDynAny class provides also another possibility of reading attribute values. If the IS meta-information is available for the IS information object type (Section 12) one can use another set of the getter functions which take the attribute name as parameter. "Listing 10.4" shows how to do that.
This listing shows one essential difference with the previous example - the getAttributeValue functions, which are reading attributes by name, can throw 2 exceptions:
2 July 1998 - WebMaster | Copyright © CERN 1998 |