mirror of
https://github.com/nasa/trick.git
synced 2025-02-21 01:31:25 +00:00
Merge pull request #800 from nasa/#776
#776 .dat files don't call restore_stls in checkpoint restore
This commit is contained in:
commit
c3d64bc977
@ -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);
|
||||
int read_checkpoint( std::istream* in_s, bool do_restore_stls=false);
|
||||
|
||||
/**
|
||||
Read a checkpoint from the file of the given name.
|
||||
|
@ -7,7 +7,7 @@
|
||||
#include "trick/MemoryManager.hh"
|
||||
#include "trick/ClassicCheckPointAgent.hh"
|
||||
|
||||
int Trick::MemoryManager::read_checkpoint( std::istream *is) {
|
||||
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) {
|
||||
}
|
||||
|
||||
// Search for stls and restore them
|
||||
for ( pos=alloc_info_map.begin() ; 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
|
||||
@ -60,12 +62,17 @@ int Trick::MemoryManager::read_checkpoint(const char* filename ) {
|
||||
|
||||
// Create a stream from the named file.
|
||||
std::ifstream infile(filename , std::ios::in);
|
||||
|
||||
if (infile.is_open()) {
|
||||
return ( read_checkpoint( &infile ));
|
||||
|
||||
// If the filename is not S_default.dat, we will tell read_checkpoint to
|
||||
// restore stls.
|
||||
bool do_restore_stls =
|
||||
(std::string(filename).find("S_default.dat") == std::string::npos);
|
||||
|
||||
return ( read_checkpoint( &infile, do_restore_stls )) ;
|
||||
} else {
|
||||
std::stringstream message;
|
||||
message << "Couldn't open \"" << filename << "\".";
|
||||
message << "Couldn't open \"" << filename << "\"." ;
|
||||
emitError(message.str());
|
||||
}
|
||||
return 1;
|
||||
|
Loading…
x
Reference in New Issue
Block a user