15.15 ISInfoStream
#include <is/infostream.h>
IPCPartition p ( "MyPartition" );
ISInfoStream in( p, "MyServer" );
This class provides efficient way of fast information retrieval from the given IS server.
26: void main(void){
27: IPCPartition p;
28: ISInfoStream in(p, "MyServer");
29: while( !in.eof() )
30: {
31: std::cout << in.name() << " : " << in.type() << std::endl;
32: ISInfoAny isa;
33: in >> isa;
34: std::cout << isa << std::endl;
35: }
36: return 0;;
37: }
ISInfoStream( const IPCPartition & partition, const std::string & server_name, const ISCriteria & = ISCriteria( ".*" ), bool synchronous = false, int history_depth = 1);
-
Constructs new ISInfoStream object which can be used for read selected information from the serevr_name IS server. The criteria parameter defines the subset of the information to be retrieved. The synchronous parameter defines whether the constructor will return immediately after connection to the IS server (false) or after receiving all selected information from the IS server (true). On the latter case it's guaranteed that no further calls to the IS server will be made when the stream object is used for the actual information retrieval. The history_depth parameter tells how many history values for each information object have to be taken. Negative value means all.
ISInfoStream &
operator>>( ISInfo & info );
-
Copies the value of the information object at the current stream position to info, removes the current object from the stream and sets the stream position to the next object. Finally returns a reference to self.
-
User must make sure that the type of the object at the current stream position is matching the one of the info parameter, otherwise unmanageable assertion will be raised leading to the application termination.
template <class T>
ISInfoStream &
operator>>( std::vector<T> & values )
Copies the values.size() values of the information objects starting at the current stream position to values vector, removes all those objects from the stream and sets the stream position to the next object. Finally returns a reference to self.
User must make sure that the types of the values.size() objects starting at the current stream position are matching the one of the T parameter, otherwise unmanageable assertion will be raised leading to the application termination.
bool
eof() const;
-
Returns true if the end of the stream is reached, false otherwise.
const std::string &
name() const;
-
Returns the name of the information object at the current stream position.
void
skip( size_t entries = 1 );
-
Removes entries objects from the stream and sets the current stream position to the following entry. If the number of entries in the stream was less then the entries parameter then the new stream position will be set to EOF.
const ISType &
type() const;
-
Returns the type of the information object at the current stream position.
| 2 July 1998 - WebMaster | Copyright © CERN 1998 |