All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
UT_NetMessagePump Class Reference

#include <UT_NetMessage.h>

Public Member Functions

 UT_NetMessagePump ()
virtual ~UT_NetMessagePump ()
 On destruction all messages on our internal lists will be destroyed. More...
void postMessage (UT_NetMessage *msg)
void reset ()
 Resets, but does not free any messages it has. More...
UT_ValArray< UT_NetMessage * > & completed ()
UT_ValArray< UT_NetMessage * > & errored ()
void listenSocket (UT_NetSocket *socket)
void stopListening (UT_NetSocket *socket)
 Stops listening from a given socket. More...
bool pumpData (int timeoutms)
int pendingMessages () const
 The number of messages still pending. More...
void deleteSentMessages (bool shoulddelete)
void receiveAnnounce (bool receiveannounce)

Protected Attributes

bool myDeleteSent
bool myReceiveAnnounce
UT_ValArray< UT_NetMessage * > myWorkList
UT_ValArray< UT_NetMessage * > myErrorList
UT_ValArray< UT_NetMessage * > myCompleteList
UT_ValArray< UT_NetSocket * > myServerList

Detailed Description


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 239 of file UT_NetMessage.h.

Constructor & Destructor Documentation

UT_NetMessagePump::UT_NetMessagePump ( )
virtual UT_NetMessagePump::~UT_NetMessagePump ( )

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

Member Function Documentation

UT_ValArray<UT_NetMessage *>& UT_NetMessagePump::completed ( )

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 266 of file UT_NetMessage.h.

void UT_NetMessagePump::deleteSentMessages ( bool  shoulddelete)

Definition at line 290 of file UT_NetMessage.h.

UT_ValArray<UT_NetMessage *>& UT_NetMessagePump::errored ( )

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

Definition at line 271 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

The number of messages still pending.

Definition at line 288 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::receiveAnnounce ( bool  receiveannounce)

Definition at line 291 of file UT_NetMessage.h.

void UT_NetMessagePump::reset ( void  )

Resets, but does not free any messages it has.

Definition at line 252 of file UT_NetMessage.h.

void UT_NetMessagePump::stopListening ( UT_NetSocket socket)

Stops listening from a given socket.

Member Data Documentation

UT_ValArray<UT_NetMessage *> UT_NetMessagePump::myCompleteList

Definition at line 297 of file UT_NetMessage.h.

bool UT_NetMessagePump::myDeleteSent

Definition at line 293 of file UT_NetMessage.h.

UT_ValArray<UT_NetMessage *> UT_NetMessagePump::myErrorList

Definition at line 296 of file UT_NetMessage.h.

bool UT_NetMessagePump::myReceiveAnnounce

Definition at line 294 of file UT_NetMessage.h.

UT_ValArray<UT_NetSocket *> UT_NetMessagePump::myServerList

Definition at line 298 of file UT_NetMessage.h.

UT_ValArray<UT_NetMessage *> UT_NetMessagePump::myWorkList

Definition at line 295 of file UT_NetMessage.h.

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