#include <CEvent.h>
Inheritance diagram for CEvent:
Public Member Functions | |
CEvent (CEventMonitor &rMonitor, CReactor &rReactor, bool InformTimeouts=false, int nTimeoutMs=500) | |
CEvent (const char *pName, CEventMonitor &rMonitor, CReactor &rReactor, bool InformTimeouts=false, int nTimeoutMs=500) | |
CEvent (const STD(string)&rName, CEventMonitor &rMonitor, CReactor &rReactor, bool InformTimeouts=false, int nTimeoutMs=500) | |
virtual | ~CEvent () |
bool | isEnabled () const |
Return TRUE if the thread is enabled if not thread halt is pending. | |
bool | isActive () const |
Return TRUE if the thread is running (active) (small timing hole). | |
bool | getInformTimeout () const |
Return TRUE if Reactor also catches timeouts. | |
int | getMsReactivity () const |
Return the reactivity of the event to programmatic stimulus. | |
CEventMonitor & | getMonitor () |
Allow manipulation of the event monitor:. | |
CReactor & | getReactor () |
Allow manipulation of the event reactor:. | |
DAQThreadId | getThreadId () const |
Allow external manipulation of the thread:. | |
void | Enable () |
void | Disable () |
void | setReactivity (int nMs) |
void | setEnable (bool fEnable) |
void | ReactToTimeouts (bool fReact=true) |
virtual | STD (string) DescribeSelf() |
Protected Member Functions | |
void | setActive (bool fActive) |
Set state of active flag.. implies thread is running. | |
void | setTid (const DAQThreadId Tid) |
Set Thread ID: implies you know a lot about the system. | |
virtual void | OnEvent (CEventMonitor::result why) |
void | Schedule () |
virtual int | operator() (int nargs, char **ppArgs) |
virtual void | ProcessQueues () |
DAQStatus | JoinThis () |
Private Member Functions | |
CEvent (const CEvent &aCEvent) | |
Copy Constructor - not allowed. | |
CEvent & | operator= (const CEvent &aCEvent) |
Operator= Assignment Operator - not allowed. | |
int | operator== (const CEvent &aCEvent) const |
Operator== Equality Operator no point. | |
Private Attributes | |
bool | m_fEnabled |
Event enabled flag. | |
bool | m_fActive |
True if thread is active. | |
bool | m_InformTimeouts |
Pass timeouts on to reactor. | |
int | m_nMsReactivity |
Reactivity to external events. | |
CEventMonitor & | m_rMonitor |
Monitor which polls for event. | |
CReactor & | m_rReactor |
Reactor to the event when it fires. | |
DAQThreadId | m_Tid |
spectrodaq thread identifier. |
|
Construct an "anonymous" event object. Anonymous event objects have names like EventThread(unique_index). All Event objects will be registered in the "Event" registry of the application's global object classified registry.
Definition at line 363 of file CEvent.cpp. References CNamedObject::AppendClassInfo(), and RegistryName. |
|
Construct a named event object. See the previous overload of CEvent::CEvent for most of the descriptive information. However:
Definition at line 395 of file CEvent.cpp. References CNamedObject::AppendClassInfo(), and RegistryName. |
|
|
|
Destroys an instance of ourselves. This implies that our thread will exit. In general the destructor will not be called from this thread. Definition at line 447 of file CEvent.cpp. References Disable(). |
|
Copy Constructor - not allowed.
|
|
Disable execution of the event. A join is done with the event to ensure that it actually exits. There are two cases:
Definition at line 495 of file CEvent.cpp. References CThreadRecursiveMutex::getLockLevel(), CThreadRecursiveMutex::getOwningThread(), CThreadRecursiveMutex::Lock(), m_fEnabled, and CThreadRecursiveMutex::UnLockCompletely(). Referenced by ~CEvent(). |
|
Enable execution of the event. This is intended to be called from outside the Event thread. This allows us to directly schedule the object as a thread, rather than going through the rigmarole required by CEvent::Schedule
Reimplemented in CTimerEvent. Definition at line 465 of file CEvent.cpp. References CApplicationSerializer::getInstance(), CThreadRecursiveMutex::Lock(), m_fEnabled, m_Tid, and CThreadRecursiveMutex::UnLock(). Referenced by CTimerEvent::Enable(). |
|
Return TRUE if Reactor also catches timeouts.
|
|
Allow manipulation of the event monitor:.
Reimplemented in CBufferEvent< T >, CLocationEvent< T >, CTimerEvent, and CBufferEvent< U >. Definition at line 404 of file CEvent.h. Referenced by CFileEvent::MonitorExceptions(), CFileEvent::MonitorReadable(), CFileEvent::MonitorWritable(), and CFileEvent::~CFileEvent(). |
|
Return the reactivity of the event to programmatic stimulus.
|
|
Allow manipulation of the event reactor:.
Reimplemented in CBufferEvent< T >, CLocationEvent< T >, CTimerEvent, and CBufferEvent< U >. Definition at line 408 of file CEvent.h. Referenced by CFileEvent::~CFileEvent(). |
|
Allow external manipulation of the thread:.
|
|
Return TRUE if the thread is running (active) (small timing hole).
|
|
Return TRUE if the thread is enabled if not thread halt is pending.
|
|
Does a join on the current object. The assumption is that at some time this object exists as a thread and will exit to be joined before restarting. Definition at line 654 of file CEvent.cpp. References m_Tid. |
|
Called when the event monitor indicates that an event has occured. The default action (overridable) is to: 1. Lock the global serialization mutex. 2. Call the Event reactor's operator() member function. 3. Unlock the global serialization mutex.
Definition at line 581 of file CEvent.cpp. References CApplicationSerializer::getInstance(), CThreadRecursiveMutex::Lock(), m_rMonitor, m_rReactor, ProcessQueues(), and CThreadRecursiveMutex::UnLock(). Referenced by operator()(). |
|
This is the Event thread's entry point when scheduled.
Reimplemented in CLocationEvent< T >. Definition at line 632 of file CEvent.cpp. References m_fActive, m_nMsReactivity, m_rMonitor, m_Tid, OnEvent(), and CEventMonitor::setTimeout(). Referenced by CLocationEvent< T >::operator()(). |
|
Operator= Assignment Operator - not allowed.
|
|
Operator== Equality Operator no point.
|
|
Called periodically in event thread context to process any inter thread communication primitives which may require action at event context. Reimplemented in CBufferEvent< T >, and CBufferEvent< U >. Definition at line 666 of file CEvent.cpp. Referenced by OnEvent(). |
|
Determines whether or not Monitor timeouts will cause a reactor to be fired. Timeouts are used regardless in order to sense the dropping of the m_fEnabled flag. However if a timeout occurs and m_fInformTimeouts is false, the Reactor will not be called.
Definition at line 542 of file CEvent.cpp. References m_InformTimeouts. |
|
Called to schedule this process. Eric feels that it is not safe to just start this process off directly, e.g. from the constructor, because execution may start while the constructor is still executing either at this or a lower level of the class hierarchy if this is a class derived from CEvent. Therefore we do the following tricky startup:
Definition at line 611 of file CEvent.cpp. References m_fEnabled. |
|
Set state of active flag.. implies thread is running.
Definition at line 420 of file CEvent.h. References m_fActive. |
|
< Allows thread resident code to end event. Definition at line 433 of file CEvent.h. References m_fEnabled. Referenced by CTimerEvent::InternalOnTimer(), and CServerInstance::Shutdown(). |
|
Changes the Monitor timeout. This will take effect after the next exit from the monitor.. which may require as much as the current value of timeout.
Definition at line 528 of file CEvent.cpp. References m_nMsReactivity. Referenced by CTimerEvent::CTimerEvent(), CTimerEvent::Enable(), and CTimerEvent::SetTimeout(). |
|
Set Thread ID: implies you know a lot about the system.
Definition at line 424 of file CEvent.h. References m_Tid. |
|
The name of the object Reimplemented from CNamedObject. Reimplemented in CBufferEvent< T >, CBufferEvent< T >, CFileEvent, CLocationEvent< T >, CServerConnectionEvent, CServerInstance, CTimerEvent, CBufferEvent< U >, and CBufferEvent< U >. |
|
True if thread is active.
Definition at line 344 of file CEvent.h. Referenced by operator()(), and setActive(). |
|
Event enabled flag.
Definition at line 343 of file CEvent.h. Referenced by Disable(), Enable(), Schedule(), and setEnable(). |
|
Pass timeouts on to reactor.
Definition at line 345 of file CEvent.h. Referenced by ReactToTimeouts(). |
|
Reactivity to external events.
Definition at line 346 of file CEvent.h. Referenced by operator()(), and setReactivity(). |
|
Monitor which polls for event.
Reimplemented in CBufferEvent< T >, CLocationEvent< T >, CTimerEvent, and CBufferEvent< U >. Definition at line 347 of file CEvent.h. Referenced by OnEvent(), and operator()(). |
|
Reactor to the event when it fires.
Reimplemented in CBufferEvent< T >, CLocationEvent< T >, CTimerEvent, and CBufferEvent< U >. Definition at line 348 of file CEvent.h. Referenced by OnEvent(). |
|
spectrodaq thread identifier.
Definition at line 349 of file CEvent.h. Referenced by Enable(), JoinThis(), operator()(), and setTid(). |