Panda3D
|
This flavor of ConnectionReader will read from its sockets and retain only the single most recent datagram for inspection by client code. More...
#include "recentConnectionReader.h"
Public Member Functions | |
RecentConnectionReader (ConnectionManager *manager) | |
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 RecentConnectionReader::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. |
This flavor of ConnectionReader will read from its sockets and retain only the single most recent datagram for inspection by client code.
It's useful particularly for reading telemetry-type data from UDP sockets where you don't care about getting every last socket, and in fact if the sockets are coming too fast you'd prefer to skip some of them.
This class will always create one thread for itself.
Definition at line 36 of file recentConnectionReader.h.
bool RecentConnectionReader::data_available | ( | ) |
Returns true if a datagram is available on the queue; call get_data() to extract the datagram.
Definition at line 54 of file recentConnectionReader.cxx.
bool RecentConnectionReader::get_data | ( | NetDatagram & | result | ) |
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 RecentConnectionReader).
Definition at line 72 of file recentConnectionReader.cxx.
Referenced by get_data().
bool RecentConnectionReader::get_data | ( | Datagram & | result | ) |
This flavor of RecentConnectionReader::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 95 of file recentConnectionReader.cxx.
References get_data().
void RecentConnectionReader::receive_datagram | ( | const NetDatagram & | datagram | ) | [protected, virtual] |
An internal function called by ConnectionReader() when a new datagram has become available.
The RecentConnectionReader simply queues it up for later retrieval by get_data().
Implements ConnectionReader.
Definition at line 113 of file recentConnectionReader.cxx.
References Datagram::get_length().