vrpn
07.33
Virtual Reality Peripheral Network
|
#include <vrpn_SharedObject.h>
Classes | |
struct | callbackEntry |
struct | timedCallbackEntry |
Public Member Functions | |
vrpn_Shared_int32 (const char *name, vrpn_int32 defaultValue=0, vrpn_int32 mode=VRPN_SO_DEFAULT) | |
virtual | ~vrpn_Shared_int32 (void) |
vrpn_int32 | value (void) const |
operator vrpn_int32 () const | |
vrpn_Shared_int32 & | operator= (vrpn_int32 newValue) |
vrpn_Shared_int32 & | set (vrpn_int32 newValue, timeval when) |
void | register_handler (vrpnSharedIntCallback, void *) |
void | unregister_handler (vrpnSharedIntCallback, void *) |
void | register_handler (vrpnTimedSharedIntCallback, void *) |
void | unregister_handler (vrpnTimedSharedIntCallback, void *) |
void | setSerializerPolicy (vrpn_SerializerPolicy policy=vrpn_ACCEPT, vrpnSharedIntSerializerPolicy f=NULL, void *userdata=NULL) |
![]() | |
vrpn_SharedObject (const char *name, const char *tname, vrpn_int32 mode) | |
virtual | ~vrpn_SharedObject (void) |
const char * | name (void) const |
vrpn_bool | isSerializer (void) const |
virtual void | bindConnection (vrpn_Connection *) |
Every derived class should call this, do what it needs to, and ALSO call {server,remote}PostBindCleanup() to get myId and peerId set up and to get standard handlers registered. More... | |
void | useLamportClock (vrpn_LamportClock *) |
Lamport Clocks are NOT currently integrated. They should provide serialization (virtual timestamps) that work even when the clocks of the computers communicating are not roughly synchronized. More... | |
void | becomeSerializer (void) |
Requests that this instance of the shared object becomes the serializer (i.e. lock-arbitrator), and we can then use setSerializerPolicy to imitate a complete lock. Does nothing if we already are the serializer (isSerializer() returns true); otherwise initiates a 3-phase request protocol with the current serializer. There currently isn't any provision for notification of success (or failure). More... | |
void | registerDeferredUpdateCallback (vrpnDeferredUpdateCallback, void *userdata) |
The specified function will be passed userdata when this particular shared object defers an update (receives a local update but is not the serializer and so sends the update off to the serializer). Intended to allow insertion of timing code for those times when you really want to know how long every little thing is taking. More... | |
Protected Member Functions | |
vrpn_Shared_int32 & | set (vrpn_int32, timeval, vrpn_bool isLocalSet, vrpn_LamportTimestamp *=NULL) |
virtual vrpn_bool | shouldAcceptUpdate (vrpn_int32 newValue, timeval when, vrpn_bool isLocalSet, vrpn_LamportTimestamp *) |
virtual void | sendUpdate (void) |
Should invoke default sendUpdate() for this derived type. More... | |
void | sendUpdate (vrpn_int32 newValue, timeval when) |
void | encode (char **buffer, vrpn_int32 *len, vrpn_int32 newValue, timeval when) const |
void | encodeLamport (char **buffer, vrpn_int32 *len, vrpn_int32 newValue, timeval when, vrpn_LamportTimestamp *t) const |
void | decode (const char **buffer, vrpn_int32 *len, vrpn_int32 *newValue, timeval *when) const |
void | decodeLamport (const char **buffer, vrpn_int32 *len, vrpn_int32 *newValue, timeval *when, vrpn_LamportTimestamp **t) const |
int | yankCallbacks (vrpn_bool isLocal) |
int | handleUpdate (vrpn_HANDLERPARAM) |
![]() | |
virtual vrpn_bool | shouldSendUpdate (vrpn_bool isLocalSet, vrpn_bool acceptedUpdate) |
int | yankCallbacks (vrpn_bool isLocal) |
must set d_lastUpdate BEFORE calling yankCallbacks() More... | |
int | yankDeferredUpdateCallbacks (void) |
returns -1 on error (i.e. nonzero return by a callback) More... | |
void | serverPostBindCleanup (void) |
void | remotePostBindCleanup (void) |
Static Protected Member Functions | |
static int VRPN_CALLBACK | handle_lamportUpdate (void *, vrpn_HANDLERPARAM) |
![]() | |
static int VRPN_CALLBACK | handle_requestSerializer (void *, vrpn_HANDLERPARAM) |
static int VRPN_CALLBACK | handle_grantSerializer (void *, vrpn_HANDLERPARAM) |
static int VRPN_CALLBACK | handle_assumeSerializer (void *, vrpn_HANDLERPARAM) |
static int VRPN_CALLBACK | handle_gotConnection (void *, vrpn_HANDLERPARAM) |
Register this handler in postBindCleanup(); it calls sendUpdate() to make sure the remote has the correct value on first connection. More... | |
static int VRPN_CALLBACK | handle_update (void *, vrpn_HANDLERPARAM) |
Passes arguments to handleUpdate() for this type; registered in postBindCleanup();. More... | |
Protected Attributes | |
vrpn_int32 | d_value |
callbackEntry * | d_callbacks |
timedCallbackEntry * | d_timedCallbacks |
vrpn_SerializerPolicy | d_policy |
vrpnSharedIntSerializerPolicy | d_policyCallback |
void * | d_policyUserdata |
![]() | |
char * | d_name |
vrpn_int32 | d_mode |
timeval | d_lastUpdate |
char * | d_typename |
vrpn_Connection * | d_connection |
vrpn_int32 | d_serverId |
vrpn_int32 | d_remoteId |
vrpn_int32 | d_myId |
vrpn_int32 | d_peerId |
vrpn_int32 | d_update_type |
vrpn_int32 | d_requestSerializer_type |
Sent to the serializer to assume its duties. More... | |
vrpn_int32 | d_grantSerializer_type |
Sent by the serializer to grant a request. More... | |
vrpn_int32 | d_assumeSerializer_type |
Sent by a new serializer once it has been notified that its request has been granted. More... | |
vrpn_int32 | d_lamportUpdate_type |
vrpn_bool | d_isSerializer |
default to vrpn_TRUE for servers, FALSE for remotes More... | |
vrpn_bool | d_isNegotiatingSerializer |
As long as we have inorder delivery, this should be sufficient to keep us from getting many at once. More... | |
vrpn_bool | d_queueSets |
If this is true, no set()s are processed; instead, they are queued for later execution. NOT IMPLEMENTED. More... | |
vrpn_LamportClock * | d_lClock |
vrpn_LamportTimestamp * | d_lastLamportUpdate |
deferredUpdateCallbackEntry * | d_deferredUpdateCallbacks |
Definition at line 247 of file vrpn_SharedObject.h.
vrpn_Shared_int32::vrpn_Shared_int32 | ( | const char * | name, |
vrpn_int32 | defaultValue = 0 , |
||
vrpn_int32 | mode = VRPN_SO_DEFAULT |
||
) |
Definition at line 384 of file vrpn_SharedObject.C.
|
virtual |
Definition at line 397 of file vrpn_SharedObject.C.
|
protected |
Definition at line 648 of file vrpn_SharedObject.C.
References vrpn_unbuffer().
Referenced by handleUpdate().
|
protected |
Definition at line 654 of file vrpn_SharedObject.C.
References vrpn_LamportTimestamp, and vrpn_unbuffer().
Referenced by handle_lamportUpdate().
|
protected |
Definition at line 629 of file vrpn_SharedObject.C.
References vrpn_buffer().
Referenced by sendUpdate().
|
protected |
Definition at line 635 of file vrpn_SharedObject.C.
References vrpn_LamportTimestamp::size(), and vrpn_buffer().
Referenced by sendUpdate().
|
staticprotected |
Definition at line 734 of file vrpn_SharedObject.C.
References vrpn_HANDLERPARAM::buffer, vrpn_SharedObject::d_lastLamportUpdate, vrpn_SharedObject::d_lClock, decodeLamport(), vrpn_HANDLERPARAM::payload_len, vrpn_LamportClock::receive(), and set().
|
protectedvirtual |
Implements vrpn_SharedObject.
Definition at line 717 of file vrpn_SharedObject.C.
References vrpn_HANDLERPARAM::buffer, decode(), vrpn_HANDLERPARAM::payload_len, and set().
vrpn_Shared_int32::operator vrpn_int32 | ( | ) | const |
Definition at line 407 of file vrpn_SharedObject.C.
vrpn_Shared_int32 & vrpn_Shared_int32::operator= | ( | vrpn_int32 | newValue | ) |
Definition at line 409 of file vrpn_SharedObject.C.
References set(), and vrpn_gettimeofday.
Referenced by vrpn_Shared_int32_Server::operator=(), and vrpn_Shared_int32_Remote::operator=().
void vrpn_Shared_int32::register_handler | ( | vrpnSharedIntCallback | cb, |
void * | userdata | ||
) |
Definition at line 420 of file vrpn_SharedObject.C.
References d_callbacks, vrpn_Shared_int32::callbackEntry::handler, vrpn_Shared_int32::callbackEntry::next, and vrpn_Shared_int32::callbackEntry::userdata.
void vrpn_Shared_int32::register_handler | ( | vrpnTimedSharedIntCallback | cb, |
void * | userdata | ||
) |
Definition at line 456 of file vrpn_SharedObject.C.
References d_timedCallbacks, vrpn_Shared_int32::timedCallbackEntry::handler, vrpn_Shared_int32::timedCallbackEntry::next, and vrpn_Shared_int32::timedCallbackEntry::userdata.
|
protectedvirtual |
Should invoke default sendUpdate() for this derived type.
Implements vrpn_SharedObject.
Definition at line 673 of file vrpn_SharedObject.C.
References vrpn_SharedObject::d_lastUpdate, and d_value.
Referenced by set().
|
protected |
Definition at line 675 of file vrpn_SharedObject.C.
References vrpn_SharedObject::d_connection, vrpn_SharedObject::d_lastUpdate, vrpn_SharedObject::d_lClock, vrpn_SharedObject::d_myId, vrpn_SharedObject::d_update_type, encode(), encodeLamport(), vrpn_LamportClock::getTimestampAndAdvance(), vrpn_Connection::pack_message(), and vrpn_CONNECTION_RELIABLE.
vrpn_Shared_int32 & vrpn_Shared_int32::set | ( | vrpn_int32 | newValue, |
timeval | when | ||
) |
Definition at line 416 of file vrpn_SharedObject.C.
Referenced by handle_lamportUpdate(), handleUpdate(), and operator=().
|
protected |
Definition at line 501 of file vrpn_SharedObject.C.
References vrpn_SharedObject::d_lastUpdate, d_value, sendUpdate(), shouldAcceptUpdate(), vrpn_SharedObject::shouldSendUpdate(), and yankCallbacks().
void vrpn_Shared_int32::setSerializerPolicy | ( | vrpn_SerializerPolicy | policy = vrpn_ACCEPT , |
vrpnSharedIntSerializerPolicy | f = NULL , |
||
void * | userdata = NULL |
||
) |
Definition at line 492 of file vrpn_SharedObject.C.
References d_policy, d_policyCallback, and d_policyUserdata.
|
protectedvirtual |
Definition at line 526 of file vrpn_SharedObject.C.
References vrpn_SharedObject::d_isSerializer, vrpn_SharedObject::d_lastUpdate, vrpn_SharedObject::d_mode, d_policy, d_policyCallback, d_policyUserdata, d_value, vrpn_ACCEPT, vrpn_CALLBACK, vrpn_DENY_LOCAL, VRPN_SO_DEFER_UPDATES, VRPN_SO_IGNORE_IDEMPOTENT, VRPN_SO_IGNORE_OLD, vrpn_TimevalEqual(), vrpn_TimevalGreater(), and vrpn_SharedObject::yankDeferredUpdateCallbacks().
Referenced by set().
void vrpn_Shared_int32::unregister_handler | ( | vrpnSharedIntCallback | cb, |
void * | userdata | ||
) |
Definition at line 435 of file vrpn_SharedObject.C.
References d_callbacks, vrpn_Shared_int32::callbackEntry::handler, vrpn_Shared_int32::callbackEntry::next, and vrpn_Shared_int32::callbackEntry::userdata.
void vrpn_Shared_int32::unregister_handler | ( | vrpnTimedSharedIntCallback | cb, |
void * | userdata | ||
) |
Definition at line 471 of file vrpn_SharedObject.C.
References d_timedCallbacks, vrpn_Shared_int32::timedCallbackEntry::handler, vrpn_Shared_int32::timedCallbackEntry::next, and vrpn_Shared_int32::timedCallbackEntry::userdata.
vrpn_int32 vrpn_Shared_int32::value | ( | void | ) | const |
Definition at line 405 of file vrpn_SharedObject.C.
References d_value.
|
protected |
Definition at line 698 of file vrpn_SharedObject.C.
References d_callbacks, vrpn_SharedObject::d_lastUpdate, d_timedCallbacks, d_value, vrpn_Shared_int32::callbackEntry::handler, vrpn_Shared_int32::timedCallbackEntry::handler, vrpn_Shared_int32::callbackEntry::next, vrpn_Shared_int32::timedCallbackEntry::next, vrpn_Shared_int32::callbackEntry::userdata, and vrpn_Shared_int32::timedCallbackEntry::userdata.
Referenced by set().
|
protected |
Definition at line 292 of file vrpn_SharedObject.h.
Referenced by register_handler(), unregister_handler(), and yankCallbacks().
|
protected |
Definition at line 329 of file vrpn_SharedObject.h.
Referenced by setSerializerPolicy(), and shouldAcceptUpdate().
|
protected |
Definition at line 330 of file vrpn_SharedObject.h.
Referenced by setSerializerPolicy(), and shouldAcceptUpdate().
|
protected |
Definition at line 331 of file vrpn_SharedObject.h.
Referenced by setSerializerPolicy(), and shouldAcceptUpdate().
|
protected |
Definition at line 298 of file vrpn_SharedObject.h.
Referenced by register_handler(), unregister_handler(), and yankCallbacks().
|
protected |
Definition at line 280 of file vrpn_SharedObject.h.
Referenced by sendUpdate(), set(), shouldAcceptUpdate(), value(), and yankCallbacks().