#776 default restore_stls to false

This commit is contained in:
Scott Fennell 2019-06-03 09:44:35 -05:00
parent 7f7adca0ac
commit 9be53ebb9b
2 changed files with 9 additions and 7 deletions

View File

@ -370,7 +370,7 @@ namespace Trick {
Restore a checkpoint from the given stream. Restore a checkpoint from the given stream.
@param in_s - input stream. @param in_s - input stream.
*/ */
int read_checkpoint( std::istream* in_s, bool do_restore_stls=true); int read_checkpoint( std::istream* in_s, bool do_restore_stls=false);
/** /**
Read a checkpoint from the file of the given name. Read a checkpoint from the file of the given name.

View File

@ -7,7 +7,7 @@
#include "trick/MemoryManager.hh" #include "trick/MemoryManager.hh"
#include "trick/ClassicCheckPointAgent.hh" #include "trick/ClassicCheckPointAgent.hh"
int Trick::MemoryManager::read_checkpoint( std::istream *is, bool do_restore_stls /* default is true */) { int Trick::MemoryManager::read_checkpoint( std::istream *is, bool do_restore_stls /* default is false */) {
ALLOC_INFO_MAP::iterator pos; ALLOC_INFO_MAP::iterator pos;
ALLOC_INFO* alloc_info; ALLOC_INFO* alloc_info;
@ -22,9 +22,11 @@ int Trick::MemoryManager::read_checkpoint( std::istream *is, bool do_restore_stl
} }
// Search for stls and restore them // Search for stls and restore them
for ( pos=alloc_info_map.begin() ; do_restore_stls && pos!=alloc_info_map.end() ; pos++ ) { if(do_restore_stls) {
for ( pos=alloc_info_map.begin() ; pos!=alloc_info_map.end() ; pos++ ) {
restore_stls(pos->second) ; restore_stls(pos->second) ;
} }
}
// Go through all of the allocations that have been created looking // Go through all of the allocations that have been created looking
// for those whose names start with the temporary-variable prefix and: // for those whose names start with the temporary-variable prefix and:
@ -62,10 +64,10 @@ int Trick::MemoryManager::read_checkpoint(const char* filename ) {
std::ifstream infile(filename , std::ios::in); std::ifstream infile(filename , std::ios::in);
if (infile.is_open()) { if (infile.is_open()) {
// If the file extention is .dat, we will tell read_checkpoint not to // If the filename is not S_default.dat, we will tell read_checkpoint to
// restore stls. It is not necessary and time consuming. // restore stls.
bool do_restore_stls = bool do_restore_stls =
(std::string(filename).find(".dat") != std::string::npos); (std::string(filename).find("S_default.dat") == std::string::npos);
return ( read_checkpoint( &infile, do_restore_stls )) ; return ( read_checkpoint( &infile, do_restore_stls )) ;
} else { } else {