From: Alexander Schmidt Date: Fri, 5 Dec 2014 12:38:52 +0000 (+0100) Subject: Added resetconfig routine. X-Git-Url: http://git.treefish.org/~alex/phys/latlib.git/commitdiff_plain/da120f552639e7e742161a2a4d6f88ca5277df8e?ds=sidebyside Added resetconfig routine. --- diff --git a/datread.cpp b/datread.cpp index 41d3724..4a0e31d 100644 --- a/datread.cpp +++ b/datread.cpp @@ -26,22 +26,13 @@ int datread::openFile (const string& filename) getline(infile, parastring); } - if (inbuffer != NULL) - delete inbuffer; - - inbuffer = new boost::iostreams::filtering_istreambuf; + inbuffer = unique_ptr(new boost::iostreams::filtering_istreambuf); inbuffer->push( boost::iostreams::bzip2_decompressor() ); inbuffer->push(infile); return 0; } -datread::~datread () -{ - if (inbuffer != NULL) - delete inbuffer; -} - int datread::readDataToMem (char *tmpData, long unsigned int dataSize) { int readturn = -1; diff --git a/datread.h b/datread.h index 8ef4b15..64fd850 100644 --- a/datread.h +++ b/datread.h @@ -3,6 +3,7 @@ #include #include +#include #include #include @@ -12,7 +13,6 @@ 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); @@ -25,7 +25,7 @@ class datread { ifstream infile; Format format; string parastring; - boost::iostreams::filtering_istreambuf *inbuffer; + unique_ptr inbuffer; ostream * const log; int readDataToMem (char *tmpData, long unsigned int dataSize); string filename; diff --git a/o815/o815.cpp b/o815/o815.cpp index 73e3497..36d9fb0 100644 --- a/o815/o815.cpp +++ b/o815/o815.cpp @@ -144,6 +144,8 @@ void o815::mainLoop() { *out->log << ">" << endl << flush; Sim->_newParas(); + + Sim->_resetConfig(); progress measProg(comargs.nmeas); diff --git a/o815/o815.h b/o815/o815.h index 5873a14..0505387 100644 --- a/o815/o815.h +++ b/o815/o815.h @@ -45,6 +45,7 @@ class o815 { void nextConfig(); char *confMem; virtual void _newParas()=0; + virtual void _resetConfig()=0; int nequi, nskip; private: virtual void _makeSweep()=0;