diff --git a/latan/AsciiFile.cpp b/latan/AsciiFile.cpp index d8f2e9b..c56119e 100644 --- a/latan/AsciiFile.cpp +++ b/latan/AsciiFile.cpp @@ -41,12 +41,6 @@ AsciiFile::AsciiParserState::~AsciiParserState(void) } // constructor ///////////////////////////////////////////////////////////////// -AsciiFile::AsciiFile(void) -: File(), fileStream_() -, isParsed_(false) -, state_(nullptr) -{} - AsciiFile::AsciiFile(const string &name, const unsigned int mode) { open(name, mode); diff --git a/latan/AsciiFile.hpp b/latan/AsciiFile.hpp index 6bb8559..e419351 100644 --- a/latan/AsciiFile.hpp +++ b/latan/AsciiFile.hpp @@ -25,6 +25,7 @@ #include #include #include +#include BEGIN_NAMESPACE @@ -38,8 +39,8 @@ public: { public: // constructor - explicit AsciiParserState(std::istream *stream, std::string *name, - IoDataTable *data); + AsciiParserState(std::istream *stream, std::string *name, + IoDataTable *data); // destructor virtual ~AsciiParserState(void); // first element reference @@ -58,7 +59,7 @@ public: }; public: // constructors - AsciiFile(void); + AsciiFile(void) = default; AsciiFile(const std::string &name, const unsigned int mode); // destructor virtual ~AsciiFile(void); @@ -78,8 +79,8 @@ private: void parse(void); private: std::fstream fileStream_; - bool isParsed_; - std::unique_ptr state_; + bool isParsed_{false}; + std::unique_ptr state_{nullptr}; }; END_NAMESPACE diff --git a/latan/AsciiParser.ypp b/latan/AsciiParser.ypp index 1c63aa2..3803564 100644 --- a/latan/AsciiParser.ypp +++ b/latan/AsciiParser.ypp @@ -18,16 +18,15 @@ */ %{ - #include - #include - #include - #include - #include #include #include #include #include #include + #include + #include + #include + #include using namespace std; using namespace Latan; diff --git a/latan/Chi2Function.hpp b/latan/Chi2Function.hpp index d888983..ceb03e7 100644 --- a/latan/Chi2Function.hpp +++ b/latan/Chi2Function.hpp @@ -23,7 +23,6 @@ #include #include #include -#include BEGIN_NAMESPACE @@ -45,7 +44,7 @@ private: }; public: // constructor - Chi2Function(const XYStatData &data); + explicit Chi2Function(const XYStatData &data); Chi2Function(const XYStatData &data, const std::vector &modelVector); // destructor diff --git a/latan/CompiledFunction.hpp b/latan/CompiledFunction.hpp index 6805030..175661a 100644 --- a/latan/CompiledFunction.hpp +++ b/latan/CompiledFunction.hpp @@ -23,10 +23,8 @@ #include #include #include -#include #include #include -#include BEGIN_NAMESPACE @@ -37,7 +35,7 @@ class CompiledDoubleFunction: public DoubleFunction { public: // constructors - CompiledDoubleFunction(const unsigned nArg); + explicit CompiledDoubleFunction(const unsigned nArg); CompiledDoubleFunction(const unsigned nArg, const std::string &code); // destructor virtual ~CompiledDoubleFunction(void) = default; diff --git a/latan/Dataset.hpp b/latan/Dataset.hpp index 088034d..5086504 100644 --- a/latan/Dataset.hpp +++ b/latan/Dataset.hpp @@ -39,10 +39,10 @@ private: typedef StatArray Base; public: // constructors - using Base::Base; - Dataset(void); + Dataset(void) = default; template Dataset(const std::string &listFileName, const std::string &dataName); + using Base::Base; // destructor virtual ~Dataset(void) = default; // IO @@ -59,10 +59,6 @@ private: * Dataset template implementation * ******************************************************************************/ // constructor ///////////////////////////////////////////////////////////////// -template -Dataset::Dataset(void) -{} - template template Dataset::Dataset(const std::string &listFileName, diff --git a/latan/Exceptions.hpp b/latan/Exceptions.hpp index 2c4bba3..b1b3e57 100644 --- a/latan/Exceptions.hpp +++ b/latan/Exceptions.hpp @@ -36,7 +36,7 @@ std::cerr << Env::msgPrefix << "warning: " << msg\ class name: public base\ {\ public:\ - explicit name(std::string msg, std::string loc);\ + name(std::string msg, std::string loc);\ } BEGIN_NAMESPACE diff --git a/latan/File.cpp b/latan/File.cpp index 105edd3..63e7909 100644 --- a/latan/File.cpp +++ b/latan/File.cpp @@ -27,16 +27,9 @@ using namespace Latan; * File implementation * ******************************************************************************/ // constructors //////////////////////////////////////////////////////////////// -File::File(void) -: name_("") -, mode_(Mode::null) -, data_() -{} - File::File(const string &name, const unsigned int mode) : name_(name) , mode_(mode) -, data_() {} // destructor ////////////////////////////////////////////////////////////////// diff --git a/latan/File.hpp b/latan/File.hpp index 4975b4b..d6210a9 100644 --- a/latan/File.hpp +++ b/latan/File.hpp @@ -20,15 +20,11 @@ #ifndef Latan_Io_hpp_ #define Latan_Io_hpp_ -#include -#include -#include -#include -#include -#include #include #include #include +#include +#include BEGIN_NAMESPACE @@ -59,7 +55,7 @@ public: }; public: // constructors - File(void); + File(void) = default; File(const std::string &name, const unsigned int mode); // destructor virtual ~File(void); @@ -93,8 +89,8 @@ private: // IO virtual std::string load(const std::string &name = "") = 0; protected: - std::string name_; - unsigned int mode_; + std::string name_{""}; + unsigned int mode_{Mode::null}; IoDataTable data_; }; diff --git a/latan/Function.hpp b/latan/Function.hpp index 0522bd5..73538dc 100644 --- a/latan/Function.hpp +++ b/latan/Function.hpp @@ -23,7 +23,6 @@ #include #include #include -#include #include #include @@ -38,7 +37,8 @@ private: typedef std::function vecFunc; public: // constructor - DoubleFunction(const Index nArg = 0, const vecFunc &f = nullFunction_); + explicit DoubleFunction(const Index nArg = 0, + const vecFunc &f = nullFunction_); // destructor virtual ~DoubleFunction(void) = default; // access diff --git a/latan/Global.hpp b/latan/Global.hpp index f9438c0..db5d78e 100644 --- a/latan/Global.hpp +++ b/latan/Global.hpp @@ -21,7 +21,7 @@ #define Latan_Global_hpp_ #include -#include +#include #include #include #include diff --git a/latan/Mat.cpp b/latan/Mat.cpp index 9db683b..61bdbf4 100644 --- a/latan/Mat.cpp +++ b/latan/Mat.cpp @@ -27,10 +27,6 @@ using namespace Latan; * DMat class * ******************************************************************************/ // constructors //////////////////////////////////////////////////////////////// -DMat::DMat(void) -: Base() -{} - DMat::DMat(const Index nRow, const Index nCol) : Base(nRow, nCol) {} diff --git a/latan/Mat.hpp b/latan/Mat.hpp index 0d9732f..d9dafa4 100644 --- a/latan/Mat.hpp +++ b/latan/Mat.hpp @@ -35,7 +35,7 @@ private: typedef DMatBase Base; public: // constructors - DMat(void); + DMat(void) = default; DMat(const Index nRow, const Index nCol); EIGEN_EXPR_CTOR(DMat, DMat, Base, MatrixBase) // destructor diff --git a/latan/Math.hpp b/latan/Math.hpp index 1904ea5..4f86244 100644 --- a/latan/Math.hpp +++ b/latan/Math.hpp @@ -23,7 +23,6 @@ #include #include #include -#include BEGIN_NAMESPACE diff --git a/latan/MathInterpreter.cpp b/latan/MathInterpreter.cpp index 630b491..5c8f8dd 100644 --- a/latan/MathInterpreter.cpp +++ b/latan/MathInterpreter.cpp @@ -382,20 +382,8 @@ MathInterpreter::MathParserState::~MathParserState(void) } // constructors //////////////////////////////////////////////////////////////// -MathInterpreter::MathInterpreter(void) -: code_(nullptr) -, codeName_("") -, state_(nullptr) -, root_(nullptr) -, status_(Status::none) -{} - MathInterpreter::MathInterpreter(const std::string &code) -: code_(nullptr) -, codeName_("") -, state_(nullptr) -, root_(nullptr) -, status_(Status::none) +: codeName_("") { setCode(code); } diff --git a/latan/MathInterpreter.hpp b/latan/MathInterpreter.hpp index deed068..4e0538c 100644 --- a/latan/MathInterpreter.hpp +++ b/latan/MathInterpreter.hpp @@ -84,8 +84,8 @@ private: virtual void print(std::ostream& out) const; private: ArgType type_; - double val_; - std::string name_; + double val_; + std::string name_; }; // Pop @@ -135,7 +135,7 @@ private: class name: public Instruction\ {\ public:\ -virtual void operator()(RunContext &context) const;\ + virtual void operator()(RunContext &context) const;\ private:\ virtual void print(std::ostream &out) const;\ } @@ -154,7 +154,7 @@ class ExprNode { public: // constructors - ExprNode(const std::string &name); + explicit ExprNode(const std::string &name); // destructor virtual ~ExprNode() = default; // access @@ -205,7 +205,6 @@ DECL_NODE(KeywordNode, ReturnNode); ******************************************************************************/ class MathInterpreter { - public: // parser state class MathParserState: public ParserState> @@ -236,7 +235,7 @@ private: }; public: // constructors - MathInterpreter(void); + MathInterpreter(void) = default; MathInterpreter(const std::string &code); // destructor ~MathInterpreter(void) = default; @@ -264,12 +263,12 @@ private: // execution void execute(RunContext &context) const; private: - std::unique_ptr code_; - std::string codeName_; - std::unique_ptr state_; - std::unique_ptr root_; + std::unique_ptr code_{nullptr}; + std::string codeName_{""}; + std::unique_ptr state_{nullptr}; + std::unique_ptr root_{nullptr}; Program program_; - unsigned int status_; + unsigned int status_{Status::none}; }; std::ostream & operator<<(std::ostream &out, const MathInterpreter &program); diff --git a/latan/Minimizer.hpp b/latan/Minimizer.hpp index db80ebb..d02a30b 100644 --- a/latan/Minimizer.hpp +++ b/latan/Minimizer.hpp @@ -41,7 +41,7 @@ public: }; public: // constructor - Minimizer(Verbosity verbosity = Verbosity::Silent); + explicit Minimizer(Verbosity verbosity = Verbosity::Silent); // destructor virtual ~Minimizer(void) = default; // access diff --git a/latan/Model.hpp b/latan/Model.hpp index 81534c3..6709c96 100644 --- a/latan/Model.hpp +++ b/latan/Model.hpp @@ -22,7 +22,6 @@ #include #include -#include #include BEGIN_NAMESPACE diff --git a/latan/ParserState.hpp b/latan/ParserState.hpp index 771e691..eaba089 100644 --- a/latan/ParserState.hpp +++ b/latan/ParserState.hpp @@ -22,7 +22,6 @@ #include #include -#include BEGIN_NAMESPACE @@ -31,8 +30,7 @@ class ParserState { public: // constructor - explicit ParserState(std::istream *streamPt, std::string *namePt, - DataObj *dataPt); + ParserState(std::istream *streamPt, std::string *namePt, DataObj *dataPt); // destructor virtual ~ParserState(void) = default; private: diff --git a/latan/Plot.cpp b/latan/Plot.cpp index 2ce5d46..a934e7a 100644 --- a/latan/Plot.cpp +++ b/latan/Plot.cpp @@ -143,10 +143,6 @@ void PlotRange::operator()(PlotOptions &option) const /****************************************************************************** * Plot implementation * ******************************************************************************/ -// constructor ///////////////////////////////////////////////////////////////// -Plot::Plot(void) -{} - // destructor ////////////////////////////////////////////////////////////////// Plot::~Plot(void) { diff --git a/latan/Plot.hpp b/latan/Plot.hpp index 5b650a3..a32b949 100644 --- a/latan/Plot.hpp +++ b/latan/Plot.hpp @@ -20,11 +20,11 @@ #ifndef Latan_Plot_hpp_ #define Latan_Plot_hpp_ +#include +#include #include #include #include -#include -#include // gnuplot default parameters #ifndef GNUPLOT_BIN @@ -144,7 +144,7 @@ class PlotRange: public PlotModifier { public: // constructor - explicit PlotRange(const Axis axis, const double min, const double max); + PlotRange(const Axis axis, const double min, const double max); // destructor virtual ~PlotRange(void) = default; // modifier @@ -172,7 +172,7 @@ public: }; public: // constructor/destructor - Plot(void); + Plot(void) = default; virtual ~Plot(void); // plot operations Plot & operator<<(PlotObject &&command); diff --git a/latan/RandGen.cpp b/latan/RandGen.cpp index 0517b08..927d31a 100644 --- a/latan/RandGen.cpp +++ b/latan/RandGen.cpp @@ -41,7 +41,6 @@ IoObject::IoType RandGenState::getType(void) const ******************************************************************************/ // RanLxd implementation /////////////////////////////////////////////////////// RandGen::RanLxd::RanLxd(void) -: init(0) { // avoid a warning in the SSE case one_bit = 0.0; diff --git a/latan/RandGen.hpp b/latan/RandGen.hpp index 068ab8e..64f69e1 100644 --- a/latan/RandGen.hpp +++ b/latan/RandGen.hpp @@ -50,14 +50,14 @@ private: class RanLxd { private: - typedef struct + typedef struct alignas(16) { float c1,c2,c3,c4; - } rlxd_vec_t __attribute__ ((aligned (16))); - typedef struct + } rlxd_vec_t; + typedef struct alignas(16) { rlxd_vec_t c1,c2; - } rlxd_dble_vec_t __attribute__ ((aligned (16))); + } rlxd_dble_vec_t; public: RanLxd(void); ~RanLxd(void) = default; @@ -71,20 +71,20 @@ private: void update(void); void define_constants(void); private: - int init, rlxd_pr, prm, ir, jr, is, is_old, next[96]; + int init{0}, rlxd_pr, prm, ir, jr, is, is_old, next[96]; rlxd_vec_t one_sse, one_bit_sse, carry; double one_bit; - union + union alignas(16) { rlxd_dble_vec_t vec[12]; float num[96]; - } rlxd_x __attribute__ ((aligned (16))); + } rlxd_x; }; public: // constructors RandGen(void); - RandGen(const int seed); - RandGen(const RandGenState &state); + explicit RandGen(const int seed); + explicit RandGen(const RandGenState &state); // destructor virtual ~RandGen(void) = default; // state management diff --git a/latan/Sample.cpp b/latan/Sample.cpp index fb94b97..73d3b4c 100644 --- a/latan/Sample.cpp +++ b/latan/Sample.cpp @@ -27,10 +27,6 @@ using namespace std; * DMatSample implementation * ******************************************************************************/ // constructors //////////////////////////////////////////////////////////////// -DMatSample::DMatSample(void) -: Sample() -{} - DMatSample::DMatSample(const Index nSample, const Index nRow, const Index nCol) : Sample(nSample) @@ -41,7 +37,10 @@ DMatSample::DMatSample(const Index nSample, const Index nRow, // resize all matrices ///////////////////////////////////////////////////////// void DMatSample::resizeMat(const Index nRow, const Index nCol) { - this->unaryExpr([nRow, nCol](DMat &m){m.resize(nRow, nCol);}); + FOR_VEC(*this, s) + { + (*this)[s].resize(nRow, nCol); + } } // IO type ///////////////////////////////////////////////////////////////////// diff --git a/latan/Sample.hpp b/latan/Sample.hpp index 570b701..51404d4 100644 --- a/latan/Sample.hpp +++ b/latan/Sample.hpp @@ -41,6 +41,7 @@ private: typedef StatArray Base; public: // constructors + Sample(void) = default; using Base::Base; // destructor virtual ~Sample(void) = default; @@ -53,7 +54,7 @@ class DMatSample: public Sample, public IoObject { public: // constructors - DMatSample(void); + DMatSample(void) = default; DMatSample(const Index nSample, const Index nRow, const Index nCol); using Sample::Sample; // destructor diff --git a/latan/StatArray.hpp b/latan/StatArray.hpp index fba01b7..dc255eb 100644 --- a/latan/StatArray.hpp +++ b/latan/StatArray.hpp @@ -37,7 +37,7 @@ private: public: // constructors StatArray(void); - StatArray(const Index size); + explicit StatArray(const Index size); EIGEN_EXPR_CTOR(StatArray, unique_arg(StatArray), Base, ArrayBase) // destructor diff --git a/latan/XYStatData.hpp b/latan/XYStatData.hpp index f2d11f2..63841a2 100644 --- a/latan/XYStatData.hpp +++ b/latan/XYStatData.hpp @@ -26,7 +26,6 @@ #include #include #include -#include BEGIN_NAMESPACE @@ -38,7 +37,8 @@ class FitResult: public DVec friend class XYStatData; public: // constructors - using DVec::DVec; + FitResult(void) = default; + EIGEN_EXPR_CTOR(FitResult, FitResult, Base, MatrixBase) // destructor virtual ~FitResult(void) = default; // access @@ -108,10 +108,10 @@ public: const DVec &init, const bool reinitChi2 = true, const FitVerbosity verbosity = FitVerbosity::Silent); private: - DMat x_, y_; - Mat var_[3]; - IVec isXExact_, isFitPoint_; - Chi2Function chi2_; + DMat x_, y_; + Mat var_[3]; + IVec isXExact_, isFitPoint_; + Chi2Function chi2_; }; /******************************************************************************