Main Page   Namespace List   Alphabetical List   Compound List   File List   Compound Members   File Members   Related Pages  

EventQueue Class Reference

#include <eventqueue.h>

List of all members.

Public Methods

 EventQueue (int num_threads)
 ~EventQueue ()
void Push (Event *event)
Event * Pop ()
int Size ()
bool IsOk ()

Private Methods

 EventQueue (EventQueue &)
EventQueue & operator= (EventQueue &)

Private Attributes

queue< Event * > mQue
 The queue of events - uses deque.

CRITICAL_SECTION mMutex
 To enforce mutual exclusion.


Detailed Description

The EventQueue class implements a thread safe queue upon which Events may be pushed and popped. It is a FIFO queue.

Definition at line 22 of file eventqueue.h.


Constructor & Destructor Documentation

EventQueue::EventQueue (  int    num_threads ) 
 

Constructor for EventQueue.

Parameters:
num_threads  The maximum number of threads allowed access to the queue.
Note:
One should check to see if this was properly initialized via IsOk.

Definition at line 26 of file eventqueue.cpp.

References mMutex.

EventQueue::~EventQueue (    ) 
 

Destructor for EventQueue.

Definition at line 39 of file eventqueue.cpp.

References mMutex.

EventQueue::EventQueue (  EventQueue &    )  [private]
 


Member Function Documentation

bool EventQueue::IsOk (    ) 
 

IsOk checks to see if the EventQueue was properly initialized.

Returns :
true if initialied or false if there was an error.

Definition at line 99 of file eventqueue.cpp.

Referenced by main().

EventQueue& EventQueue::operator= (  EventQueue &    )  [private]
 

Event * EventQueue::Pop (    ) 
 

Pops an Event onto the EventQueue. Client must destroy Event.

Returns :
The Event object on the top of the queue or NULL

Definition at line 68 of file eventqueue.cpp.

References mMutex, and mQue.

Referenced by Chat(), and Server::ProcessQueue().

void EventQueue::Push (  Event *    event ) 
 

Pushes and Event onto the EventQueue. Client must create Event.

Parameters:
event  The Event object to be pushed onto the queue

Definition at line 52 of file eventqueue.cpp.

References mMutex, and mQue.

Referenced by Server::AcceptConnection(), Chat(), Server::Run(), and Server::ShutdownServer().

int EventQueue::Size (    ) 
 

Size returns the number of Events contained in the EventQueue

Returns :
number of Events in the EventQueue

Definition at line 89 of file eventqueue.cpp.

References mMutex, and mQue.


Member Data Documentation

CRITICAL_SECTION EventQueue::mMutex [private]
 

To enforce mutual exclusion.

Definition at line 35 of file eventqueue.h.

Referenced by EventQueue(), Pop(), Push(), Size(), and ~EventQueue().

queue<Event*> EventQueue::mQue [private]
 

The queue of events - uses deque.

Definition at line 34 of file eventqueue.h.

Referenced by Pop(), Push(), and Size().


The documentation for this class was generated from the following files:
Generated on Mon Mar 29 23:12:57 2004 for Paradigm by doxygen1.2.17