]> git.treefish.org Git - phys/latlib.git/blob - datread.h
Made c++11 standard dependency obsolete.
[phys/latlib.git] / datread.h
1 #ifndef DATREAD_H
2 #define DATREAD_H
3
4 #include <ostream>
5 #include <fstream>
6 #include <memory>
7 #include <vector>
8
9 #include <boost/iostreams/filtering_streambuf.hpp>
10 #include <boost/iostreams/filter/bzip2.hpp>
11
12 using namespace std;
13
14 class datread {
15  public:
16   ~datread ();
17   datread (const unsigned int& _blocksize, ostream *_log=NULL);
18   int openFile (const string& filename);
19   enum Format {DAT, EDAT, SDAT};
20   void * getHeader (const string& headerid);
21   int readFullBlock (char *tmpData);
22   bool fisopen ();
23   string getParaString ();
24   void closeFile ();
25  private:
26   const unsigned int blocksize;
27   ifstream infile;
28   Format format;
29   string parastring;
30   boost::iostreams::filtering_istreambuf *inbuffer;
31   ostream * const log;
32   int readDataToMem (char *tmpData, long unsigned int dataSize);
33   string filename;
34   int readHeader ();
35   vector< pair<unsigned long, void *> > headerStore;
36   void deleteHeaderStore ();
37   bool readAllHeaders ();
38   static unsigned long hash(const string& str);
39 };
40
41 #endif