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

12.7 ISInfoDictionary


Synopsis
#include <is/infodictionary.h>
IPCPartition p( "MyPartition" );
ISInfoDictionary id( p );


Description

This class provides the main interface to the IS information repository. By using the methods of this class an application can create a new information in the IS repository, update or delete already existing information.


Example
1: #include <is/ISInfoT.h>
2: #include <vector>
3:
4: IPCPartition partition("MyPartition");
5: ISInfoDictionary dict(partitition);
6:
7: ISInfoInt voltage( 220 );
8: dict.insert( "MyServer.DeviceVoltage", voltage );
9:
10: voltage = 360;
11: // replace the old value (no history)
12: dict.update( "MyServer.DeviceVoltage", voltage );
13:
14: voltage = 370;
15: // keep the old value in the history
16: dict.update( "MyServer.DeviceVoltage", voltage, true );
17:
18: voltage = 380;
19: // put the old value again to the history
20: dict.update( "MyServer.DeviceVoltage", voltage, true );
21:
22: ISInfoInt vv;
23: // read the last value
24: dict.getValue( "MyServer.DeviceVoltage", vv );
25:
26: std::vector<ISInfoInt> v_history;
27: // read all values (including the old ones)
28: dict.getValues( "MyServer.DeviceVoltage", v_history );
29:
30: for( size_t i = 0; i < v_hsitory; i++ )
31: std::cout << "value [" << i << "] = " << v_history[i] << std::endl;


Public Constructors
ISInfoDictionary( );
Constructs new ISInfoDictionary object which can be used for access to the IS repository in the default IPC partition.
ISInfoDictionary( const IPCPartition & part );
Constructs new ISInfoDictionary object which can be used for access to the IS repository in the part IPC partition.


Public Member Functions
bool
contains(const char * name) const;
Returns true if the information object with the name name exists in the IS repository, otherwise returns false.
ISInfo::Status
insert(const char * name, ISInfo & info) const;
Creates new information object with the name name in the IS repository. On success returns ISInfo::Success. Returns ISInfo::AlreadyExist, if information object with this name already exists in the IS repository. Returns ISInfo::CommFailure if the IS repository is not available.
ISInfo::Status
remove(const char * name) const;
Removes information object associated with the name name from the IS repository. On success returns ISInfo::Success. Returns ISInfo::NotFound if such object doesn't exist. Returns ISInfo::CommFailure if the IS repository is not available.
ISInfo::Status
findType(const char * name, ISType & type) const;
Is obsolete. The getValue( const char * name, ISInfo & info ) const; function has to be used instead.
ISInfo::Status
getType(const char * name, ISType & type) const;
Gets type of the information object associated with the name name. On success returns ISInfo::Success. Returns ISInfo::NotFound if such object doesn't exist. Returns ISInfo::CommFailure if the IS repository is not available.
ISInfo::Status
findValue( const char * name, ISInfo & info ) const;
Is obsolete. The getValue( const char * name, ISInfo & info ) const; function has to be used instead.
ISInfo::Status
getValue( const char * name, ISInfo & info ) const;
Reads the value of the information object with the name name from the IS repository into the info object. On success returns ISInfo::Success. Returns ISInfo::NotFound if such object doesn't exist. Returns ISInfo::CommFailure if the IS repository is not available.
The info object must have the same type as information object associated with the name name. Otherwise this function returns ISInfo::IncompatibleType error and doesn't change the info object.
ISInfo::Status
update(const char * name, ISInfo & info, bool keep_history = false) const;
Updates the information object with the name name in the IS repository. New information value is taken from the info object. On success returns ISInfo::Success. Returns ISInfo::NotFound if such object doesn't exist. Returns ISInfo::CommFailure if the IS repository is not available.
The keep_history parameter tells to the IS repository what to do with the previous information value. If it is set to false (the default value) then the old value is dropped and the new one simply replaces it. If this parameter is true then the old value is stored and can be accessed using the ISInfoDictionary::getValues function.


Public Template Function
template <class T>
ISInfo::Status
getValues( const char * name, std::vector<T> & values, long how_many = -1 ) const;
Reads how_many values of the name information object from the IS repository into the values vector. The -1 value for the how_many parameter (the default one) means that all the history values will be read from the IS repository. On success returns ISInfo::Success. Returns ISInfo::NotFound if the name object doesn't exist. Returns ISInfo::CommFailure if the IS repository is not available. The template parameter is replaced by the actual type of the IS information.
The T object must have the same type as information object associated with the name name. Otherwise this function returns ISInfo::IncompatibleType error and doesn't change the values vector.


2 July 1998 - WebMaster
Copyright © CERN 1998