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

#include <UT_NetMessage.h>

Public Member Functions

 UT_NetMessagePump ()
 
 ~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

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

Constructor & Destructor Documentation

UT_NetMessagePump::UT_NetMessagePump ( )
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 ( )
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 277 of file UT_NetMessage.h.

void UT_NetMessagePump::deleteSentMessages ( bool  shoulddelete)
inline

Definition at line 301 of file UT_NetMessage.h.

UT_ValArray<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 282 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 299 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)
inline

Definition at line 302 of file UT_NetMessage.h.

void UT_NetMessagePump::reset ( void  )
inline

Resets, but does not free any messages it has.

Definition at line 263 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
protected

Definition at line 308 of file UT_NetMessage.h.

bool UT_NetMessagePump::myDeleteSent
protected

Definition at line 304 of file UT_NetMessage.h.

UT_ValArray<UT_NetMessage *> UT_NetMessagePump::myErrorList
protected

Definition at line 307 of file UT_NetMessage.h.

bool UT_NetMessagePump::myReceiveAnnounce
protected

Definition at line 305 of file UT_NetMessage.h.

UT_ValArray<UT_NetSocket *> UT_NetMessagePump::myServerList
protected

Definition at line 309 of file UT_NetMessage.h.

UT_ValArray<UT_NetMessage *> UT_NetMessagePump::myWorkList
protected

Definition at line 306 of file UT_NetMessage.h.


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