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,
return dressedfile.substr(dressedfile.find_last_of("\\/")+1);
}
-bool hypercache::readC() {
- bool readret;
+int hypercache::readC() {
+ int readret;
- if ( readret = C->readConfig(&parentConfigs) )
+ readret = C->readConfig(&parentConfigs);
+
+ if ( readret == -1 )
activeCFile = fileOfPath(C->getInFileName());
else
activeCFile = "";
}
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 hypercache::readO() {
- bool readret;
+int hypercache::readO() {
+ int readret;
+
+ readret = O->readConfig();
- if ( readret = O->readConfig() ) {
- char *parentconfig = (char*)O->getHeader("concurrent_cfile");
+ if ( readret == -1 ) {
+ 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);
}