10 #include <boost/iostreams/filtering_streambuf.hpp>
11 #include <boost/iostreams/stream.hpp>
12 #include <boost/iostreams/filter/bzip2.hpp>
13 #include <boost/iostreams/device/array.hpp>
14 #include <boost/iostreams/copy.hpp>
16 #define CACHE_MODE_DISABLED 0
17 #define CACHE_MODE_READ 1
18 #define CACHE_MODE_FULL 2
37 configcache(const string& cacheid, const int& nequi, const int& nskip, const string& datadir, char **configmem, const int& configMemSize,
38 const int& cachemode=CACHE_MODE_FULL, ostream *_log=NULL);
39 void readConfig(bool& readnewconfig, int& nequileft, vector<unsigned long> *excludeFileHashes=NULL);
40 void writeConfig(int actnequi);
41 void addPara(const string& parid, const double& val=0);
42 void setPara(const string& parid, const double& value);
43 void writeHeader(const string& headerid, const char *header, long unsigned int size, int actnequi);
44 void * getHeader(const string& headerid);
45 string getOutFileName() { return outFileName.str(); }
46 string getInFileName() { return DATADIR + "/" + openFileDesc.filename; }
47 static unsigned long hash(const string& str);
48 void closeInFile() { inFile.close(); }
49 int inFilesLeft() { return inFiles.size(); }
50 char* getConfigMem() { return configMem; }
51 int getConfigSize() { return configSize; }
52 bool isOutFileOpen () { return outFile.is_open(); }
57 infiledesc openFileDesc;
58 int getParIndex(const string& parid);
64 string getFileId(int actnequi, const bool& shortid=false);
69 stringstream outFileName;
73 boost::iostreams::filtering_istreambuf *inBuffer;
74 boost::iostreams::filtering_ostreambuf *outBuffer;
82 bool refetchDataFiles;
84 void fetchDataFiles();
86 bool isValidInFile(const string& infile, infiledesc *filedesc);
88 vector<infiledesc> inFiles;
90 vector<parameter> Paras;
92 int readDataToMem(char *tmpData, long unsigned int dataSize);
94 void openOutFile(int actnequi);
100 int readFullBlock(char *tmpData, long unsigned int dataSize);
102 vector< pair<unsigned long, void *> > headerStore;
104 void deleteHeaderStore();
106 bool readAllHeaders();
108 vector<infiledesc>::iterator getNextInfile(vector<unsigned long> *excludeFileHashes);
110 int nequileft_internal;
112 bool doVirtualEquilibration, firstUsedConfig;