return NULL;
}
-bool configcache::readConfig(vector<string> *excludefiles)
+bool configcache::readConfig(vector<unsigned long> *excludeFileHashes)
{
if(DATADIR == "" || MODE == CACHE_MODE_DISABLED) return false;
openFileDesc = inFiles.back();
- if (excludefiles != NULL)
- for (vector<string>::iterator exit = excludefiles->begin(); exit != excludefiles->end(); ++exit)
- if ( *exit == inFiles.back().filename ) {
+ if (excludeFileHashes != NULL)
+ for (vector<unsigned long>::iterator exit = excludeFileHashes->begin(); exit != excludeFileHashes->end(); ++exit)
+ if ( *exit == hash(inFiles.back().filename) ) {
excludethisfile = true;
break;
}
~configcache();
configcache(const string& cacheid, const int& nequi, const int& nskip, const string& datadir, char **configmem, const int& configMemSize,
const int& cachemode=CACHE_MODE_FULL, writeout *out_a=NULL);
- bool readConfig(vector<string> *excludefiles=NULL);
+ bool readConfig(vector<unsigned long> *excludeFileHashes=NULL);
void writeConfig();
void addPara(const string& parid, const double& val=0);
void setPara(const string& parid, const double& value);
vector<hypercache::para> hypercache::delayedParaAdd;
vector<hypercache::para> hypercache::delayedParaSet;
string hypercache::activeCFile = "";
-vector<string> hypercache::parentConfigs;
+vector<unsigned long> hypercache::parentConfigs;
writeout *hypercache::out = NULL;
void hypercache::initCache(configcache **cache,
}
void hypercache::writeO() {
- if ( activeCFile != "" )
- O->writeHeader("concurrent_cfile", activeCFile.c_str(), (activeCFile.length()+1)*sizeof(char));
+ if ( activeCFile != "" ) {
+ unsigned long afilehash = configcache::hash(activeCFile);
+ O->writeHeader("concurrent_cfile", (char*)(&afilehash), sizeof(unsigned long));
+ }
O->writeConfig();
}
bool readret;
if ( readret = O->readConfig() ) {
- char *parentconfig = (char*)O->getHeader("concurrent_cfile");
+ unsigned long *parentconfig = (unsigned long*)O->getHeader("concurrent_cfile");
if ( parentconfig != NULL )
addParentConfig(parentconfig);
}
return readret;
}
-void hypercache::addParentConfig(const char* parentconfig) {
- for (vector<string>::iterator parit = parentConfigs.begin(); parit != parentConfigs.end(); ++parit)
- if ( *parit == parentconfig )
+void hypercache::addParentConfig(const unsigned long *parentconfig) {
+ for (vector<unsigned long>::iterator parit = parentConfigs.begin(); parit != parentConfigs.end(); ++parit)
+ if ( *parit == *parentconfig )
return;
- parentConfigs.push_back(parentconfig);
+ parentConfigs.push_back(*parentconfig);
}
static string fileOfPath(const string& dressedfile);
static string activeCFile;
- static vector<string> parentConfigs;
- static void addParentConfig(const char* parentconfig);
+ static vector<unsigned long> parentConfigs;
+ static void addParentConfig(const unsigned long *parentconfig);
};
#endif