refetchDataFiles = false;
}
+string configcache::paraString() {
+ stringstream parastring;
+
+ for(int ipara=0; ipara<Paras.size(); ipara++)
+ parastring << "_" << Paras[ipara].id << Paras[ipara].val;
+
+ return parastring.str();
+}
+
string configcache::getFileId(int actnequi, const bool& shortid)
{
stringstream fileid;
if(!shortid) fileid << CACHEID << "_" << actnequi << "_" << NSKIP;
- for(int ipara=0; ipara<Paras.size(); ipara++)
- fileid << "_" << Paras[ipara].id << Paras[ipara].val;
+
+ fileid << "_" << hash( paraString() );
return fileid.str();
}
}
while( (!inFile.is_open()) && inFiles.size() > 0 ) {
+ string inFileParaString;
+
openFileDesc = *inFileIt;
if (openFileDesc.nequi < NEQUI)
if(log) *log << "CCACHE: Opening dat-file: " << inFileIt->filename << 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();
+ }
+
inFiles.erase(inFileIt);
if( !inFile.is_open() ) continue;
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);