12.11 ISInfoIterator
#include <is/infoiterator.h>
IPCPartition p( "MyPartition" );
ISInfoIterator it( p, "MyServer", ".*.old" );
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.
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.
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: }
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.
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.
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.
ISInfo::Status
value(ISInfo & info);
-
Puts the value of the information at the iterator's current position to the info object and returns ISInfo::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 ISInfo::IncompatibleType. May also return ISInfo::CommFailure if the IS repository is not available anymore or ISInfo::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 |