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

7.2 Using ISInfoAny class to print out information

The IS API has a special class called ISInfoAny which can be used to read the information of any type. "Listing 7.1" shows a very simple example of how to use this class to print out the information content to the standard C++ stream.

Listing 7.1   Using ISInfoAny class to print out information

1: // include IS header file
2: #include <is/infoany.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: ISInfoAny 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 ISInfoAny class which is used in this example (line 16). "Listing 7.2"shows an example of the output produced by this operator.

Listing 7.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