trick/trick_source/sim_services/CheckPointRestart/checkpoint_queue.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

75 lines
2.3 KiB
C++

#include "trick/checkpoint_queue.hh"
int checkpoint_stl(std::queue<std::string> & in_stl , std::string object_name , std::string var_name ) {
unsigned int ii ;
unsigned int cont_size ;
char var_declare[128] ;
int status ;
char ** items = NULL ;
std::queue<std::string> temp_queue ;
cont_size = in_stl.size() ;
std::replace_if(object_name.begin(), object_name.end(), std::ptr_fun<int,int>(&std::ispunct), '_');
if ( cont_size > 0 ) {
sprintf(var_declare, "%s %s_%s[%d]" ,
abi::__cxa_demangle(typeid(*items).name(), 0, 0, &status ), object_name.c_str(), var_name.c_str(), cont_size) ;
items = (char **)TMM_declare_var_s(var_declare) ;
//message_publish(1, "CHECKPOINT_STL_STACK with %s\n", var_declare) ;
temp_queue = in_stl ;
for ( ii = 0 ; ii < cont_size ; ii++ ) {
items[ii] = (char *)((temp_queue.front()).c_str()) ;
temp_queue.pop() ;
}
}
return 0 ;
}
int checkpoint_stl(std::priority_queue<std::string> & in_stl , std::string object_name , std::string var_name ) {
unsigned int ii ;
unsigned int cont_size ;
char var_declare[128] ;
int status ;
char ** items = NULL ;
std::priority_queue<std::string> temp_queue ;
cont_size = in_stl.size() ;
std::replace_if(object_name.begin(), object_name.end(), std::ptr_fun<int,int>(&std::ispunct), '_');
if ( cont_size > 0 ) {
sprintf(var_declare, "%s %s_%s[%d]" ,
abi::__cxa_demangle(typeid(*items).name(), 0, 0, &status ), object_name.c_str(), var_name.c_str(), cont_size) ;
items = (char **)TMM_declare_var_s(var_declare) ;
//message_publish(1, "CHECKPOINT_STL_STACK with %s\n", var_declare) ;
temp_queue = in_stl ;
for ( ii = 0 ; ii < cont_size ; ii++ ) {
items[ii] = (char *)((temp_queue.top()).c_str()) ;
temp_queue.pop() ;
}
}
return 0 ;
}
int restore_stl(std::queue<std::string> & in_stl , std::string object_name , std::string var_name ) {
return restore_queue_stl_string(in_stl , object_name , var_name) ;
}
int restore_stl(std::priority_queue<std::string> & in_stl , std::string object_name , std::string var_name ) {
return restore_queue_stl_string(in_stl , object_name , var_name) ;
}