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

15.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/infoT.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
void
checkin(const std::string & name, ISInfo & info, bool keep_history=false) const;
Creates new information object with the name name in the IS repository, if object does not exist or update the value of the existing one. In the latter case the previous object value will be kept in the objects history if the keep_history parameter is set to true.

Throws daq::is::InfoNotCompatible, if information object with this name already exists in the IS repository and it has a different type with respect to the given one, daq::is::RepositoryNotFound if IS server with the given name does not exist or daq::is::InvalidName if the given name does not contain Server/Object name separator (dot).

void
checkin(const std::string & name, int tag, ISInfo & info) const;
Creates new information object with the name name and tag tag in the IS repository, if object does not exist or update the value of the existing one.

Throws daq::is::InfoNotCompatible, if information object with this name already exists in the IS repository and it has a different type with respect to the given one, daq::is::RepositoryNotFound if IS server with the given name does not exist or daq::is::InvalidName if the given name does not contain Server/Object name separator (dot).

bool
contains(const std::string & name) const;
Returns true if the information object with the name name exists in the IS repository, otherwise returns false.
void
insert(const std::string & name, ISInfo & info) const;
Creates new information object with the name name in the IS repository.
Throws daq::is::AlreadyExist, if information object with this name already exists in the IS repository, daq::is::RepositoryNotFound if IS server with the given name does not exist or daq::is::InvalidName if the given name does not contain Server/Object name separator (dot).
void insert(const std::string & name, int tag, ISInfo & info) const;
Creates new information object with the name name and tag tag in the IS repository.

Throws daq::is::AlreadyExist, if information object with this name already exists in the IS repository, daq::is::RepositoryNotFound if IS server with the given name does not exist or daq::is::InvalidName if the given name does not contain Server/Object name separator (dot).

void
getTags( const std::string & name, std::vector<std::pair<int,OWLTime> > & tags ) const;
Reads all available history tags for the given IS information object. When this function returns the tags together with the time stamps of their appearance in the IS repository are places to the tags parameter.
Throws daq::is::InfoNotFound if such object doesn't exist, daq::is::RepositoryNotFound if IS server with the given name does not exist or daq::is::InvalidName if the given name does not contain Server/Object name separator (dot).
void
getType(const std::string & name, ISType & type) const;
Gets type of the information object associated with the name name. On success returns daq::is::Success.
Throws daq::is::InfoNotFound if such object doesn't exist, daq::is::RepositoryNotFound if IS server with the given name does not exist or daq::is::InvalidName if the given name does not contain Server/Object name separator (dot).
void
getValue( const std::string & name, ISInfo & info ) const;
Reads the value of the information object with the name name from the IS repository into the info object.
Throws daq::is::InfoNotFound if such object doesn't exist, daq::is::RepositoryNotFound if IS server with the given name does not exist, daq::is::InvalidName if the given name does not contain Server/Object name separator (dot).
The info object must be of the same type or be of a super-type of the information object associated with the name name. Otherwise this function throws daq::is::InfoNotCompatible exception and doesn't change the info object.
void
remove(const std::string & name) const;
Removes information object associated with the name name from the IS repository.
Throws daq::is::InfoNotFound if such object doesn't exist, daq::is::RepositoryNotFound if IS server with the given name does not exist or daq::is::InvalidName if the given name does not contain Server/Object name separator (dot).
void
update(const std::string & 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.
Throws daq::is::InfoNotFound if such object doesn't exist, daq::is::RepositoryNotFound if IS server with the given name does not exist, daq::is::InvalidName if the given name does not contain Server/Object name separator (dot).
The info object must be of the same type or be of a sub-type of the information object associated with the name name. Otherwise this function throws daq::is::InfoNotCompatible exception and doesn't change the info object.
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.
void
update(const std::string & name, int tag, ISInfo & info) const;
Updates the value tagged with the tag ID of the information object with the name name in the IS repository. New information value is taken from the info object. If there is no value associated with the tag ID, then the new value will be given that ID and it will be stored in IS.
Throws daq::is::InfoNotFound if such object doesn't exist, daq::is::RepositoryNotFound if IS server with the given name does not exist, daq::is::InvalidName if the given name does not contain Server/Object name separator (dot).
The info object must be of the same type or be of a sub-type of the information object associated with the name name. Otherwise this function throws daq::is::InfoNotCompatible exception and doesn't change the info object.
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>
void
getValues( const std::string & 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.
Throws daq::is::InfoNotFound if such object doesn't exist, daq::is::RepositoryNotFound if IS server with the given name does not exist or daq::is::InvalidName if the given name does not contain Server/Object name separator (dot).
The T object must have the same type as information object associated with the name name. Otherwise this function throws daq::is::InfoNotCompatible error and doesn't change the values vector.


2 July 1998 - WebMaster
Copyright © CERN 1998