12.13 ISInfoReceiver
IPCServer
#include <is/inforeceiver.h>
IPCPartition p ( "MyPartition" );
ISInfoReceiver isir( p );
This class provides the main interface for the subscriptions to the IS repository. By using the methods of this class an application can subscribe for the changes in the IS repository or remove previously created subscriptions.
1: void callback1(ISCallbackInfo * isc){
2: ISInfoInt isi;
3:
4: if ( isc->type() == isi.type() ){
5: isc->value(isi);
6: cout << isc->name() << " : " << isi << endl;
7: }
8: else
9: cout << isc->name() << " has unknown type " << isc->type() << endl;
10: }
11:
12: void callback2(ISCallbackInfo * isc){
13: ISInfoAny isa;
14: isc->value(isa);
15: cout << isc->name() << " has type " << isc->type() << endl;
16: cout << " and value : " << isa << endl;
17: }
18:
19: void main(void){
20: IPCPartition p;
21: ISInfoReceiver ir(p);
22: cerr << ir.subscribe( "MyServer.DeviceVoltage", callback1 ) << endl;
23: cerr << ir.subscribe( "MyServer", "Device.*", callback2 ) << endl;
24: ir.run();
25: }
ISInfoReceiver( );
-
Constructs new ISInfoReceiver object which can be used for access to the IS repository in the default IPC partition.
ISInfoReceiver( const IPCPartition & part );
-
Constructs new ISInfoReceiver object which can be used for access to the IS repository in the part IPC partition.
const IPCPartition &
partition();
-
Returns the partition in which this instance of the ISInfoReceiver has been created.
ISInfo::Status
subscribe( const char * name, ISCallbackInfo::Callback callback, void* param = 0);
-
Sets user callback that will be called each time the value of the information object associated with the name name is changed. The callback is a user function that will be called, param is the user parameter that will be passed to this function. On success returns ISInfo::Success. Returns ISInfo::CommFailure if the IS repository is not available. Returns ISInfo::AlreadyExist in case the same subscription has been already done via this instance of the ISInfoReceiver.
ISInfo::Status
subscribe( const char * name, ISCallbackEvent::Callback callback, void* param = 0);
-
Sets user callback that will be called each time the value of the information object associated with the name name is changed. The object value will not transported as part of the callback message. The callback is a user function that will be called, param is the user parameter that will be passed to this function. On success returns ISInfo::Success. Returns ISInfo::CommFailure if the IS repository is not available. Returns ISInfo::AlreadyExist in case the same subscription has been already done via this instance of the ISInfoReceiver.
ISInfo::Status
subscribe(const char * server_name, const ISCriteria & criteria, ISCallbackInfo::Callback callback, void* param = 0);
-
Sets user callback for the server_name IS server. The callback function will be invoked each time the information objects, which match the criteria criteria are changed. The param is the user parameter that will be passed to the callback function. On success returns ISInfo::Success. Returns ISInfo::CommFailure if the IS repository is not available. Returns ISInfo::AlreadyExist in case the same subscription has been already done via this instance of the ISInfoReceiver.
ISInfo::Status
subscribe(const char * server_name, const ISCriteria & criteria, ISCallbackEvent::Callback callback, void* param = 0);
-
Sets user callback for the server_name IS server. The callback function will be invoked each time the information objects, which match the criteria criteria are changed. The object value will not transported as part of the callback message. The param is the user parameter that will be passed to the callback function. On success returns ISInfo::Success. Returns ISInfo::CommFailure if the IS repository is not available. Returns ISInfo::AlreadyExist in case the same subscription has been already done via this instance of the ISInfoReceiver.
ISInfo::Status
unsubscribe( const char * name );
-
Removes subscription which has been previously done for the information object associated with the name name. On success returns ISInfo::Success. Returns ISInfo::NotFound if the subscription has not been done or has been already removed. Returns ISInfo::CommFailure if the IS repository is not available.
ISInfo::Status
unsubscribe(const char * server_name, const char * regexp);
-
Removes the subscription which has been previously done using the regexp regular expression to the server_name IS server. On success returns ISInfo::Success. Returns ISInfo::CommFailure if the IS repository is not available. Returns ISInfo::NotFound if the subscription has not been done or has been already removed.
Inherited Public Member Functions |
void
run();
-
Inherited from the IPCServer class. This method blocks the current thread of execution until the stop method of the same ISInfoReceiver instance is called.
void
stop();
-
Inherited from the IPCServer class. Unblock the thread which has been blocked by the run method of the same ISInfoReceiver instance.
2 July 1998 - WebMaster | Copyright © CERN 1998 |