There are two ways of getting the type of a particular information object, static and polymorphic. The static one can be used if the declaration of the C++ (or Java) class for the information object is available in user's code. In C++ language one can call the static method of the generated information class, which is called type, to get the type object of this information class (Listing 4.1).
In Java the type of the information object is declared as a public static final attribute of the generated class, called type and can used as <Information Class Name>.type.
The polymorphic type function, which is declared in the ISInfo class (is.Info in Java) can be used to get the type of the information object when the object's class declaration is not available or there is uncertainty about the actual type of this object (Listing 4.2).
Of course the types which are obtained using static and polymorphic ways are identical for the same information class.
2 July 1998 - WebMaster | Copyright © CERN 1998 |