project(latlib)
-set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")
+#set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")
#PROFILING
#set(CMAKE_CXX_FLAGS -pg)
if ( ! infile.is_open() ) return -1;
if( filename.substr(filename.size()-4) == ".dat" ) {
- format = Format::DAT;
+ format = DAT;
}
else if( filename.substr(filename.size()-4) == "edat" ) {
- format = Format::EDAT;
+ format = EDAT;
}
else if( filename.substr(filename.size()-4) == "sdat" ) {
- format = Format::SDAT;
+ format = SDAT;
getline(infile, parastring);
}
- inbuffer = unique_ptr<boost::iostreams::filtering_istreambuf>(new boost::iostreams::filtering_istreambuf);
+ if ( inbuffer != NULL )
+ delete inbuffer;
+
+ inbuffer = new boost::iostreams::filtering_istreambuf;
inbuffer->push( boost::iostreams::bzip2_decompressor() );
inbuffer->push(infile);
return -4;
/* try to read header */
- if ( format == Format::EDAT || format == Format::SDAT )
+ if ( format == EDAT || format == SDAT )
if ( ! readAllHeaders() ) {
infile.close();
return -1;
if ( infile.is_open() )
infile.close();
}
+
+datread::~datread ()
+{
+ if ( inbuffer != NULL )
+ delete inbuffer;
+}
#include <ostream>
#include <fstream>
#include <memory>
+#include <vector>
#include <boost/iostreams/filtering_streambuf.hpp>
#include <boost/iostreams/filter/bzip2.hpp>
class datread {
public:
+ ~datread ();
datread (const unsigned int& _blocksize, ostream *_log=NULL);
int openFile (const string& filename);
- enum class Format {DAT, EDAT, SDAT};
+ enum Format {DAT, EDAT, SDAT};
void * getHeader (const string& headerid);
int readFullBlock (char *tmpData);
bool fisopen ();
ifstream infile;
Format format;
string parastring;
- unique_ptr<boost::iostreams::filtering_istreambuf> inbuffer;
+ boost::iostreams::filtering_istreambuf *inbuffer;
ostream * const log;
int readDataToMem (char *tmpData, long unsigned int dataSize);
string filename;