Panda3D
Public Member Functions | Protected Member Functions
QueuedConnectionReader Class Reference

This flavor of ConnectionReader will read from its sockets and queue up all of the datagrams read for later receipt by the client code. More...

#include "queuedConnectionReader.h"

Inheritance diagram for QueuedConnectionReader:
ConnectionReader QueuedReturn< NetDatagram >

List of all members.

Public Member Functions

 QueuedConnectionReader (ConnectionManager *manager, int num_threads)
bool data_available ()
 Returns true if a datagram is available on the queue; call get_data() to extract the datagram.
bool get_data (NetDatagram &result)
 If a previous call to data_available() returned true, this function will return the datagram that has become available.
bool get_data (Datagram &result)
 This flavor of QueuedConnectionReader::get_data(), works like the other, except that it only fills a Datagram object, not a NetDatagram object.

Protected Member Functions

virtual void receive_datagram (const NetDatagram &datagram)
 An internal function called by ConnectionReader() when a new datagram has become available.

Detailed Description

This flavor of ConnectionReader will read from its sockets and queue up all of the datagrams read for later receipt by the client code.

This class is useful for client code that doesn't want to deal with threading and is willing to poll for datagrams at its convenience.

Definition at line 37 of file queuedConnectionReader.h.


Member Function Documentation

Returns true if a datagram is available on the queue; call get_data() to extract the datagram.

Definition at line 55 of file queuedConnectionReader.cxx.

References ConnectionReader::poll(), and QueuedReturn< NetDatagram >::thing_available().

Referenced by MayaToEggServer::poll().

If a previous call to data_available() returned true, this function will return the datagram that has become available.

The return value is true if a datagram was successfully returned, or false if there was, in fact, no datagram available. (This may happen if there are multiple threads accessing the QueuedConnectionReader).

Definition at line 77 of file queuedConnectionReader.cxx.

References QueuedReturn< NetDatagram >::get_thing().

Referenced by MayaToEggServer::poll().

This flavor of QueuedConnectionReader::get_data(), works like the other, except that it only fills a Datagram object, not a NetDatagram object.

This means that the Datagram cannot be queried for its source Connection and/or NetAddress, but it is useful in all other respects.

Definition at line 92 of file queuedConnectionReader.cxx.

References QueuedReturn< NetDatagram >::get_thing().

void QueuedConnectionReader::receive_datagram ( const NetDatagram datagram) [protected, virtual]

An internal function called by ConnectionReader() when a new datagram has become available.

The QueuedConnectionReader simply queues it up for later retrieval by get_data().

Implements ConnectionReader.

Definition at line 110 of file queuedConnectionReader.cxx.

References QueuedReturn< NetDatagram >::enqueue_thing().


The documentation for this class was generated from the following files:
 All Classes Functions Variables Enumerations