Contents User Forum Source Index APIs by Task APIs by Level Data


G3D::Conduit Class Reference

#include <NetworkDevice.h>

Inherits G3D::ReferenceCountedObject.

Inherited by G3D::LightweightConduit, and G3D::ReliableConduit.

List of all members.

Public Member Functions

uint64 bytesReceived () const
uint64 bytesSent () const
uint64 messagesReceived () const
uint64 messagesSent () const
virtual bool messageWaiting ()
bool ok () const
void ReferenceCountedObject_zeroWeakPointers ()
virtual uint32 waitingMessageType ()=0
virtual ~Conduit ()

Public Attributes

AtomicInt32 ReferenceCountedObject_refCount
_WeakPtrLinkedListReferenceCountedObject_weakPointer

Protected Member Functions

 Conduit ()

Protected Attributes

BinaryOutput binaryOutput
uint64 bReceived
uint64 bSent
uint64 mReceived
uint64 mSent
SOCKET sock

Friends

class NetListener
class NetworkDevice


Constructor & Destructor Documentation

G3D::Conduit::Conduit (  )  [protected]

virtual G3D::Conduit::~Conduit (  )  [virtual]


Member Function Documentation

uint64 G3D::Conduit::bytesReceived (  )  const

uint64 G3D::Conduit::bytesSent (  )  const

uint64 G3D::Conduit::messagesReceived (  )  const

uint64 G3D::Conduit::messagesSent (  )  const

virtual bool G3D::Conduit::messageWaiting (  )  [virtual]

If true, receive will return true.

Reimplemented in G3D::ReliableConduit, and G3D::LightweightConduit.

bool G3D::Conduit::ok (  )  const

Returns true if the connection is ok.

void G3D::ReferenceCountedObject::ReferenceCountedObject_zeroWeakPointers (  )  [inline, inherited]

Automatically called immediately before the object is deleted.

This is not called from the destructor because it needs to be invoked before the subclass destructor.

virtual uint32 G3D::Conduit::waitingMessageType (  )  [pure virtual]

Returns the type of the waiting message (i.e.

the type supplied with send). The return value is zero when there is no message waiting.

One way to use this is to have a Table mapping message types to pre-allocated NetMessage subclasses so receiving looks like:

My base class for messages.
         class Message : public NetMessage {
             virtual void process() = 0;
         };

         Message* m = table[conduit->waitingMessageType()];
         conduit->receive(m);
         m->process();
     

Another is to simply SWITCH on the message type.

Implemented in G3D::ReliableConduit, and G3D::LightweightConduit.


Friends And Related Function Documentation

friend class NetListener [friend]

Reimplemented in G3D::ReliableConduit.

friend class NetworkDevice [friend]


Member Data Documentation

Used for serialization.

One per socket to make this threadsafe.

The long name is to keep this from accidentally conflicting with a subclass's variable name.

Do not use or explicitly manipulate this value--its type may change in the future and is not part of the supported API.

Linked list of all weak pointers that reference this (some may be on the stack!).

Do not use or explicitly manipulate this value.

SOCKET G3D::Conduit::sock [protected]


The documentation for this class was generated from the following file:
Generated on Thu Aug 2 11:40:45 2007 for G3D by doxygen 1.5.2
Hosted by SourceForge.net Logo