15.5 ISInfo
#include <is/info.h>
class MyInfo: public ISInfo { ... };
This is an abstract base class for any user-defined information type.
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: s = id.getValue( "IS_Server_Name.Some_Person_Name", person );
22:
23: // send command to the person's information provider
24: person.sendCommand( "hello" );
enum Reason { Created, Updated, Deleted };
-
Value of this type is returned by the ISCallbackEvent::reason function.
ISInfo( const std::string & 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.
void
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.
-
Throws daq::is::ProviderNotFound if 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.
const ISType&
type( );
-
Returns reference to the information type. This type can be used for comparison and also for accessing the IS meta-type information.
const 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 |