|
vrpn
07.33
Virtual Reality Peripheral Network
|
#include <vrpn_SharedObject.h>


Classes | |
| struct | deferredUpdateCallbackEntry |
Public Member Functions | |
| 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 | |
| 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) |
| virtual void | sendUpdate (void)=0 |
| Should invoke default sendUpdate() for this derived type. More... | |
| virtual int | handleUpdate (vrpn_HANDLERPARAM)=0 |
Static Protected Member Functions | |
| 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 | |
| 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 123 of file vrpn_SharedObject.h.
| vrpn_SharedObject::vrpn_SharedObject | ( | const char * | name, |
| const char * | tname, | ||
| vrpn_int32 | mode | ||
| ) |
Definition at line 31 of file vrpn_SharedObject.C.
References d_lastUpdate, d_name, d_typename, and vrpn_gettimeofday.
|
virtual |
Definition at line 64 of file vrpn_SharedObject.C.
References d_assumeSerializer_type, d_connection, d_grantSerializer_type, d_myId, d_name, d_peerId, d_requestSerializer_type, d_typename, d_update_type, handle_assumeSerializer(), handle_gotConnection(), handle_grantSerializer(), handle_requestSerializer(), handle_update(), vrpn_Connection::register_message_type(), vrpn_Connection::removeReference(), vrpn_Connection::unregister_handler(), and vrpn_got_connection.

| void vrpn_SharedObject::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).
Definition at line 147 of file vrpn_SharedObject.C.
References d_connection, d_isNegotiatingSerializer, d_lastUpdate, d_myId, d_requestSerializer_type, vrpn_Connection::pack_message(), vrpn_CONNECTION_RELIABLE, and vrpn_gettimeofday.

|
virtual |
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.
Reimplemented in vrpn_Shared_String_Remote, vrpn_Shared_String_Server, vrpn_Shared_float64_Remote, vrpn_Shared_float64_Server, vrpn_Shared_int32_Remote, and vrpn_Shared_int32_Server.
Definition at line 98 of file vrpn_SharedObject.C.
References vrpn_Connection::addReference(), d_assumeSerializer_type, d_connection, d_grantSerializer_type, d_name, d_remoteId, d_requestSerializer_type, d_serverId, d_typename, d_update_type, vrpn_Connection::register_message_type(), vrpn_Connection::register_sender(), and vrpn_Connection::removeReference().
Referenced by vrpn_Shared_int32_Server::bindConnection(), vrpn_Shared_int32_Remote::bindConnection(), vrpn_Shared_float64_Server::bindConnection(), vrpn_Shared_float64_Remote::bindConnection(), vrpn_Shared_String_Server::bindConnection(), and vrpn_Shared_String_Remote::bindConnection().

|
staticprotected |
Definition at line 285 of file vrpn_SharedObject.C.
References d_isNegotiatingSerializer, and d_isSerializer.
Referenced by handle_update(), and ~vrpn_SharedObject().
|
staticprotected |
Register this handler in postBindCleanup(); < it calls sendUpdate() to make sure the remote has the < correct value on first connection.
Definition at line 326 of file vrpn_SharedObject.C.
References d_isSerializer, d_mode, d_myId, d_serverId, sendUpdate(), and VRPN_SO_DEFER_UPDATES.
Referenced by handle_update(), and ~vrpn_SharedObject().

|
staticprotected |
Definition at line 263 of file vrpn_SharedObject.C.
References d_assumeSerializer_type, d_connection, d_isNegotiatingSerializer, d_isSerializer, d_lastUpdate, d_myId, vrpn_Connection::pack_message(), vrpn_CONNECTION_RELIABLE, and vrpn_gettimeofday.
Referenced by handle_update(), and ~vrpn_SharedObject().

|
staticprotected |
Definition at line 224 of file vrpn_SharedObject.C.
References d_connection, d_grantSerializer_type, d_isNegotiatingSerializer, d_lastUpdate, d_myId, d_queueSets, isSerializer(), vrpn_Connection::pack_message(), vrpn_CONNECTION_RELIABLE, and vrpn_gettimeofday.
Referenced by handle_update(), and ~vrpn_SharedObject().

|
staticprotected |
Passes arguments to handleUpdate() for this type; < registered in postBindCleanup();.
Definition at line 349 of file vrpn_SharedObject.C.
References d_assumeSerializer_type, d_connection, d_grantSerializer_type, d_myId, d_peerId, d_requestSerializer_type, d_update_type, handle_assumeSerializer(), handle_gotConnection(), handle_grantSerializer(), handle_requestSerializer(), handleUpdate(), vrpn_Connection::register_handler(), vrpn_Connection::register_message_type(), and vrpn_got_connection.
Referenced by ~vrpn_SharedObject().

|
protectedpure virtual |
Implemented in vrpn_Shared_String, vrpn_Shared_float64, and vrpn_Shared_int32.
Referenced by handle_update().
| vrpn_bool vrpn_SharedObject::isSerializer | ( | void | ) | const |
Definition at line 95 of file vrpn_SharedObject.C.
Referenced by handle_requestSerializer().
| const char * vrpn_SharedObject::name | ( | void | ) | const |
Definition at line 93 of file vrpn_SharedObject.C.
References d_name.
| void vrpn_SharedObject::registerDeferredUpdateCallback | ( | vrpnDeferredUpdateCallback | cb, |
| 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.
Definition at line 170 of file vrpn_SharedObject.C.
References d_deferredUpdateCallbacks, vrpn_SharedObject::deferredUpdateCallbackEntry::handler, vrpn_SharedObject::deferredUpdateCallbackEntry::next, and vrpn_SharedObject::deferredUpdateCallbackEntry::userdata.
|
protected |
Definition at line 318 of file vrpn_SharedObject.C.
References d_myId, d_peerId, d_remoteId, and d_serverId.
Referenced by vrpn_Shared_int32_Remote::bindConnection(), vrpn_Shared_float64_Remote::bindConnection(), and vrpn_Shared_String_Remote::bindConnection().
|
protectedpure virtual |
Should invoke default sendUpdate() for this derived type.
Implemented in vrpn_Shared_String, vrpn_Shared_float64, and vrpn_Shared_int32.
Referenced by handle_gotConnection().
|
protected |
Definition at line 311 of file vrpn_SharedObject.C.
References d_myId, d_peerId, d_remoteId, and d_serverId.
Referenced by vrpn_Shared_int32_Server::bindConnection(), vrpn_Shared_float64_Server::bindConnection(), and vrpn_Shared_String_Server::bindConnection().
|
protectedvirtual |
Definition at line 189 of file vrpn_SharedObject.C.
References d_isSerializer, d_mode, and VRPN_SO_DEFER_UPDATES.
Referenced by vrpn_Shared_int32::set(), vrpn_Shared_float64::set(), and vrpn_Shared_String::set().
| void vrpn_SharedObject::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.
Definition at line 140 of file vrpn_SharedObject.C.
|
protected |
must set d_lastUpdate BEFORE calling yankCallbacks()
|
protected |
returns -1 on error (i.e. nonzero return by a callback)
Definition at line 298 of file vrpn_SharedObject.C.
References d_deferredUpdateCallbacks, vrpn_SharedObject::deferredUpdateCallbackEntry::handler, vrpn_SharedObject::deferredUpdateCallbackEntry::next, and vrpn_SharedObject::deferredUpdateCallbackEntry::userdata.
Referenced by vrpn_Shared_int32::shouldAcceptUpdate(), vrpn_Shared_float64::shouldAcceptUpdate(), and vrpn_Shared_String::shouldAcceptUpdate().
|
protected |
Sent by a new serializer once it has been notified that < its request has been granted.
Definition at line 185 of file vrpn_SharedObject.h.
Referenced by bindConnection(), handle_grantSerializer(), handle_update(), and ~vrpn_SharedObject().
|
protected |
Definition at line 171 of file vrpn_SharedObject.h.
Referenced by becomeSerializer(), bindConnection(), handle_grantSerializer(), handle_requestSerializer(), handle_update(), vrpn_Shared_int32::sendUpdate(), vrpn_Shared_float64::sendUpdate(), vrpn_Shared_String::sendUpdate(), and ~vrpn_SharedObject().
|
protected |
Definition at line 223 of file vrpn_SharedObject.h.
Referenced by registerDeferredUpdateCallback(), and yankDeferredUpdateCallbacks().
|
protected |
Sent by the serializer to grant a request.
Definition at line 183 of file vrpn_SharedObject.h.
Referenced by bindConnection(), handle_requestSerializer(), handle_update(), and ~vrpn_SharedObject().
|
protected |
As long as we have inorder delivery, this should be < sufficient to keep us from getting many at once.
Definition at line 195 of file vrpn_SharedObject.h.
Referenced by becomeSerializer(), handle_assumeSerializer(), handle_grantSerializer(), and handle_requestSerializer().
|
protected |
default to vrpn_TRUE for servers, FALSE for remotes
Definition at line 193 of file vrpn_SharedObject.h.
Referenced by handle_assumeSerializer(), handle_gotConnection(), handle_grantSerializer(), vrpn_Shared_int32::shouldAcceptUpdate(), vrpn_Shared_float64::shouldAcceptUpdate(), vrpn_Shared_String::shouldAcceptUpdate(), shouldSendUpdate(), vrpn_Shared_float64_Server::vrpn_Shared_float64_Server(), vrpn_Shared_int32_Server::vrpn_Shared_int32_Server(), and vrpn_Shared_String_Server::vrpn_Shared_String_Server().
|
protected |
Definition at line 191 of file vrpn_SharedObject.h.
|
protected |
Definition at line 216 of file vrpn_SharedObject.h.
Referenced by vrpn_Shared_int32::handle_lamportUpdate().
|
protected |
Definition at line 168 of file vrpn_SharedObject.h.
Referenced by becomeSerializer(), handle_grantSerializer(), handle_requestSerializer(), vrpn_Shared_int32::sendUpdate(), vrpn_Shared_float64::sendUpdate(), vrpn_Shared_String::sendUpdate(), vrpn_Shared_int32::set(), vrpn_Shared_float64::set(), vrpn_Shared_String::set(), vrpn_Shared_int32::shouldAcceptUpdate(), vrpn_Shared_float64::shouldAcceptUpdate(), vrpn_Shared_String::shouldAcceptUpdate(), vrpn_Shared_float64::vrpn_Shared_float64(), vrpn_Shared_String::vrpn_Shared_String(), vrpn_SharedObject(), vrpn_Shared_int32::yankCallbacks(), vrpn_Shared_float64::yankCallbacks(), and vrpn_Shared_String::yankCallbacks().
|
protected |
Definition at line 215 of file vrpn_SharedObject.h.
Referenced by vrpn_Shared_int32::handle_lamportUpdate(), and vrpn_Shared_int32::sendUpdate().
|
protected |
Definition at line 167 of file vrpn_SharedObject.h.
Referenced by handle_gotConnection(), vrpn_Shared_int32::shouldAcceptUpdate(), vrpn_Shared_float64::shouldAcceptUpdate(), vrpn_Shared_String::shouldAcceptUpdate(), and shouldSendUpdate().
|
protected |
Definition at line 177 of file vrpn_SharedObject.h.
Referenced by becomeSerializer(), handle_gotConnection(), handle_grantSerializer(), handle_requestSerializer(), handle_update(), remotePostBindCleanup(), vrpn_Shared_int32::sendUpdate(), vrpn_Shared_float64::sendUpdate(), vrpn_Shared_String::sendUpdate(), serverPostBindCleanup(), and ~vrpn_SharedObject().
|
protected |
Definition at line 166 of file vrpn_SharedObject.h.
Referenced by bindConnection(), name(), vrpn_Shared_float64::vrpn_Shared_float64(), vrpn_Shared_String::vrpn_Shared_String(), vrpn_SharedObject(), and ~vrpn_SharedObject().
|
protected |
Definition at line 178 of file vrpn_SharedObject.h.
Referenced by handle_update(), remotePostBindCleanup(), serverPostBindCleanup(), and ~vrpn_SharedObject().
|
protected |
If this is true, no set()s are processed; instead, they < are queued for later execution. < NOT IMPLEMENTED.
Definition at line 210 of file vrpn_SharedObject.h.
Referenced by handle_requestSerializer().
|
protected |
Definition at line 176 of file vrpn_SharedObject.h.
Referenced by bindConnection(), remotePostBindCleanup(), and serverPostBindCleanup().
|
protected |
Sent to the serializer to assume its duties.
Definition at line 181 of file vrpn_SharedObject.h.
Referenced by becomeSerializer(), bindConnection(), handle_update(), and ~vrpn_SharedObject().
|
protected |
Definition at line 175 of file vrpn_SharedObject.h.
Referenced by bindConnection(), handle_gotConnection(), remotePostBindCleanup(), and serverPostBindCleanup().
|
protected |
Definition at line 169 of file vrpn_SharedObject.h.
Referenced by bindConnection(), vrpn_SharedObject(), and ~vrpn_SharedObject().
|
protected |
Definition at line 179 of file vrpn_SharedObject.h.
Referenced by bindConnection(), handle_update(), vrpn_Shared_int32::sendUpdate(), vrpn_Shared_float64::sendUpdate(), vrpn_Shared_String::sendUpdate(), and ~vrpn_SharedObject().