trick/trick_source/sim_services/MonteCarlo/MonteCarlo_initialize_sockets.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

45 lines
1.4 KiB
C++

#include <sys/stat.h>
#include <libgen.h>
#include "trick/MonteCarlo.hh"
#include "trick/message_proto.h"
#include "trick/message_type.h"
#include "trick/tc_proto.h"
/** @par Detailed Design: */
int Trick::MonteCarlo::initialize_sockets() {
/** set tc_error to zero for TCDevices to turn off advisory messages. */
tc_error(&listen_device, 0);
tc_error(&connection_device, 0);
tc_error(&data_listen_device, 0);
tc_error(&data_connection_device, 0);
/** <ul><li> Initialize the sockets for communication with slaves. */
int return_value = socket_init(&listen_device);
if (return_value != TC_SUCCESS) {
if (verbosity >= ERROR) {
message_publish(MSG_ERROR, "Monte [Master] Failed to initialize status communication socket.\n") ;
}
return return_value;
}
return_value = socket_init(&data_listen_device);
if (return_value != TC_SUCCESS) {
if (verbosity >= ERROR) {
message_publish(MSG_ERROR, "Monte [Master] Failed to initialize data communication socket.\n") ;
}
return return_value;
}
/** <li> If no slaves were specified, add one on localhost. */
if (slaves.empty()) {
if (verbosity >= ALL) {
message_publish(MSG_WARNING, "Monte [Master] No slaves specified. Adding localhost as the sole slave.\n") ;
}
add_slave(new MonteSlave());
}
return TC_SUCCESS ;
}