X-Git-Url: http://git.treefish.org/~alex/phys/latlib.git/blobdiff_plain/d945435d46acac2f758c23f0a5ae99cbb9894b91..493266210f4f7627378161978968e719372ef03e:/configcache.cpp?ds=sidebyside diff --git a/configcache.cpp b/configcache.cpp index 5987789..59472e9 100644 --- a/configcache.cpp +++ b/configcache.cpp @@ -53,13 +53,25 @@ configcache::configcache(const string& cacheid, const int& nequi, const int& nsk refetchDataFiles = false; } -string configcache::getFileId(int actnequi, const bool& shortid) +string configcache::paraString() { + stringstream parastring; + + for(int ipara=0; iparaextended = 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; @@ -126,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; } @@ -213,6 +233,8 @@ void configcache::readConfig(bool *readnewconfig, int *nequileft, vector 0 ) { + string inFileParaString; + openFileDesc = *inFileIt; if (openFileDesc.nequi < NEQUI) @@ -225,6 +247,14 @@ void configcache::readConfig(bool *readnewconfig, int *nequileft, vectorfilename << endl << flush; inFile.open( (DATADIR + "/" + inFileIt->filename).c_str(), std::ios::binary ); + 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; @@ -281,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); @@ -299,6 +329,8 @@ void configcache::openOutFile(int actnequi) outFile.open( outFileName.str().c_str(), std::ios::binary ); + outFile << paraString() << endl; + ioBuffers->out = new boost::iostreams::filtering_ostreambuf; ioBuffers->out->push(boost::iostreams::bzip2_compressor()); ioBuffers->out->push(outFile);