1#ifndef VRPN_IMAGER_STREAM_BUFFER_H
2#define VRPN_IMAGER_STREAM_BUFFER_H
32 d_first = d_last = NULL;
37 while (d_first != NULL) {
42 fprintf(stderr,
"vrpn_Message_List::~vrpn_Message_List(): delete failed\n");
50 unsigned size(
void)
const {
return d_count; }
66 if (d_first == NULL) {
84 if (d_last == d_first) {
88 d_first = d_first->
next;
92 fprintf(stderr,
"vrpn_Message_List::retrieve_front(): delete failed\n");
128 d_time_to_exit =
false;
129 d_description_updated =
false;
130 d_nRows = d_nCols = d_nDepth = d_nChannels = 0;
131 d_new_log_request =
false;
132 d_request_lil = NULL;
133 d_request_lol = NULL;
134 d_request_ril = NULL;
135 d_request_rol = NULL;
136 d_new_log_result =
false;
141 d_new_throttle_request =
false;
142 d_throttle_count = -1;
143 d_frames_in_queue = 0;
151 bool ret = d_time_to_exit;
157 d_time_to_exit = do_exit;
166 vrpn_int32 &nDepth, vrpn_int32 &nChannels,
167 const char **channelBuffer)
170 bool ret = d_description_updated;
171 if (d_description_updated) {
175 nChannels = d_nChannels;
176 *channelBuffer = d_channel_buffer;
178 d_description_updated =
false;
182 vrpn_int32 nDepth, vrpn_int32 nChannels,
183 const char *channelBuffer)
189 d_nChannels = nChannels;
190 d_channel_buffer = channelBuffer;
191 d_description_updated =
true;
208 bool ret = d_new_log_request;
209 if (d_new_log_request) {
212 if ((*lil =
new char[strlen(d_request_lil) + 1]) != NULL) {
213 strcpy(*lil, d_request_lil);
215 if ((*lol =
new char[strlen(d_request_lol) + 1]) != NULL) {
216 strcpy(*lol, d_request_lol);
218 if ((*ril =
new char[strlen(d_request_ril) + 1]) != NULL) {
219 strcpy(*ril, d_request_ril);
221 if ((*rol =
new char[strlen(d_request_rol) + 1]) != NULL) {
222 strcpy(*rol, d_request_rol);
227 delete[] d_request_lil;
228 d_request_lil = NULL;
229 delete[] d_request_lol;
230 d_request_lol = NULL;
231 delete[] d_request_ril;
232 d_request_ril = NULL;
233 delete[] d_request_rol;
234 d_request_rol = NULL;
236 fprintf(stderr,
"vrpn_Imager_Stream_Shared_State::get_logfile_request(): delete failed\n");
240 d_new_log_request =
false;
253 delete[] d_request_lil;
255 fprintf(stderr,
"vrpn_Imager_Stream_Shared_State::set_logfile_request(): delete failed\n");
258 d_request_lil = NULL;
262 delete[] d_request_lol;
264 fprintf(stderr,
"vrpn_Imager_Stream_Shared_State::set_logfile_request(): delete failed\n");
267 d_request_lol = NULL;
271 delete[] d_request_ril;
273 fprintf(stderr,
"vrpn_Imager_Stream_Shared_State::set_logfile_request(): delete failed\n");
276 d_request_ril = NULL;
280 delete[] d_request_rol;
282 fprintf(stderr,
"vrpn_Imager_Stream_Shared_State::set_logfile_request(): delete failed\n");
285 d_request_rol = NULL;
290 if ((d_request_lil =
new char[strlen(lil) + 1]) != NULL) {
291 strcpy(d_request_lil, lil);
295 if ((d_request_lol =
new char[strlen(lol) + 1]) != NULL) {
296 strcpy(d_request_lol, lol);
300 if ((d_request_ril =
new char[strlen(ril) + 1]) != NULL) {
301 strcpy(d_request_ril, ril);
305 if ((d_request_rol =
new char[strlen(rol) + 1]) != NULL) {
306 strcpy(d_request_rol, rol);
310 d_new_log_request =
true;
326 bool ret = d_new_log_result;
327 if (d_new_log_result) {
330 if (d_result_lil == NULL)
333 if ((*lil =
new char[strlen(d_result_lil) + 1]) != NULL) {
334 strcpy(*lil, d_result_lil);
337 if (d_result_lol == NULL)
340 if ((*lol =
new char[strlen(d_result_lol) + 1]) != NULL) {
341 strcpy(*lol, d_result_lol);
344 if (d_result_ril == NULL)
347 if ((*ril =
new char[strlen(d_result_ril) + 1]) != NULL) {
348 strcpy(*ril, d_result_ril);
351 if (d_result_rol == NULL)
354 if ((*rol =
new char[strlen(d_result_rol) + 1]) != NULL) {
355 strcpy(*rol, d_result_rol);
362 d_new_log_result =
false;
373 delete[] d_result_lil;
375 fprintf(stderr,
"vrpn_Imager_Stream_Shared_State::set_logfile_result(): delete failed\n");
382 delete[] d_result_lol;
384 fprintf(stderr,
"vrpn_Imager_Stream_Shared_State::set_logfile_result(): delete failed\n");
391 delete[] d_result_ril;
393 fprintf(stderr,
"vrpn_Imager_Stream_Shared_State::set_logfile_result(): delete failed\n");
400 delete[] d_result_rol;
402 fprintf(stderr,
"vrpn_Imager_Stream_Shared_State::set_logfile_result(): delete failed\n");
410 if ((d_result_lil =
new char[strlen(lil) + 1]) != NULL) {
411 strcpy(d_result_lil, lil);
415 if ((d_result_lol =
new char[strlen(lol) + 1]) != NULL) {
416 strcpy(d_result_lol, lol);
420 if ((d_result_ril =
new char[strlen(ril) + 1]) != NULL) {
421 strcpy(d_result_ril, ril);
425 if ((d_result_rol =
new char[strlen(rol) + 1]) != NULL) {
426 strcpy(d_result_rol, rol);
430 d_new_log_result =
true;
443 if (d_result_lil == NULL)
446 *local_in =
new char[strlen(d_result_lil) + 1];
447 strcpy(*local_in, d_result_lil);
449 if (d_result_lol == NULL)
452 *local_out =
new char[strlen(d_result_lol) + 1];
453 strcpy(*local_out, d_result_lol);
455 if (d_result_ril == NULL)
458 *remote_in =
new char[strlen(d_result_ril) + 1];
459 strcpy(*remote_in, d_result_ril);
461 if (d_result_rol == NULL)
464 *remote_out =
new char[strlen(d_result_rol) + 1];
465 strcpy(*remote_out, d_result_rol);
474 bool ret = d_new_throttle_request;
475 if (d_new_throttle_request) {
476 *throttle_count = d_throttle_count;
478 d_new_throttle_request =
false;
484 d_throttle_count = throttle_count;
485 d_new_throttle_request =
true;
495 vrpn_int32 ret = d_frames_in_queue;
502 vrpn_int32 ret = d_frames_in_queue;
509 vrpn_int32 ret = d_frames_in_queue;
518 vrpn_int32 ret = d_logger_to_client_messages.size();
524 bool ret = d_logger_to_client_messages.insert_back(p);
530 bool ret = d_logger_to_client_messages.retrieve_front(p);
614 virtual void mainloop(
void);
628 virtual void handle_request_logging(
const char *local_in_logfile_name,
629 const char *local_out_logfile_name,
630 const char *remote_in_logfile_name,
631 const char *remote_out_logfile_name);
638 virtual void handle_request_logging_status();
645 virtual void handle_dropped_last_connection(
void);
656 virtual void handle_got_first_connection(
void);
684 void logging_thread_func(
void);
688 bool stop_logging_thread(
void);
701 open_new_log_connection(
const char *local_in_logfile_name,
702 const char *local_out_logfile_name,
703 const char *remote_in_logfile_name,
704 const char *remote_out_logfile_name);
718 bool make_new_logging_connection(
const char *local_in_logfile_name,
719 const char *local_out_logfile_name,
720 const char *remote_in_logfile_name,
721 const char *remote_out_logfile_name);
731 handle_image_description(
void *pvISB,
const struct timeval msg_time);
774 vrpn_int32 transcode_type(vrpn_int32 type);
An RAII lock/guard class for vrpn_Semaphore.
Generic connection class not specific to the transport mechanism.
This is the class users deal with: it tells the format and the region data when it arrives.
vrpn_int32 got_first_connection_m_id
vrpn_int32 d_server_regionu16_m_id
vrpn_Imager_Stream_Shared_State d_shared_state
vrpn_int32 d_server_begin_frame_m_id
vrpn_int32 d_server_regionu8_m_id
vrpn_Thread * d_logging_thread
vrpn_int32 d_server_frames_to_send
bool d_ready_to_drop_old_connection
char * d_imager_server_name
vrpn_int32 d_server_end_frame_m_id
vrpn_int32 d_server_ping_m_id
vrpn_Imager_Remote * d_imager_remote
vrpn_int32 d_server_description_m_id
vrpn_int32 d_server_text_m_id
static int VRPN_CALLBACK static_handle_request_logging(void *userdata, vrpn_HANDLERPARAM p)
vrpn_Connection * d_log_connection
vrpn_int32 d_server_discarded_frames_m_id
vrpn_int32 d_server_pong_m_id
vrpn_uint16 d_server_dropped_due_to_throttle
vrpn_int32 d_server_regionu12in16_m_id
vrpn_int32 d_server_regionf32_m_id
vrpn_Message_List d_logger_to_client_messages
bool insert_logger_to_client_message(const vrpn_HANDLERPARAM &p)
void set_logfile_result(const char *lil, const char *lol, const char *ril, const char *rol)
vrpn_Imager_Stream_Shared_State()
vrpn_int32 decrement_frames_in_queue(void)
vrpn_int32 d_frames_in_queue
vrpn_int32 get_logger_to_client_queue_size(void)
bool d_description_updated
void set_logfile_request(const char *lil, const char *lol, const char *ril, const char *rol)
bool get_logfile_result(char **lil, char **lol, char **ril, char **rol)
bool get_logfile_request(char **lil, char **lol, char **ril, char **rol)
vrpn_int32 get_frames_in_queue(void)
bool retrieve_logger_to_client_message(vrpn_HANDLERPARAM *p)
vrpn_int32 d_throttle_count
bool get_imager_description(vrpn_int32 &nRows, vrpn_int32 &nCols, vrpn_int32 &nDepth, vrpn_int32 &nChannels, const char **channelBuffer)
const char * d_channel_buffer
vrpn_int32 increment_frames_in_queue(void)
void set_throttle_request(vrpn_int32 throttle_count)
bool set_imager_description(vrpn_int32 nRows, vrpn_int32 nCols, vrpn_int32 nDepth, vrpn_int32 nChannels, const char *channelBuffer)
bool get_throttle_request(vrpn_int32 *throttle_count)
bool d_new_throttle_request
void get_logfile_names(char **local_in, char **local_out, char **remote_in, char **remote_out)
void time_to_exit(bool do_exit)
bool retrieve_front(vrpn_HANDLERPARAM *p)
unsigned size(void) const
struct d_ELEMENT * d_first
bool insert_back(const vrpn_HANDLERPARAM &p)
This structure is what is passed to a vrpn_Connection message callback.