X-Git-Url: http://git.treefish.org/~alex/phys/latlib.git/blobdiff_plain/b80a3fda9209144605a6306ba24ec2051d387f50..2941710185479c3748e991a3932c4af8832204a9:/configcache.cpp?ds=inline diff --git a/configcache.cpp b/configcache.cpp index b375230..a3490ad 100644 --- a/configcache.cpp +++ b/configcache.cpp @@ -172,9 +172,12 @@ void * configcache::getHeader(const string& headerid) { return NULL; } -bool configcache::readConfig(vector *excludefiles) -{ - if(DATADIR == "" || MODE == CACHE_MODE_DISABLED) return false; +/* returns number of equilibration-steps left */ +int configcache::readConfig(vector *excludeFileHashes) +{ + int nequileft = NEQUI; + + if(DATADIR == "" || MODE == CACHE_MODE_DISABLED) return nequileft; if(refetchDataFiles){ refetchDataFiles = false; @@ -183,16 +186,16 @@ bool configcache::readConfig(vector *excludefiles) while(true) { - if( (!inFile.is_open()) && inFiles.size() == 0 ) return false; + if( (!inFile.is_open()) && inFiles.size() == 0 ) return nequileft; while( (!inFile.is_open()) && inFiles.size() > 0 ) { bool excludethisfile=false; openFileDesc = inFiles.back(); - if (excludefiles != NULL) - for (vector::iterator exit = excludefiles->begin(); exit != excludefiles->end(); ++exit) - if ( *exit == inFiles.back().filename ) { + if (excludeFileHashes != NULL) + for (vector::iterator exit = excludeFileHashes->begin(); exit != excludeFileHashes->end(); ++exit) + if ( *exit == hash(inFiles.back().filename) ) { excludethisfile = true; break; } @@ -221,13 +224,17 @@ bool configcache::readConfig(vector *excludefiles) for (int iskip=0; iskip < (NEQUI-openFileDesc.nequi)/openFileDesc.nskip; iskip++) { if( readFullBlock(tmpConfig, configSize) != configSize || ! inFile.is_open() ) break; + else if ( (NEQUI-openFileDesc.nequi) - (iskip+1)*openFileDesc.nskip < nequileft ) { + memcpy(configMem, tmpConfig, configSize); + nequileft = (NEQUI-openFileDesc.nequi) - (iskip+1)*openFileDesc.nskip; + } } } if( readFullBlock(tmpConfig, configSize) == configSize && inFile.is_open() ) { memcpy(configMem, tmpConfig, configSize); - return true; + return -1; } else { if(out) *out->log << "CCACHE: Could not read configuration. Closing dat-file: " << openFileDesc.filename << endl << flush;