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

7.3 Using the IS information iterator

Program in "Listing 7.2" is an extension of the previous example. For each IS server in the ISServerIterator it shows how to enumerate all the information in this server.

Listing 7.2   Using the IS information iterator

1: // include main IS header file
2: #include <is/infoiterator.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: // Create the IS server iterator instance
14: // using the partitition object as parameter
15: ISServerIterator it(partitition);
16:
17: // Print all the IS servers names
18:
19: std::cout << partition.name() << " has " << ii.entries() << " IS servers : " << endl;
20: while ( it() )
21: {
22: ISInfoIterator ii( p, ii.name() );
23: std::cout << it.name() << " has " << ii.entries() << " objects" << std::endl;
24: while( ii() )
25: {
26: std::cout << ii.name() << " : " << ii.type() << " : " << ii.date() << std::endl;
27: ISInfoAny isa;
28: ii.value( isa );
29: std::cout << isa << std::endl;
30: }
31: }
32: return 0;
33: }

In line 19 the ISInfoIterator is created for the IS server at the current position of the ISServerIterator. Then, lines 23-30 show which information can be taken via the ISInfoIterator: line 23 prints a number of information objects for the particular IS server, line 26 shows how to get the name, type and date for the information at the current iterator's position, line 28 shows how to get the value of the information at the current iterator's position.


2 July 1998 - WebMaster
Copyright © CERN 1998