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

9.4 Reading all available IS types descriptions

"Listing 9.2" shows how to an application can get all the available descriptions for the IS types.

Listing 9.2   Reading all available IS types descriptions

1: // include main IS header file
2: #include <is/infodocument.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 information description object
14: // for the Person type
15: ISInfoDocument::Iterator it(partitition);
16:
17: // Print out types descriptions
18:
19: while ( it ) // while current iterator's position is valid
20: {
21: // get current document and advance iterator to the next position
22: const ISInfoDocument & isd = *it++;
23:
24: // Print out type description
25:
26: std::cout << "class " << isd.name()
27: << " { // " << isd.description() << std::endl;
28: for ( size_t i = 0; i < isd.attributeCount(); i++ )
29: {
30: const ISInfoDocument::Attribute * attr = isd.attribute(i);
31: std::cout << attr -> typeName()
32: << ( attr -> isArray() ? "[] " : " " )
33: << attr -> name()
34: << "; // " << attr -> description() << std::endl;
35: }
36: std::cout << "};" << std::endl;
37: }
38:
39: return 0;
40: }

This program uses the ISInfoDocument::Iterator class (which is member class of the ISInfoDocument) to get all the available IS types descriptions.


2 July 1998 - WebMaster
Copyright © CERN 1998