CERN -> IPT Group -> FrameMaker at CERN
Information Service User's Guide

10.2 Using ISInfoDynAny class to read information

The ISInfoDynAny class inherits from the ISInfo base class and an instance of the ISInfoDynAny can be passed to all functions of the IS API which are reading information from the IS repository and are expecting to get a reference to ISInfo. "Listing 10.1" shows a very simple example of how to use this class to print out the information content to the standard C++ stream.

Listing 10.1   Using ISInfoAny class to print out information

1: // include IS header file
2: #include <is/infodynany.h>
3: #include <ipc/core.h>
4:
5: int main( int ac, char ** av )
6: {
7: // Initialise communication library
8: IPCCore::init( ac, av );
9:
10: // Create the instance of partition
11: IPCPartition partition("MyPartition");
12:
13: ISInfoIterator ii( p, "MyServer" );
14: while( ii() )
15: {
16: std::cout << ii.name() << " " << ii.time() << " " << ii.type() << std::endl;
17: ISInfoDynAny isa;
18: ii.value( isa );
19: std::cout << isa << std::endl;
20: }
21:
22: return 0;
23: }

There IS library implements a global output operator for the ISInfoDynAny class which is used in this example (line 19). "Listing 10.2"shows an example of the output produced by this operator.

Listing 10.2   Programs output

MyServer.Employee <4/3/03 15:56:55> <Employee>
4 attribute(s):
string : Jone
date : 4/3/03
long : 0
unsigned short : 3000
MyServer.Person <4/3/03 15:56:55> <Person>
3 attribute(s):
string : Jone
date : 4/3/03
long : 0


2 July 1998 - WebMaster
Copyright © CERN 1998