X-Git-Url: http://git.treefish.org/~alex/phys/latlib.git/blobdiff_plain/894e6b60d1de6307a72b03d0027f71962bc2e282..e34773ccb43eefc86dc814b768af85da2873e5ef:/configcache.cpp?ds=inline diff --git a/configcache.cpp b/configcache.cpp index bdc593e..491256c 100644 --- a/configcache.cpp +++ b/configcache.cpp @@ -62,13 +62,16 @@ string configcache::paraString() { return parastring.str(); } -string configcache::getFileId(int actnequi, const bool& shortid) +string configcache::getFileId(int actnequi, const bool& superextended, const bool& shortid) { stringstream fileid; if(!shortid) fileid << CACHEID << "_" << actnequi << "_" << NSKIP; - fileid << "_" << hash( paraString() ); + if( superextended ) + fileid << "_" << hash( paraString() ); + else + fileid << "_" << paraString(); return fileid.str(); } @@ -100,10 +103,18 @@ bool configcache::isValidInFile(const string& infile, infiledesc *filedesc) if( infile.size() < 4 ) return false; - if( infile.substr(infile.size()-4) == ".dat" ) + if( infile.substr(infile.size()-4) == ".dat" ) { filedesc->extended = false; - else if( infile.substr(infile.size()-4) == "edat" ) + filedesc->superextended = false; + } + else if( infile.substr(infile.size()-4) == "edat" ) { filedesc->extended = true; + filedesc->superextended = false; + } + else if( infile.substr(infile.size()-4) == "sdat" ) { + filedesc->extended = true; + filedesc->superextended = true; + } else return false; @@ -135,7 +146,7 @@ bool configcache::isValidInFile(const string& infile, infiledesc *filedesc) delete[] inchar; - if( truncIn.find( getFileId(NEQUI, true) + "_" ) == string::npos ) return false; + if( truncIn.find( getFileId(NEQUI, filedesc->superextended, true) + "_" ) == string::npos ) return false; return true; } @@ -236,12 +247,14 @@ void configcache::readConfig(bool *readnewconfig, int *nequileft, vectorfilename << endl << flush; inFile.open( (DATADIR + "/" + inFileIt->filename).c_str(), std::ios::binary ); - getline( inFile, inFileParaString ); - if( inFileParaString != paraString() ) { - if(log) *log << "CCACHE: Parastring does not match. Closing dat-file..." << endl << flush; - inFile.close(); + if( openFileDesc.superextended ) { + getline( inFile, inFileParaString ); + if( inFileParaString != paraString() ) { + if(log) *log << "CCACHE: Parastring does not match. Closing dat-file..." << endl << flush; + inFile.close(); + } } - + inFiles.erase(inFileIt); if( !inFile.is_open() ) continue; @@ -298,7 +311,7 @@ void configcache::openOutFile(int actnequi) while (true) { outFileName.str(""); - outFileName << DATADIR << "/" << secstamp << "." << iseq << "_" << getFileId(actnequi) << "_.edat.tmp"; + outFileName << DATADIR << "/" << secstamp << "." << iseq << "_" << getFileId(actnequi, true, false) << "_.sdat.tmp"; int tmpfd = open(outFileName.str().c_str(), O_CREAT | O_EXCL, 0644);