UT_NetMessagePump Class Reference

#include <UT_NetMessage.h>

List of all members.

Public Member Functions

 UT_NetMessagePump ()
virtual ~UT_NetMessagePump ()
 On destruction all messages on our internal lists will be destroyed.
void postMessage (UT_NetMessage *msg)
UT_PtrArray< UT_NetMessage * > & completed ()
UT_PtrArray< UT_NetMessage * > & errored ()
void listenSocket (UT_NetSocket *socket)
void stopListening (UT_NetSocket *socket)
 Stops listening from a given socket.
bool pumpData (int timeoutms)
int pendingMessages () const
 The number of messages still pending.

Protected Attributes

UT_PtrArray< UT_NetMessage * > myWorkList
UT_PtrArray< UT_NetMessage * > myErrorList
UT_PtrArray< UT_NetMessage * > myCompleteList
UT_PtrArray< UT_NetSocket * > myServerList


Detailed Description

UT_NetMessagePump

Interleaves processing from possibly many different message sources.

postMessage() can be used to queue messages to send after their setWriteSocket and setWriteData has been invoked.

listenSocket() will invoke accept() and add to the completed() list messages as they are done.

Definition at line 194 of file UT_NetMessage.h.


Constructor & Destructor Documentation

UT_NetMessagePump::UT_NetMessagePump (  ) 

virtual UT_NetMessagePump::~UT_NetMessagePump (  )  [virtual]

On destruction all messages on our internal lists will be destroyed.


Member Function Documentation

UT_PtrArray<UT_NetMessage *>& UT_NetMessagePump::completed (  )  [inline]

List of all completed incoming messages.

To process a message from the completed list, UT_NetMessage *msg = pump.completed()(i); pump.completed()(i) = 0; ... use msg ... delete msg;

Definition at line 213 of file UT_NetMessage.h.

UT_PtrArray<UT_NetMessage *>& UT_NetMessagePump::errored (  )  [inline]

List of messages that have entered the error status. This includes failed outgoing messages as well as incomplete incoming messages.

Definition at line 218 of file UT_NetMessage.h.

void UT_NetMessagePump::listenSocket ( UT_NetSocket socket  ) 

Starts listening to the given socket for messages We do not own this socket, caller should delete it (but not before stopping listening or deleting the pump!) Connections accepted from this socket will be read via UT_NetMessage's protocol.

int UT_NetMessagePump::pendingMessages (  )  const [inline]

The number of messages still pending.

Definition at line 235 of file UT_NetMessage.h.

void UT_NetMessagePump::postMessage ( UT_NetMessage msg  ) 

Adds the message to our queue to process. We take ownership of the UT_NetMessage until it is removed from one of our lists.

bool UT_NetMessagePump::pumpData ( int  timeoutms  ) 

Processes active messages and listens for incoming messages. Returns true if there is the *potential* of more work - if listening to a socket this is always true!

void UT_NetMessagePump::stopListening ( UT_NetSocket socket  ) 

Stops listening from a given socket.


Member Data Documentation

Definition at line 239 of file UT_NetMessage.h.

Definition at line 238 of file UT_NetMessage.h.

Definition at line 240 of file UT_NetMessage.h.

Definition at line 237 of file UT_NetMessage.h.


The documentation for this class was generated from the following file:

Generated on Fri May 25 00:10:51 2012 for HDK by  doxygen 1.5.9