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

ssobjects::PacketMessageQue Class Reference

Thread-safe list of messages. More...

#include <packetmessageque.h>

List of all members.

Public Methods

 PacketMessageQue (bool bSetEvents=true)
virtual ~PacketMessageQue ()
void add (PacketMessage *)
 Adds msg to the end of the list. More...

PacketMessageget ()
 Returns the first item, and removes from the list. More...

bool isEmpty ()
 Checks if there are any messages in the message que. More...

void purge ()
 Remove all items from the msg list que. More...


Detailed Description

Thread-safe list of messages.

Works like a FIFO stack. Messages are added to the end of the list, and retrieved from the head of the list.

In the following example, we have added "Aa", "Bb" and "Cc" to the list in that order.

   ---[head]---
   [    Aa    ]
   [    Bb    ]
   [    Cc    ]
   ---[tail]---
   

When you call the get method, it will retrieve the head item - "Aa" - and remove it from the list. The next call will retrieve "Bb" and so on.

The server uses the message que to store all the messages that have been parsed. It then runs through the que and calls your message pump (see SimpleServer::processSingleMsg for further details.)


Constructor & Destructor Documentation

PacketMessageQue::PacketMessageQue bool    bSetEvents = true
 

Constructs a message que. When events are set, whenever a message is added to the que, the event will fire. This event however is not in use at the moment.

Parameters:
bSetEvents  Tells the message que to signal it's internal event when data is added to the que.

PacketMessageQue::~PacketMessageQue   [virtual]
 

Deletes all messages in this message que.


Member Function Documentation

void PacketMessageQue::add PacketMessage   pmsg
 

Adds msg to the end of the list.

Add a message to the tail end of the message que.

If the event flag is set, the event will be signaled.

Parameters:
pmsg  The message object containing the socket and packet information you wish to add to the message que.

PacketMessage * PacketMessageQue::get  
 

Returns the first item, and removes from the list.

Checks if there are any messages in the que and returns head (first) message if there is one. If there is a message pointer to be returned, it is removed from the message que, so subsiquent calls will return the next one. Works like a FIFO stack.

Returns:
NULL if there are no messages in the que, a pointer to the PacketMessage object otherwise.

bool PacketMessageQue::isEmpty  
 

Checks if there are any messages in the message que.

Returns:
true if there are any messages in the message que, false otherwise.

void PacketMessageQue::purge  
 

Remove all items from the msg list que.


The documentation for this class was generated from the following files:
Generated on Thu Nov 8 12:39:29 2001 for SimpleServerObjects by doxygen1.2.11 written by Dimitri van Heesch, © 1997-2001