Support Forum       G3D Web Page     
Public Member Functions | Protected Member Functions | Protected Attributes | Static Protected Attributes | Friends | List of all members
G3D::NetMessageIterator Class Reference

Iterates through new messages on a NetConnection. More...

Public Member Functions

NetMessageIteratorbegin ()
 
BinaryInputbinaryInput () const
 A BinaryInput for the current message. More...
 
NetChannel channel () const
 Application-defined channel on which this message was sent. More...
 
void * data () const
 The raw data bytes for the current message. More...
 
NetMessageIteratorend () const
 
BinaryInputheaderBinaryInput () const
 A BinaryInput for the current message's header. More...
 
bool isValid () const
 True if the data() and binaryInput() can be accessed for this message. More...
 
bool operator!= (const NetMessageIterator &other) const
 
NetMessageIteratoroperator++ ()
 Advance to the next message and deallocate the object referenced by binaryInput. More...
 
bool operator== (NetMessageIterator &other) const
 
size_t size () const
 Size of the data in bytes for the current message. More...
 
NetMessageType type () const
 Application-defined type header for this message. More...
 

Protected Member Functions

 NetMessageIterator ()
 

Protected Attributes

weak_ptr< NetConnectionm_connection
 The connection that owns the queue. More...
 
shared_ptr< _internal::NetMessageQueue > m_queue
 

Static Protected Attributes

static NetMessageIterator s_doneIterator
 

Friends

class _internal::NetClientSideConnection
 
class NetConnection
 
class NetServer
 

Detailed Description

Iterates through new messages on a NetConnection.

Note that a DISCONNECTED NetConnection may still have messages waiting in its queue to be processed.

Note that it is not possible to construct a NetMessageIterator (since nothing good could happen with it), so this must be initialized with a reference, e.g.,

    NetMessageIterator& msg = connection->incomingMessageIterator(); 
See also
NetConnection::newMessageIterator

Constructor & Destructor Documentation

◆ NetMessageIterator()

G3D::NetMessageIterator::NetMessageIterator ( )
protected

Member Function Documentation

◆ begin()

NetMessageIterator& G3D::NetMessageIterator::begin ( )
inline

◆ binaryInput()

BinaryInput& G3D::NetMessageIterator::binaryInput ( ) const

A BinaryInput for the current message.

This is allocated on demand and deallocated when the iterator is incremented with operator++. It is shared across copies of the iterator.

◆ channel()

NetChannel G3D::NetMessageIterator::channel ( ) const

Application-defined channel on which this message was sent.

◆ data()

void* G3D::NetMessageIterator::data ( ) const

The raw data bytes for the current message.

◆ end()

NetMessageIterator& G3D::NetMessageIterator::end ( ) const
inline

◆ headerBinaryInput()

BinaryInput& G3D::NetMessageIterator::headerBinaryInput ( ) const

A BinaryInput for the current message's header.

This is allocated on demand and deallocated when the iterator is incremented with operator++. It is shared across copies of the iterator.

◆ isValid()

bool G3D::NetMessageIterator::isValid ( ) const

True if the data() and binaryInput() can be accessed for this message.

Referenced by begin().

◆ operator!=()

bool G3D::NetMessageIterator::operator!= ( const NetMessageIterator other) const
inline

◆ operator++()

NetMessageIterator& G3D::NetMessageIterator::operator++ ( )

Advance to the next message and deallocate the object referenced by binaryInput.

Returns end() when the iterator is empty.

◆ operator==()

bool G3D::NetMessageIterator::operator== ( NetMessageIterator other) const
inline

◆ size()

size_t G3D::NetMessageIterator::size ( ) const

Size of the data in bytes for the current message.

◆ type()

NetMessageType G3D::NetMessageIterator::type ( ) const

Application-defined type header for this message.

Friends And Related Function Documentation

◆ _internal::NetClientSideConnection

friend class _internal::NetClientSideConnection
friend

◆ NetConnection

friend class NetConnection
friend

◆ NetServer

friend class NetServer
friend

Member Data Documentation

◆ m_connection

weak_ptr<NetConnection> G3D::NetMessageIterator::m_connection
protected

The connection that owns the queue.

◆ m_queue

shared_ptr<_internal::NetMessageQueue> G3D::NetMessageIterator::m_queue
protected

◆ s_doneIterator

NetMessageIterator G3D::NetMessageIterator::s_doneIterator
staticprotected

Referenced by begin(), and end().


documentation generated on Wed Nov 24 2021 08:01:58 using doxygen 1.8.15