]> git.treefish.org Git - phys/latlib.git/blob - datread.h
Added startconfig option.
[phys/latlib.git] / datread.h
1 #ifndef DATREAD_H
2 #define DATREAD_H
3
4 #include <ostream>
5 #include <fstream>
6
7 #include <boost/iostreams/filtering_streambuf.hpp>
8 #include <boost/iostreams/filter/bzip2.hpp>
9
10 using namespace std;
11
12 class datread {
13  public:
14   datread (const unsigned int& _blocksize, ostream *_log=NULL);
15   ~datread ();
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   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