#include <vrpn_BaseClass.h>
Class diagram for vrpn_BaseClassUnique:

Public Members | |||
![]() | ![]() | vrpn_BaseClassUnique () | |
![]() | ![]() | virtual | ~vrpn_BaseClassUnique () |
![]() | ![]() | Unregister all of the message handlers that were to be autodeleted. More... | |
![]() | ![]() | vrpn_MESSAGEHANDLER | handler |
![]() | ![]() | vrpn_int32 | sender |
![]() | ![]() | vrpn_int32 | type |
![]() | ![]() | void* | userdata |
Protected Members | |||
![]() | ![]() | int | register_autodeleted_handler (vrpn_int32 type, vrpn_MESSAGEHANDLER handler, void *userdata, vrpn_int32 sender = vrpn_ANY_SENDER) |
![]() | ![]() | Registers a handler with the connection, and remembers to delete at destruction. More... | |
![]() | ![]() | int | send_text_message (const char *msg, struct timeval timestamp, vrpn_TEXT_SEVERITY type = vrpn_TEXT_NORMAL, vrpn_uint32 level = 0) |
![]() | ![]() | Sends a NULL-terminated text message from the device d_sender_id. | |
![]() | ![]() | void | server_mainloop (void) |
![]() | ![]() | Handles functions that all servers should provide in their mainloop() (ping/pong, for example) Should be called by all servers in their mainloop(). More... | |
![]() | ![]() | void | client_mainloop (void) |
![]() | ![]() | Handles functions that all clients should provide in their mainloop() (warning of no server, for example) Should be called by all clients in their mainloop(). More... | |
![]() | ![]() | vrpn_Connection* | d_connection |
![]() | ![]() | Connection that this object talks to. | |
![]() | ![]() | char* | d_servicename |
![]() | ![]() | Name of this device, not including the connection part. | |
![]() | ![]() | vrpn_int32 | d_sender_id |
![]() | ![]() | Sender ID registered with the connection. | |
![]() | ![]() | vrpn_int32 | d_text_message_id |
![]() | ![]() | ID for text messages. | |
![]() | ![]() | vrpn_int32 | d_ping_message_id |
![]() | ![]() | Ask the server if they are there. | |
![]() | ![]() | vrpn_int32 | d_pong_message_id |
![]() | ![]() | Server telling that it is there. | |
Static Protected Members | |||
![]() | ![]() | int | encode_text_message_to_buffer ( char *buf, vrpn_TEXT_SEVERITY severity, vrpn_uint32 level, const char *msg) |
![]() | ![]() | Encodes the body of the text message into a buffer, preparing for sending. | |
![]() | ![]() | int | decode_text_message_from_buffer ( char *msg, vrpn_TEXT_SEVERITY *severity, vrpn_uint32 *level, const char *buf) |
![]() | ![]() | Decodes the body of the text message from a buffer from the connection. | |
Friends | |||
![]() | ![]() | class | vrpn_TextPrinter |
| vrpn_BaseClassUnique::vrpn_BaseClassUnique () |
vrpn_BaseClassUnique::~vrpn_BaseClassUnique () [virtual]
|
Unregister all of the message handlers that were to be autodeleted.
Delete space allocated in the constructor.
int vrpn_BaseClassUnique::register_autodeleted_handler (vrpn_int32 type, vrpn_MESSAGEHANDLER handler, void * userdata, vrpn_int32 sender = vrpn_ANY_SENDER) [protected]
|
Registers a handler with the connection, and remembers to delete at destruction.
It also keeps track of all of the handlers registered by an object and unregisters them automatically when the object is destroyed. This routine should be used, rather than the Connection one, to ensure that they are all unregistered. If they are not, and a message comes in after the object is destroyed, it will likely cause a Segmentation Violation.
The function returns 0 on success and -1 on failure.
int vrpn_BaseClassUnique::send_text_message (const char * msg, struct timeval timestamp, vrpn_TEXT_SEVERITY type = vrpn_TEXT_NORMAL, vrpn_uint32 level = 0) [protected]
|
Sends a NULL-terminated text message from the device d_sender_id.
void vrpn_BaseClassUnique::server_mainloop (void) [protected]
|
Handles functions that all servers should provide in their mainloop() (ping/pong, for example) Should be called by all servers in their mainloop().
It should be called each time through by each server's mainloop() function. Performed functions include: Sending pong ("server is alive") messages so that clients can know if they have connected to the server.
void vrpn_BaseClassUnique::client_mainloop (void) [protected]
|
Handles functions that all clients should provide in their mainloop() (warning of no server, for example) Should be called by all clients in their mainloop().
It should be called each time through a client's mainloop() function. Performed functions include: Handling the Ping/Pong messages that tell the client if the server is alive: Client initiates ping/pong cycle when client is created and when its connection is dropped This initiation is done the first time through client_mainloop() It is done again in a handler for the "dropped_connection" system message During ping/pong cycle, client sends ping requests once/second and waits for response At the start of the cycle, d_unanswered_ping is set to 1 and d_first_ping_time is set Handler for pong message sets d_unanswered_ping to 0 when we get one Prints warning messages every second after 3+ seconds with no pong Prints error messages every second after 10+ seconds with no pong (flatlined) Server responds to ping message with pong message Handler for ping set up the first time through server_mainloop()
int vrpn_BaseClassUnique::encode_text_message_to_buffer (char * buf, vrpn_TEXT_SEVERITY severity, vrpn_uint32 level, const char * msg) [static, protected]
|
Encodes the body of the text message into a buffer, preparing for sending.
int vrpn_BaseClassUnique::decode_text_message_from_buffer (char * msg, vrpn_TEXT_SEVERITY * severity, vrpn_uint32 * level, const char * buf) [static, protected]
|
Decodes the body of the text message from a buffer from the connection.
friend class vrpn_TextPrinter [friend]
|
| vrpn_MESSAGEHANDLER vrpn_BaseClassUnique::handler |
| vrpn_int32 vrpn_BaseClassUnique::sender |
| vrpn_int32 vrpn_BaseClassUnique::type |
| void* vrpn_BaseClassUnique::userdata |
vrpn_Connection* vrpn_BaseClassUnique::d_connection [protected]
|
Connection that this object talks to.
char* vrpn_BaseClassUnique::d_servicename [protected]
|
Name of this device, not including the connection part.
vrpn_int32 vrpn_BaseClassUnique::d_sender_id [protected]
|
Sender ID registered with the connection.
vrpn_int32 vrpn_BaseClassUnique::d_text_message_id [protected]
|
ID for text messages.
vrpn_int32 vrpn_BaseClassUnique::d_ping_message_id [protected]
|
Ask the server if they are there.
vrpn_int32 vrpn_BaseClassUnique::d_pong_message_id [protected]
|
Server telling that it is there.
1.0.0 written by Dimitri van Heesch,
© 1997-1999