Go to the documentation of this file.00001 #ifndef baciEvent_H
00002 #define baciEvent_H
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00034 #ifndef __cplusplus
00035 #error This is a C++ include file and cannot be used from plain C
00036 #endif
00037
00038 #include <acsutil.h>
00039 #include <baci.h>
00040 #include <baciS.h>
00041 #include <vector>
00042 #include <baciRecoverableObject.h>
00043
00044 #include <ace/Synch.h>
00045
00046 namespace baci {
00047
00048
00049 class EventStrategy;
00050
00054
00055 typedef std::vector<EventStrategy*> EventStrategyVector;
00056
00064 class baci_EXPORT EventDispatcher
00065 {
00066
00067 public:
00068
00072 EventDispatcher();
00073
00078 virtual ~EventDispatcher();
00079
00085 int subscribe(EventStrategy * event);
00086
00092 int unsubscribe(EventStrategy * event);
00093
00098 virtual EventStrategyVector& getSubscribers();
00099
00103 virtual ACE_Recursive_Thread_Mutex& getMutex();
00104
00108 virtual void suspend() = 0;
00109
00113 virtual void resume() = 0;
00114
00115 protected:
00116
00120 virtual void destroyEvents();
00121
00125 EventStrategyVector events_m;
00126
00130 int active_m;
00131
00135 ACE_Recursive_Thread_Mutex mutex_m;
00136
00140 bool shutdown_m;
00141
00142 };
00143
00152 class baci_EXPORT EventStrategy : public virtual PortableServer::RefCountServantBase,
00153 public POA_ACS::Subscription,
00154 public RecoverableObject
00155 {
00156
00157 public:
00158
00162 EventStrategy() {}
00163
00169 EventStrategy(BACIProperty * property, EventDispatcher * eventDispatcher) {
00170 ACE_UNUSED_ARG(property);
00171 ACE_UNUSED_ARG(eventDispatcher);
00172 }
00173
00177 virtual ~EventStrategy() {}
00178
00184 virtual void check(BACIValue &value,
00185 const ACSErr::Completion & c,
00186 const ACS::CBDescOut & desc) = 0;
00187
00191 virtual bool isSuspended() = 0;
00192
00193
00194
00195 virtual int getId(void) = 0;
00196 virtual const char* getName(void) = 0;
00197 virtual const char* getObjectState(void) = 0;
00198 virtual void setObjectState(const char * state) = 0;
00199
00200
00201
00205 virtual void suspend () = 0;
00206
00210 virtual void resume () = 0;
00211
00215 virtual void destroy () = 0;
00216
00217 };
00218
00219 };
00220
00221 #endif
00222
00223
00224
00225
00226