12.5 ISInfo
#include <is/info.h>
class MyInfo: public ISInfo { ... };
This is an abstract class that is used as base class for a user-defined information types.
1: class Person: public ISInfo {
2: public:
3: std::string name;
4: unsigned int age;
5:
6: Person( ) : ISInfo( "Person" )
7: { ; }
8:
9: void publishGuts( ISostream & out ){
10: out << name << age;
11: }
12:
13: void refreshGuts( ISistream & in ){
14: in >> name >> age;
15: }
16: };
17:
18: Person person;
19: ISInfoDictionary id;
20:
21: ISInfo::Status s;
22: s = id.getValue( "IS_Server_Name.Some_Person_Name", person );
23:
24: // send command to the person's information provider
25: if ( s == sucecss )
26: {
27: person.sendCommand( "hello" );
28: }
enum Status { Success, CommFailure, AlreadyExist, NotFound, InvalidInfo, IncompatibleType, InvalidExpression, RepositoryNotFound, ProviderNotFound, InvalidName };
-
Value of this type is returned by most of the methods of the C++ IS API.
enum Reason { Created, Updated, Deleted };
-
Value of this type is returned by the ISCallbackEvent::reason function.
ISInfo( const char * type_name = ISType::Unknown );
-
Constructs the information object. The type_name defines the name of the user defined information type.
virtual void
publishGuts( ISostream & out );
-
Writes the object's state to an output stream. User-defined class must implement this method by writing all class' attributes to the out stream.
virtual void
refreshGuts( ISistream & in );
-
Reads the object's state from an input stream. User-defined class must implement this method by reading all class' attributes from the in stream.
ISInfo::Status
sendCommand( const std::string & cmd ) const;
-
Send the cmd command to the provider of that information object. This function can be called only in case an information value has been successfully read from the IS repository using this information object. Returns ISInfo::Success if command was delivered to the information provider. Returns ISInfo::ProviderNotFound if the provider access information is not available. This happens if one tries to call this function using the uninitialized instance if the information class. Returns ISInfo::CommFailure the corresponding provider is not running.
bool
providerExists( ) const;
-
Returns true if provider of this information object exists. Returns false if either the corresponding provider is not running or the information object, which has been used to invoke this function was not properly initialized. The proper initialization means that this object must have been used to read an information value from the IS repository before calling the providerExists function.
ISType&
type( );
-
Returns reference to the information type. This type can be used for comparison and also for accessing the IS meta-type information.
OWLTime&
time();
-
Returns reference to the time of the last information update. For the just created information returns creation time. For the definition of the OWLTime class see [12].
2 July 1998 - WebMaster | Copyright © CERN 1998 |