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) {
45 unsigned size(
void)
const {
return d_count; }
60 if (d_first == NULL) {
78 if (d_last == d_first) {
82 d_first = d_first->
next;
117 d_time_to_exit =
false;
118 d_description_updated =
false;
119 d_nRows = d_nCols = d_nDepth = d_nChannels = 0;
120 d_new_log_request =
false;
121 d_request_lil = NULL;
122 d_request_lol = NULL;
123 d_request_ril = NULL;
124 d_request_rol = NULL;
125 d_new_log_result =
false;
130 d_new_throttle_request =
false;
131 d_throttle_count = -1;
132 d_frames_in_queue = 0;
140 bool ret = d_time_to_exit;
147 d_time_to_exit = do_exit;
157 vrpn_int32 &nDepth, vrpn_int32 &nChannels,
158 const char **channelBuffer)
161 bool ret = d_description_updated;
162 if (d_description_updated) {
166 nChannels = d_nChannels;
167 *channelBuffer = d_channel_buffer;
169 d_description_updated =
false;
174 vrpn_int32 nDepth, vrpn_int32 nChannels,
175 const char *channelBuffer)
181 d_nChannels = nChannels;
182 d_channel_buffer = channelBuffer;
183 d_description_updated =
true;
202 bool ret = d_new_log_request;
203 if (d_new_log_request) {
206 if ((*lil =
new char[strlen(d_request_lil) + 1]) != NULL) {
207 strcpy(*lil, d_request_lil);
209 if ((*lol =
new char[strlen(d_request_lol) + 1]) != NULL) {
210 strcpy(*lol, d_request_lol);
212 if ((*ril =
new char[strlen(d_request_ril) + 1]) != NULL) {
213 strcpy(*ril, d_request_ril);
215 if ((*rol =
new char[strlen(d_request_rol) + 1]) != NULL) {
216 strcpy(*rol, d_request_rol);
220 delete[] d_request_lil;
221 d_request_lil = NULL;
222 delete[] d_request_lol;
223 d_request_lol = NULL;
224 delete[] d_request_ril;
225 d_request_ril = NULL;
226 delete[] d_request_rol;
227 d_request_rol = NULL;
229 d_new_log_request =
false;
242 delete[] d_request_lil;
243 d_request_lil = NULL;
246 delete[] d_request_lol;
247 d_request_lol = NULL;
250 delete[] d_request_ril;
251 d_request_ril = NULL;
254 delete[] d_request_rol;
255 d_request_rol = NULL;
260 if ((d_request_lil =
new char[strlen(lil) + 1]) != NULL) {
261 strcpy(d_request_lil, lil);
265 if ((d_request_lol =
new char[strlen(lol) + 1]) != NULL) {
266 strcpy(d_request_lol, lol);
270 if ((d_request_ril =
new char[strlen(ril) + 1]) != NULL) {
271 strcpy(d_request_ril, ril);
275 if ((d_request_rol =
new char[strlen(rol) + 1]) != NULL) {
276 strcpy(d_request_rol, rol);
280 d_new_log_request =
true;
297 bool ret = d_new_log_result;
298 if (d_new_log_result) {
301 if (d_result_lil == NULL)
304 if ((*lil =
new char[strlen(d_result_lil) + 1]) != NULL) {
305 strcpy(*lil, d_result_lil);
308 if (d_result_lol == NULL)
311 if ((*lol =
new char[strlen(d_result_lol) + 1]) != NULL) {
312 strcpy(*lol, d_result_lol);
315 if (d_result_ril == NULL)
318 if ((*ril =
new char[strlen(d_result_ril) + 1]) != NULL) {
319 strcpy(*ril, d_result_ril);
322 if (d_result_rol == NULL)
325 if ((*rol =
new char[strlen(d_result_rol) + 1]) != NULL) {
326 strcpy(*rol, d_result_rol);
333 d_new_log_result =
false;
343 if (d_result_lil)
delete[] d_result_lil;
345 if (d_result_lol)
delete[] d_result_lol;
347 if (d_result_ril)
delete[] d_result_ril;
349 if (d_result_rol)
delete[] d_result_rol;
354 if ((d_result_lil =
new char[strlen(lil) + 1]) != NULL) {
355 strcpy(d_result_lil, lil);
359 if ((d_result_lol =
new char[strlen(lol) + 1]) != NULL) {
360 strcpy(d_result_lol, lol);
364 if ((d_result_ril =
new char[strlen(ril) + 1]) != NULL) {
365 strcpy(d_result_ril, ril);
369 if ((d_result_rol =
new char[strlen(rol) + 1]) != NULL) {
370 strcpy(d_result_rol, rol);
374 d_new_log_result =
true;
388 if (d_result_lil == NULL)
391 *local_in =
new char[strlen(d_result_lil) + 1];
392 strcpy(*local_in, d_result_lil);
394 if (d_result_lol == NULL)
397 *local_out =
new char[strlen(d_result_lol) + 1];
398 strcpy(*local_out, d_result_lol);
400 if (d_result_ril == NULL)
403 *remote_in =
new char[strlen(d_result_ril) + 1];
404 strcpy(*remote_in, d_result_ril);
406 if (d_result_rol == NULL)
409 *remote_out =
new char[strlen(d_result_rol) + 1];
410 strcpy(*remote_out, d_result_rol);
420 bool ret = d_new_throttle_request;
421 if (d_new_throttle_request) {
422 *throttle_count = d_throttle_count;
424 d_new_throttle_request =
false;
431 d_throttle_count = throttle_count;
432 d_new_throttle_request =
true;
443 vrpn_int32 ret = d_frames_in_queue;
451 vrpn_int32 ret = d_frames_in_queue;
459 vrpn_int32 ret = d_frames_in_queue;
469 vrpn_int32 ret = d_logger_to_client_messages.size();
476 bool ret = d_logger_to_client_messages.insert_back(p);
483 bool ret = d_logger_to_client_messages.retrieve_front(p);
568 virtual void mainloop(
void);
582 virtual void handle_request_logging(
const char *local_in_logfile_name,
583 const char *local_out_logfile_name,
584 const char *remote_in_logfile_name,
585 const char *remote_out_logfile_name);
592 virtual void handle_request_logging_status();
599 virtual void handle_dropped_last_connection(
void);
610 virtual void handle_got_first_connection(
void);
638 void logging_thread_func(
void);
642 bool stop_logging_thread(
void);
655 open_new_log_connection(
const char *local_in_logfile_name,
656 const char *local_out_logfile_name,
657 const char *remote_in_logfile_name,
658 const char *remote_out_logfile_name);
672 bool make_new_logging_connection(
const char *local_in_logfile_name,
673 const char *local_out_logfile_name,
674 const char *remote_in_logfile_name,
675 const char *remote_out_logfile_name);
685 handle_image_description(
void *pvISB,
const struct timeval msg_time);
728 vrpn_int32 transcode_type(vrpn_int32 type);
vrpn_int32 increment_frames_in_queue(void)
bool set_imager_description(vrpn_int32 nRows, vrpn_int32 nCols, vrpn_int32 nDepth, vrpn_int32 nChannels, const char *channelBuffer)
bool insert_back(const vrpn_HANDLERPARAM &p)
vrpn_int32 d_throttle_count
vrpn_int32 d_server_begin_frame_m_id
bool get_logfile_result(char **lil, char **lol, char **ril, char **rol)
void set_logfile_result(const char *lil, const char *lol, const char *ril, const char *rol)
vrpn_int32 get_frames_in_queue(void)
vrpn_int32 d_server_regionu8_m_id
vrpn_int32 decrement_frames_in_queue(void)
vrpn_int32 d_frames_in_queue
bool get_logfile_request(char **lil, char **lol, char **ril, char **rol)
unsigned size(void) const
void time_to_exit(bool do_exit)
char * d_imager_server_name
This is the class users deal with: it tells the format and the region data when it arrives...
Generic connection class not specific to the transport mechanism.
bool get_imager_description(vrpn_int32 &nRows, vrpn_int32 &nCols, vrpn_int32 &nDepth, vrpn_int32 &nChannels, const char **channelBuffer)
vrpn_Imager_Stream_Shared_State d_shared_state
vrpn_int32 d_server_discarded_frames_m_id
vrpn_int32 d_server_ping_m_id
vrpn_int32 get_logger_to_client_queue_size(void)
vrpn_int32 d_server_description_m_id
struct d_ELEMENT * d_last
void set_logfile_request(const char *lil, const char *lol, const char *ril, const char *rol)
vrpn_int32 d_server_regionf32_m_id
vrpn_uint16 d_server_dropped_due_to_throttle
bool retrieve_logger_to_client_message(vrpn_HANDLERPARAM *p)
This structure is what is passed to a vrpn_Connection message callback.
vrpn_int32 d_server_regionu16_m_id
bool retrieve_front(vrpn_HANDLERPARAM *p)
const char * d_channel_buffer
bool d_description_updated
vrpn_Imager_Stream_Shared_State()
vrpn_int32 d_server_pong_m_id
vrpn_Message_List d_logger_to_client_messages
bool insert_logger_to_client_message(const vrpn_HANDLERPARAM &p)
vrpn_int32 d_server_text_m_id
vrpn_int32 d_server_regionu12in16_m_id
vrpn_Connection * d_log_connection
void get_logfile_names(char **local_in, char **local_out, char **remote_in, char **remote_out)
bool d_new_throttle_request
vrpn_Imager_Remote * d_imager_remote
vrpn_int32 d_server_frames_to_send
vrpn_int32 d_server_end_frame_m_id
void set_throttle_request(vrpn_int32 throttle_count)
vrpn_Thread * d_logging_thread
bool d_ready_to_drop_old_connection
vrpn_int32 got_first_connection_m_id
bool get_throttle_request(vrpn_int32 *throttle_count)