vrpn 07.35
Virtual Reality Peripheral Network
Loading...
Searching...
No Matches
vrpn_Imager_Stream_Buffer Class Reference

#include <vrpn_Imager_Stream_Buffer.h>

Inheritance diagram for vrpn_Imager_Stream_Buffer:
Collaboration diagram for vrpn_Imager_Stream_Buffer:

Public Member Functions

 vrpn_Imager_Stream_Buffer (const char *name, const char *imager_server_name, vrpn_Connection *c)
virtual ~vrpn_Imager_Stream_Buffer ()
virtual void mainloop (void)
 Called once through each main loop iteration to handle updates. Remote object mainloop() should call client_mainloop() and then call d_connection->mainloop(). Server object mainloop() should service the device and then call server_mainloop(), but should not normally call d_connection->mainloop().
Public Member Functions inherited from vrpn_Auxiliary_Logger_Server
 vrpn_Auxiliary_Logger_Server (const char *name, vrpn_Connection *c)
Public Member Functions inherited from vrpn_Auxiliary_Logger
 vrpn_Auxiliary_Logger (const char *name, vrpn_Connection *c)
Public Member Functions inherited from vrpn_BaseClass
 vrpn_BaseClass (const char *name, vrpn_Connection *c=NULL)
 Names the device and assigns or opens connection, calls registration methods.
virtual ~vrpn_BaseClass ()
Public Member Functions inherited from vrpn_BaseClassUnique
 vrpn_BaseClassUnique ()
virtual ~vrpn_BaseClassUnique ()
 Unregister all of the message handlers that were to be autodeleted.
vrpn_ConnectionconnectionPtr ()
 Returns a pointer to the connection this object is using.
Public Member Functions inherited from vrpn_Imager_Server
 vrpn_Imager_Server (const char *name, vrpn_Connection *c, vrpn_int32 nCols, vrpn_int32 nRows, vrpn_int32 nDepth=1)
int add_channel (const char *name, const char *units="unsigned8bit", vrpn_float32 minVal=0, vrpn_float32 maxVal=255, vrpn_float32 scale=1, vrpn_float32 offset=0)
 Add a channel to the server, returns index of the channel or -1 on failure.
bool send_begin_frame (const vrpn_uint16 cMin, const vrpn_uint16 cMax, const vrpn_uint16 rMin, const vrpn_uint16 rMax, const vrpn_uint16 dMin=0, const vrpn_uint16 dMax=0, const struct timeval *time=NULL)
 Servers must send begin/end frame pairs around contiguous sections of the image.
bool send_end_frame (const vrpn_uint16 cMin, const vrpn_uint16 cMax, const vrpn_uint16 rMin, const vrpn_uint16 rMax, const vrpn_uint16 dMin=0, const vrpn_uint16 dMax=0, const struct timeval *time=NULL)
bool send_discarded_frames (const vrpn_uint16 count=0, const struct timeval *time=NULL)
bool send_region_using_base_pointer (vrpn_int16 chanIndex, vrpn_uint16 cMin, vrpn_uint16 cMax, vrpn_uint16 rMin, vrpn_uint16 rMax, const vrpn_uint8 *data, vrpn_uint32 colStride, vrpn_uint32 rowStride, vrpn_uint16 nRows=0, bool invert_rows=false, vrpn_uint32 depthStride=0, vrpn_uint16 dMin=0, vrpn_uint16 dMax=0, const struct timeval *time=NULL)
 Pack and send the region as efficiently as possible; strides are in steps of the element being sent.
bool send_region_using_base_pointer (vrpn_int16 chanIndex, vrpn_uint16 cMin, vrpn_uint16 cMax, vrpn_uint16 rMin, vrpn_uint16 rMax, const vrpn_uint16 *data, vrpn_uint32 colStride, vrpn_uint32 rowStride, vrpn_uint16 nRows=0, bool invert_rows=false, vrpn_uint32 depthStride=0, vrpn_uint16 dMin=0, vrpn_uint16 dMax=0, const struct timeval *time=NULL)
 As efficiently as possible, pull the values out of the array whose pointer is passed in and send them over a VRPN connection as a region message that is appropriate for the type that has been passed in (the type that data points to).
bool send_region_using_base_pointer (vrpn_int16 chanIndex, vrpn_uint16 cMin, vrpn_uint16 cMax, vrpn_uint16 rMin, vrpn_uint16 rMax, const vrpn_float32 *data, vrpn_uint32 colStride, vrpn_uint32 rowStride, vrpn_uint16 nRows=0, bool invert_rows=false, vrpn_uint32 depthStride=0, vrpn_uint16 dMin=0, vrpn_uint16 dMax=0, const struct timeval *time=NULL)
 As efficiently as possible, pull the values out of the array whose pointer is passed in and send them over a VRPN connection as a region message that is appropriate for the type that has been passed in (the type that data points to).
bool send_region_using_first_pointer (vrpn_int16 chanIndex, vrpn_uint16 cMin, vrpn_uint16 cMax, vrpn_uint16 rMin, vrpn_uint16 rMax, const vrpn_uint8 *data, vrpn_uint32 colStride, vrpn_uint32 rowStride, vrpn_uint16 nRows=0, bool invert_rows=false, vrpn_uint32 depthStride=0, vrpn_uint16 dMin=0, vrpn_uint16 dMax=0, const struct timeval *time=NULL)
 Pack and send the region as efficiently as possible; strides are in steps of the element being sent.
bool send_region_using_first_pointer (vrpn_int16 chanIndex, vrpn_uint16 cMin, vrpn_uint16 cMax, vrpn_uint16 rMin, vrpn_uint16 rMax, const vrpn_uint16 *data, vrpn_uint32 colStride, vrpn_uint32 rowStride, vrpn_uint16 nRows=0, bool invert_rows=false, vrpn_uint32 depthStride=0, vrpn_uint16 dMin=0, vrpn_uint16 dMax=0, const struct timeval *time=NULL)
 As efficiently as possible, pull the values out of the array whose pointer is passed in and send them over a VRPN connection as a region message that is appropriate for the type that has been passed in (the type that data points to).
bool send_region_using_first_pointer (vrpn_int16 chanIndex, vrpn_uint16 cMin, vrpn_uint16 cMax, vrpn_uint16 rMin, vrpn_uint16 rMax, const vrpn_float32 *data, vrpn_uint32 colStride, vrpn_uint32 rowStride, vrpn_uint16 nRows=0, bool invert_rows=false, vrpn_uint32 depthStride=0, vrpn_uint16 dMin=0, vrpn_uint16 dMax=0, const struct timeval *time=NULL)
 As efficiently as possible, pull the values out of the array whose pointer is passed in and send them over a VRPN connection as a region message that is appropriate for the type that has been passed in (the type that data points to).
bool set_resolution (vrpn_int32 nCols, vrpn_int32 nRows, vrpn_int32 nDepth=1)
 Set the resolution to a different value than it had been before. Returns true on success.
bool send_description (void)
 Sends a description of the imager so the remote can process the region messages.
Public Member Functions inherited from vrpn_Imager
 vrpn_Imager (const char *name, vrpn_Connection *c=NULL)
vrpn_int32 nRows (void) const
vrpn_int32 nCols (void) const
vrpn_int32 nDepth (void) const
vrpn_int32 nChannels (void) const

Protected Member Functions

virtual void handle_request_logging (const char *local_in_logfile_name, const char *local_out_logfile_name, const char *remote_in_logfile_name, const char *remote_out_logfile_name)
virtual void handle_request_logging_status ()
virtual void handle_dropped_last_connection (void)
virtual void handle_got_first_connection (void)
void logging_thread_func (void)
bool stop_logging_thread (void)
vrpn_Connectionopen_new_log_connection (const char *local_in_logfile_name, const char *local_out_logfile_name, const char *remote_in_logfile_name, const char *remote_out_logfile_name)
bool setup_handlers_for_logging_connection (vrpn_Connection *c)
bool teardown_handlers_for_logging_connection (vrpn_Connection *c)
bool make_new_logging_connection (const char *local_in_logfile_name, const char *local_out_logfile_name, const char *remote_in_logfile_name, const char *remote_out_logfile_name)
int handle_server_messages (const vrpn_HANDLERPARAM &p)
bool transcode_and_send (const vrpn_HANDLERPARAM &p)
vrpn_int32 transcode_type (vrpn_int32 type)
Protected Member Functions inherited from vrpn_Auxiliary_Logger_Server
bool send_report_logging (const char *local_in_logfile_name, const char *local_out_logfile_name, const char *remote_in_logfile_name, const char *remote_out_logfile_name)
Protected Member Functions inherited from vrpn_Auxiliary_Logger
virtual int register_types (void)
 Register the types of messages this device sends/receives. Return 0 on success, -1 on fail.
bool pack_log_message_of_type (vrpn_int32 type, const char *local_in_logfile_name, const char *local_out_logfile_name, const char *remote_in_logfile_name, const char *remote_out_logfile_name)
bool unpack_log_message_from_buffer (const char *buf, vrpn_int32 buflen, char **local_in_logfile_name, char **local_out_logfile_name, char **remote_in_logfile_name, char **remote_out_logfile_name)
Protected Member Functions inherited from vrpn_BaseClass
virtual int init (void)
 Initialize things that the constructor can't. Returns 0 on success, -1 on failure.
virtual int register_senders (void)
 Register the sender for this device (by default, the name of the device). Return 0 on success, -1 on fail.
Protected Member Functions inherited from vrpn_BaseClassUnique
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.
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.
SendTextMessageBoundCall send_text_message (vrpn_TEXT_SEVERITY type=vrpn_TEXT_NORMAL)
 Returns an object you can stream into to send a text message from the device like send_text_message(vrpn_TEXT_WARNING) << "Value of i is: " << i; This use requires including vrpn_SendTextMessageStreamProxy.h.
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().
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().
Protected Member Functions inherited from vrpn_Imager
virtual int register_types (void)
 Register the types of messages this device sends/receives. Return 0 on success, -1 on fail.

Static Protected Member Functions

static int VRPN_CALLBACK static_handle_request_logging (void *userdata, vrpn_HANDLERPARAM p)
static int VRPN_CALLBACK static_handle_throttle_message (void *userdata, vrpn_HANDLERPARAM p)
static int VRPN_CALLBACK static_handle_got_first_connection (void *userdata, vrpn_HANDLERPARAM p)
static void static_logging_thread_func (vrpn_ThreadData &threadData)
static void VRPN_CALLBACK handle_image_description (void *pvISB, const struct timeval msg_time)
static int VRPN_CALLBACK static_handle_server_messages (void *pvISB, vrpn_HANDLERPARAM p)
Static Protected Member Functions inherited from vrpn_Auxiliary_Logger_Server
static int VRPN_CALLBACK static_handle_dropped_last_connection (void *userdata, vrpn_HANDLERPARAM p)
static int VRPN_CALLBACK static_handle_request_logging (void *userdata, vrpn_HANDLERPARAM p)
static int VRPN_CALLBACK static_handle_request_logging_status (void *userdata, vrpn_HANDLERPARAM p)
Static Protected Member Functions inherited from vrpn_BaseClassUnique
static 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.
static 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.
Static Protected Member Functions inherited from vrpn_Imager_Server
static int VRPN_CALLBACK handle_ping_message (void *userdata, vrpn_HANDLERPARAM p)
static int VRPN_CALLBACK handle_throttle_message (void *userdata, vrpn_HANDLERPARAM p)
static int VRPN_CALLBACK handle_last_drop_message (void *userdata, vrpn_HANDLERPARAM p)

Protected Attributes

vrpn_int32 got_first_connection_m_id
vrpn_Imager_Stream_Shared_State d_shared_state
vrpn_Threadd_logging_thread
char * d_imager_server_name
bool d_ready_to_drop_old_connection
vrpn_Connectiond_log_connection
vrpn_Imager_Remoted_imager_remote
vrpn_int32 d_server_description_m_id
vrpn_int32 d_server_begin_frame_m_id
vrpn_int32 d_server_end_frame_m_id
vrpn_int32 d_server_discarded_frames_m_id
vrpn_int32 d_server_regionu8_m_id
vrpn_int32 d_server_regionu12in16_m_id
vrpn_int32 d_server_regionu16_m_id
vrpn_int32 d_server_regionf32_m_id
vrpn_int32 d_server_text_m_id
vrpn_int32 d_server_ping_m_id
vrpn_int32 d_server_pong_m_id
vrpn_uint16 d_server_dropped_due_to_throttle
vrpn_int32 d_server_frames_to_send
Protected Attributes inherited from vrpn_Auxiliary_Logger_Server
vrpn_int32 dropped_last_connection_m_id
Protected Attributes inherited from vrpn_Auxiliary_Logger
vrpn_int32 request_logging_m_id
vrpn_int32 report_logging_m_id
vrpn_int32 request_logging_status_m_id
Protected Attributes inherited from vrpn_BaseClassUnique
vrpn_Connectiond_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.
Protected Attributes inherited from vrpn_Imager_Server
bool d_description_sent
vrpn_int32 d_frames_to_send
vrpn_uint16 d_dropped_due_to_throttle
Protected Attributes inherited from vrpn_Imager
vrpn_int32 d_nRows
vrpn_int32 d_nCols
vrpn_int32 d_nDepth
vrpn_int32 d_nChannels
vrpn_Imager_Channel d_channels [vrpn_IMAGER_MAX_CHANNELS]
vrpn_int32 d_description_m_id
vrpn_int32 d_begin_frame_m_id
vrpn_int32 d_end_frame_m_id
vrpn_int32 d_discarded_frames_m_id
vrpn_int32 d_throttle_frames_m_id
vrpn_int32 d_regionu8_m_id
vrpn_int32 d_regionu12in16_m_id
vrpn_int32 d_regionu16_m_id
vrpn_int32 d_regionf32_m_id

Additional Inherited Members

Public Attributes inherited from vrpn_BaseClassUnique
bool shutup

Detailed Description

Definition at line 593 of file vrpn_Imager_Stream_Buffer.h.

Constructor & Destructor Documentation

◆ vrpn_Imager_Stream_Buffer()

◆ ~vrpn_Imager_Stream_Buffer()

vrpn_Imager_Stream_Buffer::~vrpn_Imager_Stream_Buffer ( )
virtual

Definition at line 89 of file vrpn_Imager_Stream_Buffer.C.

References d_imager_server_name, d_logging_thread, and stop_logging_thread().

Here is the call graph for this function:

Member Function Documentation

◆ handle_dropped_last_connection()

void vrpn_Imager_Stream_Buffer::handle_dropped_last_connection ( void )
protectedvirtual

Reimplemented from vrpn_Auxiliary_Logger_Server.

Definition at line 263 of file vrpn_Imager_Stream_Buffer.C.

References stop_logging_thread().

Referenced by static_handle_request_logging().

Here is the call graph for this function:

◆ handle_got_first_connection()

◆ handle_image_description()

◆ handle_request_logging()

void vrpn_Imager_Stream_Buffer::handle_request_logging ( const char * local_in_logfile_name,
const char * local_out_logfile_name,
const char * remote_in_logfile_name,
const char * remote_out_logfile_name )
protectedvirtual

◆ handle_request_logging_status()

void vrpn_Imager_Stream_Buffer::handle_request_logging_status ( )
protectedvirtual

Implements vrpn_Auxiliary_Logger_Server.

Definition at line 928 of file vrpn_Imager_Stream_Buffer.C.

References d_shared_state, and vrpn_Auxiliary_Logger_Server::send_report_logging().

Referenced by static_handle_request_logging().

Here is the call graph for this function:

◆ handle_server_messages()

◆ logging_thread_func()

void vrpn_Imager_Stream_Buffer::logging_thread_func ( void )
protected

◆ mainloop()

void vrpn_Imager_Stream_Buffer::mainloop ( void )
virtual

◆ make_new_logging_connection()

bool vrpn_Imager_Stream_Buffer::make_new_logging_connection ( const char * local_in_logfile_name,
const char * local_out_logfile_name,
const char * remote_in_logfile_name,
const char * remote_out_logfile_name )
protected

◆ open_new_log_connection()

vrpn_Connection * vrpn_Imager_Stream_Buffer::open_new_log_connection ( const char * local_in_logfile_name,
const char * local_out_logfile_name,
const char * remote_in_logfile_name,
const char * remote_out_logfile_name )
protected

Definition at line 696 of file vrpn_Imager_Stream_Buffer.C.

References d_imager_server_name, vrpn_Connection::doing_okay(), vrpn_get_connection_by_name(), and vrpn_gettimeofday.

Referenced by logging_thread_func(), and make_new_logging_connection().

Here is the call graph for this function:

◆ setup_handlers_for_logging_connection()

◆ static_handle_got_first_connection()

int vrpn_Imager_Stream_Buffer::static_handle_got_first_connection ( void * userdata,
vrpn_HANDLERPARAM p )
staticprotected

Definition at line 178 of file vrpn_Imager_Stream_Buffer.C.

References handle_got_first_connection(), vrpn_BaseClassUnique::userdata, and vrpn_Imager_Stream_Buffer().

Referenced by vrpn_Imager_Stream_Buffer().

Here is the call graph for this function:

◆ static_handle_request_logging()

int VRPN_CALLBACK vrpn_Imager_Stream_Buffer::static_handle_request_logging ( void * userdata,
vrpn_HANDLERPARAM p )
staticprotected

◆ static_handle_server_messages()

int VRPN_CALLBACK vrpn_Imager_Stream_Buffer::static_handle_server_messages ( void * pvISB,
vrpn_HANDLERPARAM p )
staticprotected

Definition at line 438 of file vrpn_Imager_Stream_Buffer.C.

References handle_server_messages(), and vrpn_Imager_Stream_Buffer().

Referenced by setup_handlers_for_logging_connection(), and teardown_handlers_for_logging_connection().

Here is the call graph for this function:

◆ static_handle_throttle_message()

int vrpn_Imager_Stream_Buffer::static_handle_throttle_message ( void * userdata,
vrpn_HANDLERPARAM p )
staticprotected

◆ static_logging_thread_func()

void vrpn_Imager_Stream_Buffer::static_logging_thread_func ( vrpn_ThreadData & threadData)
staticprotected

Definition at line 294 of file vrpn_Imager_Stream_Buffer.C.

References logging_thread_func(), vrpn_ThreadData::pvUD, and vrpn_Imager_Stream_Buffer().

Referenced by vrpn_Imager_Stream_Buffer().

Here is the call graph for this function:

◆ stop_logging_thread()

bool vrpn_Imager_Stream_Buffer::stop_logging_thread ( void )
protected

Definition at line 992 of file vrpn_Imager_Stream_Buffer.C.

References d_logging_thread, d_shared_state, vrpn_gettimeofday, vrpn_SleepMsecs(), and vrpn_TimevalDiff().

Referenced by handle_dropped_last_connection(), and ~vrpn_Imager_Stream_Buffer().

Here is the call graph for this function:

◆ teardown_handlers_for_logging_connection()

bool vrpn_Imager_Stream_Buffer::teardown_handlers_for_logging_connection ( vrpn_Connection * c)
protected

◆ transcode_and_send()

bool vrpn_Imager_Stream_Buffer::transcode_and_send ( const vrpn_HANDLERPARAM & p)
protected

◆ transcode_type()

Member Data Documentation

◆ d_imager_remote

◆ d_imager_server_name

◆ d_log_connection

vrpn_Connection* vrpn_Imager_Stream_Buffer::d_log_connection
protected

◆ d_logging_thread

vrpn_Thread* vrpn_Imager_Stream_Buffer::d_logging_thread
protected

◆ d_ready_to_drop_old_connection

bool vrpn_Imager_Stream_Buffer::d_ready_to_drop_old_connection
protected

◆ d_server_begin_frame_m_id

vrpn_int32 vrpn_Imager_Stream_Buffer::d_server_begin_frame_m_id
protected

◆ d_server_description_m_id

vrpn_int32 vrpn_Imager_Stream_Buffer::d_server_description_m_id
protected

◆ d_server_discarded_frames_m_id

vrpn_int32 vrpn_Imager_Stream_Buffer::d_server_discarded_frames_m_id
protected

◆ d_server_dropped_due_to_throttle

vrpn_uint16 vrpn_Imager_Stream_Buffer::d_server_dropped_due_to_throttle
protected

Definition at line 780 of file vrpn_Imager_Stream_Buffer.h.

Referenced by handle_server_messages(), and logging_thread_func().

◆ d_server_end_frame_m_id

vrpn_int32 vrpn_Imager_Stream_Buffer::d_server_end_frame_m_id
protected

◆ d_server_frames_to_send

vrpn_int32 vrpn_Imager_Stream_Buffer::d_server_frames_to_send
protected

Definition at line 781 of file vrpn_Imager_Stream_Buffer.h.

Referenced by handle_server_messages(), and logging_thread_func().

◆ d_server_ping_m_id

vrpn_int32 vrpn_Imager_Stream_Buffer::d_server_ping_m_id
protected

◆ d_server_pong_m_id

vrpn_int32 vrpn_Imager_Stream_Buffer::d_server_pong_m_id
protected

◆ d_server_regionf32_m_id

vrpn_int32 vrpn_Imager_Stream_Buffer::d_server_regionf32_m_id
protected

◆ d_server_regionu12in16_m_id

vrpn_int32 vrpn_Imager_Stream_Buffer::d_server_regionu12in16_m_id
protected

◆ d_server_regionu16_m_id

vrpn_int32 vrpn_Imager_Stream_Buffer::d_server_regionu16_m_id
protected

◆ d_server_regionu8_m_id

vrpn_int32 vrpn_Imager_Stream_Buffer::d_server_regionu8_m_id
protected

◆ d_server_text_m_id

vrpn_int32 vrpn_Imager_Stream_Buffer::d_server_text_m_id
protected

◆ d_shared_state

◆ got_first_connection_m_id

vrpn_int32 vrpn_Imager_Stream_Buffer::got_first_connection_m_id
protected

Definition at line 657 of file vrpn_Imager_Stream_Buffer.h.

Referenced by vrpn_Imager_Stream_Buffer().


The documentation for this class was generated from the following files: