mirror of
https://github.com/nasa/trick.git
synced 2024-12-19 13:17:55 +00:00
19025d77ad
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
101 lines
2.6 KiB
C++
101 lines
2.6 KiB
C++
|
|
#include <netdb.h>
|
|
#include "trick/VariableServer.hh"
|
|
#include "trick/tc_proto.h"
|
|
|
|
Trick::VariableServer * the_vs ;
|
|
|
|
Trick::VariableServer::VariableServer() :
|
|
enabled(true) ,
|
|
info_msg(false),
|
|
log(false)
|
|
{
|
|
the_vs = this ;
|
|
pthread_mutex_init(&map_mutex, NULL);
|
|
}
|
|
|
|
Trick::VariableServer::~VariableServer() {
|
|
}
|
|
|
|
bool Trick::VariableServer::get_enabled() {
|
|
return enabled ;
|
|
}
|
|
|
|
void Trick::VariableServer::set_enabled(bool on_off) {
|
|
enabled = on_off ;
|
|
}
|
|
|
|
bool Trick::VariableServer::get_info_msg() {
|
|
return info_msg ;
|
|
}
|
|
|
|
void Trick::VariableServer::set_var_server_info_msg_on() {
|
|
info_msg = true;
|
|
}
|
|
|
|
void Trick::VariableServer::set_var_server_info_msg_off() {
|
|
info_msg = false;
|
|
}
|
|
|
|
bool Trick::VariableServer::get_log() {
|
|
return log ;
|
|
}
|
|
|
|
void Trick::VariableServer::set_var_server_log_on() {
|
|
log = true;
|
|
// turn log on for all current vs clients
|
|
std::map < pthread_t , VariableServerThread * >::iterator it ;
|
|
for ( it = var_server_threads.begin() ; it != var_server_threads.end() ; it++ ) {
|
|
(*it).second->set_log_on();
|
|
}
|
|
}
|
|
|
|
void Trick::VariableServer::set_var_server_log_off() {
|
|
log = false;
|
|
// turn log off for all current vs clients
|
|
std::map < pthread_t , VariableServerThread * >::iterator it ;
|
|
for ( it = var_server_threads.begin() ; it != var_server_threads.end() ; it++ ) {
|
|
(*it).second->set_log_off();
|
|
}
|
|
}
|
|
|
|
const char * Trick::VariableServer::get_hostname() {
|
|
return (listen_thread.get_hostname()) ;
|
|
}
|
|
|
|
Trick::VariableServerListenThread & Trick::VariableServer::get_listen_thread() {
|
|
return listen_thread ;
|
|
}
|
|
|
|
void Trick::VariableServer::add_vst(pthread_t in_thread_id, VariableServerThread * in_vst) {
|
|
pthread_mutex_lock(&map_mutex) ;
|
|
var_server_threads[in_thread_id] = in_vst ;
|
|
pthread_mutex_unlock(&map_mutex) ;
|
|
}
|
|
|
|
Trick::VariableServerThread * Trick::VariableServer::get_vst(pthread_t thread_id) {
|
|
std::map < pthread_t , Trick::VariableServerThread * >::iterator it ;
|
|
Trick::VariableServerThread * ret = NULL ;
|
|
pthread_mutex_lock(&map_mutex) ;
|
|
it = var_server_threads.find(thread_id) ;
|
|
if ( it != var_server_threads.end() ) {
|
|
ret = (*it).second ;
|
|
}
|
|
pthread_mutex_unlock(&map_mutex) ;
|
|
return ret ;
|
|
}
|
|
|
|
void Trick::VariableServer::delete_vst(pthread_t thread_id) {
|
|
pthread_mutex_lock(&map_mutex) ;
|
|
var_server_threads.erase(thread_id) ;
|
|
pthread_mutex_unlock(&map_mutex) ;
|
|
}
|
|
|
|
void Trick::VariableServer::set_copy_data_job( Trick::JobData * in_job ) {
|
|
copy_data_job = in_job ;
|
|
}
|
|
|
|
void Trick::VariableServer::set_copy_data_freeze_job( Trick::JobData * in_job ) {
|
|
copy_data_freeze_job = in_job ;
|
|
}
|