mirror of
https://github.com/nasa/trick.git
synced 2024-12-24 23:36:43 +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
52 lines
1.7 KiB
C++
52 lines
1.7 KiB
C++
|
|
#include <string>
|
|
#include <utility>
|
|
|
|
#include "trick/checkpoint_pair.hh"
|
|
|
|
int checkpoint_stl(std::pair<std::string, std::string> & in_stl , std::string object_name , std::string var_name ) {
|
|
|
|
char var_declare[128] ;
|
|
char ** first ;
|
|
char ** second ;
|
|
std::replace_if(object_name.begin(), object_name.end(), std::ptr_fun<int,int>(&std::ispunct), '_');
|
|
|
|
sprintf(var_declare, "char * %s_%s_first[1]", object_name.c_str(), var_name.c_str()) ;
|
|
first = (char **)TMM_declare_var_s(var_declare) ;
|
|
|
|
sprintf(var_declare, "char * %s_%s_second[1]" , object_name.c_str(), var_name.c_str()) ;
|
|
second = (char **)TMM_declare_var_s(var_declare) ;
|
|
|
|
first[0] = (char *)(in_stl.first.c_str()) ;
|
|
second[0] = (char *)(in_stl.second.c_str()) ;
|
|
|
|
return 0 ;
|
|
}
|
|
|
|
int restore_stl(std::pair<std::string, std::string> & in_stl , std::string object_name , std::string var_name ) {
|
|
|
|
REF2 * first_ref ;
|
|
REF2 * second_ref ;
|
|
|
|
char ** first ;
|
|
char ** second ;
|
|
std::replace_if(object_name.begin(), object_name.end(), std::ptr_fun<int,int>(&std::ispunct), '_');
|
|
//message_publish(1, "RESTORE_STL_queue %s_%s\n", object_name.c_str() , var_name.c_str()) ;
|
|
|
|
first_ref = ref_attributes((char *)(object_name + std::string("_") + var_name + std::string("_first")).c_str()) ;
|
|
second_ref = ref_attributes((char *)(object_name + std::string("_") + var_name + std::string("_second")).c_str()) ;
|
|
|
|
if ( first_ref != NULL && second_ref != NULL ) {
|
|
first = (char **)first_ref->address ;
|
|
second = (char **)second_ref->address ;
|
|
|
|
in_stl.first = std::string(first[0]) ;
|
|
in_stl.second = std::string(second[0]) ;
|
|
|
|
delete_stl( in_stl , object_name , var_name ) ;
|
|
}
|
|
|
|
return 0 ;
|
|
}
|
|
|