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

Appendix A

Rules for the IS information declaration


IS information in C++

A.1.1 Example
1: #include <is/info.h>
2:
3: class Person: public ISInfo {
4: public:
5: enum Sex { Male, Female };
6:
7: std::vector<std::string> names;
8:
9: unsigned int age;
10: int income;
11: Sex sex;
12:
13: void publishGuts( ISostream & out ){
14: out << names << age << income << sex;
15: }
16:
17: void refreshGuts( ISistream & in ){
18: in >> names >> age >> income >> (int&)sex;
19: }
20: };
A.1.2 Explanation

In order to define a new information type, one must declare a new C++ class which has to do the following:

  1. Inherit either the ISInfo or the ISNamedInfo class
  2. Declare all the necessary attributes. For a valid attribute types see Appendix D.
  3. Implement two virtual methods declared by the ISInfo class: publishGuts and refreshGuts. The publishGuts method must put all the attributes of the class to the out parameter of the method. The refreshGuts method must read all the attributes from the in parameter of the method in the same order as they have been put to the ISostream by the publishGuts.

As you can see from the example above it is recommended to use the std::vector as the type of the multi-value information attributes. The old style, which used C like arrays is still supported but not recommended. It will be removed in one of the future releases.

A.2 IS Information in Java


2 July 1998 - WebMaster
Copyright © CERN 1998