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

CEventLoop Class Reference

#include <CEventLoop.h>

Inheritance diagram for CEventLoop:

CInterpreterStartup CXtEventLoop CTCLInterpreterStartup CTKInterpreterStartup List of all members.

Public Member Functions

 CEventLoop ()
virtual ~CEventLoop ()

Static Public Member Functions

CEventLoopgetInstance ()

Private Member Functions

virtual int operator() (int argc, char **argv)=0
 Singleton instance.
 CEventLoop (const CEventLoop &aCEventLoop)
CEventLoopoperator= (const CEventLoop &aCEventLoop)
 Not Implemented.
int operator== (const CEventLoop &aCEventLoop) const
 Not Implemented.

Static Private Attributes

CEventLoopm_pTheInstance = (CEventLoop*)NULL

Detailed Description

Encapsulates within a thread an application library which runs it's own event loop. Examples are Xt and Tcl/Tk. These systems include their own mechanisms for detecting and dispatching events to application and framework specific code.

Attempting to instantiate more than one instance of an event loop derived object results in a CDuplicateSingelton exception. Event loop derived processes implement operator() to initiate an event loop how they are used depends on the iindividual framework. Each of these event loops is supposed to ensure that event dispatching to application level code is synchronized through the application's mutex. It is legal to synchronize all such events or an "appropriate subset".

Definition at line 321 of file CEventLoop.h.


Constructor & Destructor Documentation

CEventLoop::CEventLoop  ) 
 

The Constructs an event loop. Since event loops are singletons, this function throws a CDuplicateSingleton if the m_pTheInstance variable is not null. If the variable is null, it is filled in with this.

Definition at line 329 of file CEventLoop.cpp.

References m_pTheInstance.

CEventLoop::~CEventLoop  )  [virtual]
 

The destructor sets the m_pTheInstance back to null. The assumption is that if derived classes catch the CDuplicateSingelton in their constructors, they will re-throw it. Since such objects would be not fully constructed, they would not be destroyed and hence the instance pointer would not get spuriously deleted.

Bug:
There is no good way to enforce that CDuplicateSingleton's don't result in spurious clears of the instance pointer.

Definition at line 354 of file CEventLoop.cpp.

References m_pTheInstance.

CEventLoop::CEventLoop const CEventLoop aCEventLoop  )  [private]
 

Copy construction, assignment and comparison are not allowed. therefore they are declared as private and not implemented.


Member Function Documentation

CEventLoop * CEventLoop::getInstance  )  [static]
 

Retrieves the instance pointer. If the instance variable is null, throws CNoSuchObject.

Definition at line 371 of file CEventLoop.cpp.

Referenced by CTCLInterpreterStartup::Tcl_Init(), and CTKInterpreterStartup::Tk_Init().

virtual int CEventLoop::operator() int  argc,
char **  argv
[private, pure virtual]
 

Singleton instance.

Implemented by subclasses to provide the actual event loop functionality. int argc, char** argv provide a mechanism for passing parameters to the event loop thread as if it was run from a main program.

Implemented in CInterpreterStartup, CTCLInterpreterStartup, CTKInterpreterStartup, and CXtEventLoop.

CEventLoop& CEventLoop::operator= const CEventLoop aCEventLoop  )  [private]
 

Not Implemented.

int CEventLoop::operator== const CEventLoop aCEventLoop  )  const [private]
 

Not Implemented.


Member Data Documentation

CEventLoop * CEventLoop::m_pTheInstance = (CEventLoop*)NULL [static, private]
 

CEventLoop* m_pTheInstance Contains a pointer to the single event loop instance allowed. If there are no instances of the singleton, this pointer is null. Note that GetInstance will not attempt to create a new instance since it does not know which element of the class hierarchy to create.

Definition at line 321 of file CEventLoop.cpp.

Referenced by CEventLoop(), and ~CEventLoop().


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