From 9be53ebb9b05246a971009bf930e8890565307d6 Mon Sep 17 00:00:00 2001 From: Scott Fennell Date: Mon, 3 Jun 2019 09:44:35 -0500 Subject: [PATCH] #776 default restore_stls to false --- include/trick/MemoryManager.hh | 2 +- .../MemoryManager/MemoryManager_restore.cpp | 14 ++++++++------ 2 files changed, 9 insertions(+), 7 deletions(-) diff --git a/include/trick/MemoryManager.hh b/include/trick/MemoryManager.hh index e5aaae84..bac485df 100644 --- a/include/trick/MemoryManager.hh +++ b/include/trick/MemoryManager.hh @@ -370,7 +370,7 @@ namespace Trick { Restore a checkpoint from the given 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. diff --git a/trick_source/sim_services/MemoryManager/MemoryManager_restore.cpp b/trick_source/sim_services/MemoryManager/MemoryManager_restore.cpp index 588b565c..3df3864d 100644 --- a/trick_source/sim_services/MemoryManager/MemoryManager_restore.cpp +++ b/trick_source/sim_services/MemoryManager/MemoryManager_restore.cpp @@ -7,7 +7,7 @@ #include "trick/MemoryManager.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* alloc_info; @@ -22,8 +22,10 @@ int Trick::MemoryManager::read_checkpoint( std::istream *is, bool do_restore_stl } // Search for stls and restore them - for ( pos=alloc_info_map.begin() ; do_restore_stls && pos!=alloc_info_map.end() ; pos++ ) { - restore_stls(pos->second) ; + if(do_restore_stls) { + for ( pos=alloc_info_map.begin() ; pos!=alloc_info_map.end() ; pos++ ) { + restore_stls(pos->second) ; + } } // Go through all of the allocations that have been created looking @@ -62,10 +64,10 @@ int Trick::MemoryManager::read_checkpoint(const char* filename ) { std::ifstream infile(filename , std::ios::in); if (infile.is_open()) { - // If the file extention is .dat, we will tell read_checkpoint not to - // restore stls. It is not necessary and time consuming. + // If the filename is not S_default.dat, we will tell read_checkpoint to + // 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 )) ; } else {