]> git.treefish.org Git - phys/latlib.git/blobdiff - datread.h
...
[phys/latlib.git] / datread.h
diff --git a/datread.h b/datread.h
new file mode 100644 (file)
index 0000000..8ef4b15
--- /dev/null
+++ b/datread.h
@@ -0,0 +1,39 @@
+#ifndef DATREAD_H
+#define DATREAD_H
+
+#include <ostream>
+#include <fstream>
+
+#include <boost/iostreams/filtering_streambuf.hpp>
+#include <boost/iostreams/filter/bzip2.hpp>
+
+using namespace std;
+
+class datread {
+ public:
+  datread (const unsigned int& _blocksize, ostream *_log=NULL);
+  ~datread ();
+  int openFile (const string& filename);
+  enum class Format {DAT, EDAT, SDAT};
+  void * getHeader (const string& headerid);
+  int readFullBlock (char *tmpData);
+  bool fisopen ();
+  string getParaString ();
+  void closeFile ();
+ private:
+  const unsigned int blocksize;
+  ifstream infile;
+  Format format;
+  string parastring;
+  boost::iostreams::filtering_istreambuf *inbuffer;
+  ostream * const log;
+  int readDataToMem (char *tmpData, long unsigned int dataSize);
+  string filename;
+  int readHeader ();
+  vector< pair<unsigned long, void *> > headerStore;
+  void deleteHeaderStore ();
+  bool readAllHeaders ();
+  static unsigned long hash(const string& str);
+};
+
+#endif