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

15.12 ISInfoIterator


Synopsis
#include <is/infoiterator.h>
IPCPartition p( "MyPartition" );
ISInfoIterator it( p, "MyServer", ".*.old" );


Description

This class allows sequential access to the information objects in the IS repository.

The "current item" is undefined immediately after construction - you must define it by using operator() or some other valid operator. Any public function called on the invalid iterator causes daq::is::InvalidIterator exception being thrown.

The ISInfoIterator class constructor retrieves a list of information objects names from the IS repository. Information objects values are taken from the IS only when they are explicitly requested via the value method of the ISInfoIterator.


Example
1: #include "is/isinfo.h"
2:
3: IPCPartition p( "MyPartition" );
4: ISInfoIterator ii( p, "MyServer" );
5:
6: cout << "Information Server MyServer has " << ii.entries() << " information objects:" << endl;
7: while ( ii() ){
8: ISInfoAny isa;
9: ii.value(isa);
10: cout << ii.name() << " : " << ii.type() << " : " << isa << endl;
11: }


Public Constructors
ISInfoIterator( const IPCPartition & part, const char * sid, const ISCriteria & criteria = ISCriteria( ".*" ) );
Constructs new ISInfoIterator object which enumerates the information objects which match the criteria criteria in the sid IS server in the part IPC partition.


Public Member Operators
bool
operator()();
Advances the iterator one position. Returns true if new position is valid, false otherwise.
bool
operator++();
Advances the iterator one position. Returns true if new position is valid, false otherwise.
bool
operator--();
Retreats the iterator to the previous position. Returns true if new position is valid, false otherwise.
bool
operator++(int);
Advances the iterator one position. Returns true if new position is valid, false otherwise.
bool
operator--(int);
Retreats the iterator to the previous position. Returns true if new position is valid, false otherwise.


Public Member Functions
int
tag();

Returns tag of the most recent value of the information object at the current iterator position.

void
tags( std::vector<std::pair<int,OWLTime> > & tags ) const;
Reads all available history tags for the IS information object at the current iterator position. 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::RepositoryNotFound if IS server does not exist or daq::is::InvalidIterator if the iterator was not properly initialized or has reached to the end already.

OWLTime
time();
Returns time of the information at the iterator's current position. Returns time of the Epoch (00:00:00 UTC, January 1, 1970) if the current position is invalid.
 
ISType
type();
Returns type of the information at the iterator's current position. Returns "invalid" type if the current position is invalid. Invalid type is a type for which comparison operator with any other type always return false.
const char*
name();
Returns name of the information at the iterator's current position. Returns 0 if current position is invalid.
void
value(ISInfo & info);
Puts the value of the information at the iterator's current position to the info object and returns daq::is::Success. If type of the info object is not the same as type of the information object at the current iterator position, this function returns daq::is::IncompatibleType. May also return daq::is::CommFailure if the IS repository is not available anymore or daq::is::InvalidExpression if iterator's current position is not valid.
void
reset();
Reset the iterator to the state it had immediately after construction.
size_t
entries();
Returns the number of information objects in the iterator.


2 July 1998 - WebMaster
Copyright © CERN 1998