Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | File List | Class Members | File Members | Related Pages

CReactor Class Reference

#include <CReactor.h>

Inheritance diagram for CReactor:

CRegisteredObject CNamedObject CBufferReactor< T > CBufferReactor< U > CFdReactor CLocationReactor< T > CLocationReactor< U > CTimerEvent::CTimerGenericReactor CBufferEvent< T >::CGenericBufferReactor< U > CFileEvent::CFileEventReactor CLocationEvent< T >::CGenericLocationReactor< U > List of all members.

Public Member Functions

 CReactor ()
 CReactor (const STD(string)&rName)
 CReactor (const char *pName)
virtual ~CReactor ()
int operator== (const CReactor &aCReactor) const
virtual void operator() (CEventMonitor &rMonitor, CEventMonitor::result Reason)
virtual void OnEvent (CEventMonitor &rMonitor)
virtual void OnError (CEventMonitor &rMonitor)
virtual void OnTimeout (CEventMonitor &rMonitor)

Private Member Functions

 CReactor (const CReactor &aCReactor)
 For now copy construction is not allowed.
CReactoroperator= (const CReactor &aCReactor)
 For now assignment is illegal.

Detailed Description

Encapsulates the base class for reactors. A reactor is an object which responds to an event. This class hierarchy is of necessity slightly parallel to the Monitor hierarchy. In additional to the Named Object standard functions, all monitors must implement:

As a named object, CReactor's require a name on construction. The name is entered into the "Reactor" registry. As a convenience, a default constructor is supplied, however. If used the default constructor generates a name of the form Reactor_nnn where nnn is a unique number... from m_AutoIndex.

This base class provides: GetAutoName member function for derived classes which desire to implement this functionality as well.

Definition at line 331 of file CReactor.h.


Constructor & Destructor Documentation

CReactor::CReactor  ) 
 

Default constructor. A Reactor with name of the form Reactor_nnn is created. The reactor is entered in to the "Reactor" registry of the classified object registry returned from getCClassifiedObjectRegistry(). The name used is gaurenteed unique and can be queried via: getName().

Definition at line 326 of file CReactor.cpp.

References CNamedObject::AppendClassInfo(), and RegistryName.

CReactor::CReactor const STD(string)&  rName  ) 
 

CReactor::CReactor const char *  pName  ) 
 

Constructs a reactor given its name as an ASCIZ string:

Parameters:
pName - char* pointer to the desired object name.
Throws: -CDuplicateNameException (indirectly) if a Reactor of this name already exists.

Definition at line 359 of file CReactor.cpp.

References CNamedObject::AppendClassInfo(), and RegistryName.

CReactor::CReactor const CReactor aCReactor  )  [private]
 

For now copy construction is not allowed.

CReactor::~CReactor  )  [virtual]
 

Destructor: Just ensure that we are removed from the Reactors registry before being destroyed.

Definition at line 371 of file CReactor.cpp.

References CApplicationRegistry::getInstance(), RegistryName, and CClassifiedObjectRegistry::Remove().


Member Function Documentation

void CReactor::OnError CEventMonitor rEvent  )  [virtual]
 

Called when the event monitor detects an error while waiting for an event. In general, this class is subclassed, and the actual code for OnError is supplied by the subclass. In order to support classes which may not care about event monitor errors themselves, we provide an empty implementation of this function, preventing us from being an ABC.

Parameters:
rEvent - The monitor which detected the event.

Definition at line 452 of file CReactor.cpp.

Referenced by operator()().

void CReactor::OnEvent CEventMonitor rEvent  )  [virtual]
 

Called when the event occurs. This is called from operator(). In general, this class is subclassed, and the actual code for OnEvent is supplied by the subclass. In order to support classes which may not care about the event themselves, we provide an empty implementation of this function, preventing us from being an ABC.

Parameters:
rEvent - The monitor which detected the event.

Reimplemented in CBufferReactor< T >, CFdReactor, CLocationReactor< T >, CTimerEvent::CTimerGenericReactor, CBufferReactor< U >, and CLocationReactor< U >.

Definition at line 438 of file CReactor.cpp.

Referenced by operator()().

void CReactor::OnTimeout CEventMonitor rEvent  )  [virtual]
 

Called when an event monitor detects a timeout while waiting for the event. In general, this class is subclassed, and the actual code for OnTimeout is supplied by the subclass. In order to support classes which may not care about event monitor timeouts themselves, we provide an empty implementation of this function, preventing us from being an ABC.

Parameters:
rEvent - The monitor which detected the event.

Reimplemented in CBufferEvent< T >::CGenericBufferReactor< U >, CFileEvent::CFileEventReactor, CLocationEvent< T >::CGenericLocationReactor< U >, and CBufferEvent< T >::CGenericBufferReactor< T >.

Definition at line 466 of file CReactor.cpp.

Referenced by operator()().

void CReactor::operator() CEventMonitor rMonitor,
CEventMonitor::result  Reason
[virtual]
 

Operation Type: Interface Definition

Purpose:

This method is called in response ot an event from an event monitor on which this reactor has been established. The Reactor provides application specific procesing of the event.

Parameters:
rMonitor - The event monitor which fired off our reaction.
Reason - Why we were fired. Can be any of:
  • Ocurred - the event happened.
  • TimedOut - The event did not happen within the timeout.
  • Error - Some error occured on the event.
Throws:
  • CRangeError if an invalid Reason was passed in.

Definition at line 409 of file CReactor.cpp.

References OnError(), OnEvent(), and OnTimeout().

CReactor& CReactor::operator= const CReactor aCReactor  )  [private]
 

For now assignment is illegal.

int CReactor::operator== const CReactor aCReactor  )  const
 

Definition at line 379 of file CReactor.cpp.

References CRegisteredObject::operator==().

Referenced by CLocationReactor< T >::operator==(), CFdReactor::operator==(), and CBufferReactor< T >::operator==().


The documentation for this class was generated from the following files:
Generated on Thu Jan 6 16:58:44 2005 for Spectrodaq External Event Framework by  doxygen 1.3.9.1