Helper class that eliminates duplicates; only the first instance of a message is delivered. Registers a callback on connection for any type it's told to monitor; when it gets a message back, checks its list of recently-seen-timestamps for that type; if it isn't on the list, it's dispatched and replaces the oldest item on the list. List length is limited, so if too many messages of the same type (more than VRPN_RR_LENGTH) are interleaved - if transmissionInterval * numRetransmissions > VRPN_RR_LENGTH * the normal rate of message generation - it will not detect the redundant messages. More...
#include <vrpn_RedundantTransmission.h>
Classes | |
struct | RRMemory |
struct | RRRecord |
Public Member Functions | |
vrpn_RedundantReceiver (vrpn_Connection *) | |
virtual | ~vrpn_RedundantReceiver (void) |
virtual int | register_handler (vrpn_int32 type, vrpn_MESSAGEHANDLER handler, void *userdata, vrpn_int32 sender=vrpn_ANY_SENDER) |
virtual int | unregister_handler (vrpn_int32 type, vrpn_MESSAGEHANDLER handler, void *userdata, vrpn_int32 sender=vrpn_ANY_SENDER) |
void | record (vrpn_bool) |
Turns "memory" (tracking statistics of redundant reception) on and off. | |
void | writeMemory (const char *filename) |
Writes statistics to the named file: timestamp of every message received and number of copies of that message. Detects partial losses, but not when all copies are lost, since vrpn_RR doesn't expect messages. | |
void | clearMemory (void) |
Throws away / resets statistics. | |
Static Protected Member Functions | |
static int VRPN_CALLBACK | handle_possiblyRedundantMessage (void *, vrpn_HANDLERPARAM) |
Protected Attributes | |
vrpn_Connection * | d_connection |
RRRecord | d_records [vrpn_CONNECTION_MAX_TYPES] |
RRRecord | d_generic |
RRMemory * | d_memory |
RRMemory * | d_lastMemory |
vrpn_bool | d_record |
Helper class that eliminates duplicates; only the first instance of a message is delivered. Registers a callback on connection for any type it's told to monitor; when it gets a message back, checks its list of recently-seen-timestamps for that type; if it isn't on the list, it's dispatched and replaces the oldest item on the list. List length is limited, so if too many messages of the same type (more than VRPN_RR_LENGTH) are interleaved - if transmissionInterval * numRetransmissions > VRPN_RR_LENGTH * the normal rate of message generation - it will not detect the redundant messages.
Definition at line 157 of file vrpn_RedundantTransmission.h.
vrpn_RedundantReceiver::vrpn_RedundantReceiver | ( | vrpn_Connection * | c | ) |
Definition at line 415 of file vrpn_RedundantTransmission.C.
References d_connection, d_lastMemory, d_memory, and d_record.
Referenced by handle_possiblyRedundantMessage().
|
virtual |
Definition at line 427 of file vrpn_RedundantTransmission.C.
References d_connection, d_generic, d_records, vrpnMsgCallbackEntry::next, and vrpn_CONNECTION_MAX_TYPES.
void vrpn_RedundantReceiver::clearMemory | ( | void | ) |
Throws away / resets statistics.
Definition at line 587 of file vrpn_RedundantTransmission.C.
References d_lastMemory, d_memory, and vrpn_RedundantReceiver::RRMemory::next.
|
staticprotected |
Definition at line 605 of file vrpn_RedundantTransmission.C.
References vrpn_RedundantReceiver::RRRecord::cb, d_generic, d_lastMemory, d_memory, d_record, d_records, vrpnMsgCallbackEntry::handler, vrpn_HANDLERPARAM::msg_time, vrpn_RedundantReceiver::RRMemory::next, vrpnMsgCallbackEntry::next, vrpn_RedundantReceiver::RRRecord::nextTimestampToReplace, vrpn_RedundantReceiver::RRMemory::numSeen, vrpn_RedundantReceiver::RRRecord::numSeen, vrpn_HANDLERPARAM::sender, vrpnMsgCallbackEntry::sender, vrpn_RedundantReceiver::RRMemory::timestamp, vrpn_RedundantReceiver::RRRecord::timestampSeen, vrpn_HANDLERPARAM::type, vrpnMsgCallbackEntry::userdata, vrpn_ANY_SENDER, vrpn_RedundantReceiver(), and VRPN_RR_LENGTH.
Referenced by register_handler().
void vrpn_RedundantReceiver::record | ( | vrpn_bool | on | ) |
Turns "memory" (tracking statistics of redundant reception) on and off.
Definition at line 552 of file vrpn_RedundantTransmission.C.
References d_record.
|
virtual |
Definition at line 465 of file vrpn_RedundantTransmission.C.
References d_connection, d_generic, d_records, handle_possiblyRedundantMessage(), vrpnMsgCallbackEntry::handler, vrpnMsgCallbackEntry::next, vrpnMsgCallbackEntry::sender, vrpnMsgCallbackEntry::userdata, and vrpn_ANY_TYPE.
|
virtual |
Definition at line 509 of file vrpn_RedundantTransmission.C.
References d_generic, d_records, vrpnMsgCallbackEntry::handler, vrpnMsgCallbackEntry::next, vrpnMsgCallbackEntry::sender, vrpnMsgCallbackEntry::userdata, and vrpn_ANY_TYPE.
void vrpn_RedundantReceiver::writeMemory | ( | const char * | filename | ) |
Writes statistics to the named file: timestamp of every message received and number of copies of that message. Detects partial losses, but not when all copies are lost, since vrpn_RR doesn't expect messages.
Definition at line 554 of file vrpn_RedundantTransmission.C.
References d_memory, vrpn_RedundantReceiver::RRMemory::next, vrpn_RedundantReceiver::RRMemory::numSeen, and vrpn_RedundantReceiver::RRMemory::timestamp.
|
protected |
Definition at line 184 of file vrpn_RedundantTransmission.h.
Referenced by register_handler(), vrpn_RedundantReceiver(), and ~vrpn_RedundantReceiver().
|
protected |
Definition at line 198 of file vrpn_RedundantTransmission.h.
Referenced by handle_possiblyRedundantMessage(), register_handler(), unregister_handler(), and ~vrpn_RedundantReceiver().
|
protected |
Definition at line 207 of file vrpn_RedundantTransmission.h.
Referenced by clearMemory(), handle_possiblyRedundantMessage(), and vrpn_RedundantReceiver().
|
protected |
Definition at line 206 of file vrpn_RedundantTransmission.h.
Referenced by clearMemory(), handle_possiblyRedundantMessage(), vrpn_RedundantReceiver(), and writeMemory().
|
protected |
Definition at line 208 of file vrpn_RedundantTransmission.h.
Referenced by handle_possiblyRedundantMessage(), record(), and vrpn_RedundantReceiver().
|
protected |
Definition at line 197 of file vrpn_RedundantTransmission.h.
Referenced by handle_possiblyRedundantMessage(), register_handler(), unregister_handler(), and ~vrpn_RedundantReceiver().