trick/trick_source/sim_services/VariableServer/VariableServerThread.cpp
Alex Lin 19025d77ad Standardize directory names
Reorganized.  Created a new top level include directory that will hold all of Trick's header files. Moved all of the Trick headers to this directory.  Created a libexec directory that holds all of the executables that users don't need to execute directly.  Changed all of the executables remaining in bin to start with "trick-".  In the sim_services directories changed all source files to find the Trick headers in their new location.  Since all of the include files are gone in sim_services, removed the src directories as well, moving all of the source files up a level.  Moved the makefiles, docs, man, and other architecture independent files into a top level share directory.  Renamed lib_${TRICK_HOST_CPU} to lib64 or lib depending on the platform we're currently on.

refs #63
2015-06-09 08:44:42 -05:00

104 lines
2.5 KiB
C++

#include <stdlib.h>
#include "trick/VariableServerThread.hh"
#include "trick/exec_proto.h"
#include "trick/TrickConstant.hh"
Trick::VariableServer * Trick::VariableServerThread::vs = NULL ;
Trick::VariableServerThread::VariableServerThread(TCDevice * in_listen_dev) :
Trick::ThreadBase("VarServer") ,
listen_dev(in_listen_dev) {
debug = 0 ;
enabled = true ;
log = false ;
connection_accepted = false ;
conn_type = TCP ;
copy_mode = VS_COPY_ASYNC ;
write_mode = VS_WRITE_ASYNC ;
frame_multiple = 1 ;
frame_offset = 0 ;
freeze_frame_multiple = 1 ;
freeze_frame_offset = 0 ;
binary_data = false;
multicast = false;
byteswap = false ;
retry_bad_ref = false ;
pause_cmd = false ;
exit_cmd = false ;
send_stdio = false ;
update_rate = 0.1 ;
cycle_tics = (long long)(update_rate * exec_get_time_tic_value()) ;
next_tics = TRICK_MAX_LONG_LONG ;
freeze_next_tics = TRICK_MAX_LONG_LONG ;
connection.disabled = TC_COMM_FALSE ;
connection.disable_handshaking = TC_COMM_TRUE ;
connection.blockio_limit = 0.0 ;
connection.blockio_type = TC_COMM_BLOCKIO ;
connection.client_id = 0 ;
connection.dmtcp_use_real = 1 ;
strcpy(connection.client_tag, "") ;
connection.error_handler = (TrickErrorHndlr *) calloc(1, (int)sizeof(TrickErrorHndlr));
connection.error_handler->report_level = TRICK_ERROR_CAUTION;
pthread_mutex_init(&copy_mutex, NULL);
var_data_staged = false;
packets_copied = 0 ;
incoming_msg = (char *) calloc(1, MAX_CMD_LEN);
stripped_msg = (char *) calloc(1, MAX_CMD_LEN);
}
Trick::VariableServerThread::~VariableServerThread() {
free( incoming_msg ) ;
free( stripped_msg ) ;
}
void Trick::VariableServerThread::set_vs_ptr(Trick::VariableServer * in_vs) {
vs = in_vs ;
}
// Command to turn on log to varserver_log file
int Trick::VariableServerThread::set_log_on() {
log = true;
return(0) ;
}
// Command to turn off log to varserver_log file
int Trick::VariableServerThread::set_log_off() {
log = false;
return(0) ;
}
long long Trick::VariableServerThread::get_next_tics() {
if ( ! enabled ) {
return TRICK_MAX_LONG_LONG ;
}
return next_tics ;
}
long long Trick::VariableServerThread::get_freeze_next_tics() {
if ( ! enabled ) {
return TRICK_MAX_LONG_LONG ;
}
return freeze_next_tics ;
}
Trick::VariableServer * Trick::VariableServerThread::get_vs() {
return vs ;
}
TCDevice & Trick::VariableServerThread::get_connection() {
return connection ;
}