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