mirror of
https://github.com/aportelli/LatAnalyze.git
synced 2024-11-10 00:45:36 +00:00
code cleaning
This commit is contained in:
parent
5a3f6a6106
commit
9ce04cd7d6
@ -27,7 +27,7 @@ using namespace Latan;
|
||||
/******************************************************************************
|
||||
* Compiled double function implementation *
|
||||
******************************************************************************/
|
||||
// constructor /////////////////////////////////////////////////////////////////
|
||||
// constructors ////////////////////////////////////////////////////////////////
|
||||
CompiledDoubleFunction::CompiledDoubleFunction(const unsigned nArg)
|
||||
: DoubleFunction(nArg)
|
||||
{}
|
||||
@ -39,10 +39,6 @@ CompiledDoubleFunction::CompiledDoubleFunction(const unsigned nArg,
|
||||
setCode(code);
|
||||
}
|
||||
|
||||
// destructor //////////////////////////////////////////////////////////////////
|
||||
CompiledDoubleFunction::~CompiledDoubleFunction(void)
|
||||
{}
|
||||
|
||||
// access //////////////////////////////////////////////////////////////////////
|
||||
void CompiledDoubleFunction::setCode(const string &code)
|
||||
{
|
||||
|
@ -41,7 +41,7 @@ public:
|
||||
explicit CompiledDoubleFunction(const unsigned nArg,
|
||||
const std::string &code);
|
||||
// destructor
|
||||
virtual ~CompiledDoubleFunction(void);
|
||||
virtual ~CompiledDoubleFunction(void) = default;
|
||||
// access
|
||||
void setCode(const std::string &code);
|
||||
// function call
|
||||
|
@ -38,12 +38,12 @@ class Dataset: public StatArray<T>
|
||||
private:
|
||||
typedef StatArray<T> Base;
|
||||
public:
|
||||
// constructor
|
||||
// constructors
|
||||
using Base::Base;
|
||||
Dataset(void);
|
||||
Dataset(const std::string &listFileName, const std::string &dataName);
|
||||
// destructor
|
||||
virtual ~Dataset(void);
|
||||
virtual ~Dataset(void) = default;
|
||||
// IO
|
||||
void load(const std::string &listFileName, const std::string &dataName);
|
||||
// resampling
|
||||
@ -70,11 +70,6 @@ Dataset<T, FileType>::Dataset(const std::string &listFileName,
|
||||
load(listFileName, dataName);
|
||||
}
|
||||
|
||||
// destructor //////////////////////////////////////////////////////////////////
|
||||
template <typename T, typename FileType>
|
||||
Dataset<T, FileType>::~Dataset(void)
|
||||
{}
|
||||
|
||||
// IO //////////////////////////////////////////////////////////////////////////
|
||||
template <typename T, typename FileType>
|
||||
void Dataset<T, FileType>::load(const std::string &listFileName,
|
||||
|
@ -33,18 +33,14 @@ using namespace std;
|
||||
using namespace Latan;
|
||||
using namespace Exceptions;
|
||||
|
||||
// prefix for messages
|
||||
const string Latan::Exceptions::prefix = "[" + strFrom(PACKAGE_NAME) + " v"
|
||||
+ strFrom(PACKAGE_VERSION) + "] ";
|
||||
|
||||
// logic errors
|
||||
CONST_EXC(Logic, logic_error(prefix + msg + ERR_SUFF))
|
||||
CONST_EXC(Logic, logic_error(Env::msgPrefix + msg + ERR_SUFF))
|
||||
CONST_EXC(Definition, Logic("definition error: " + msg, loc))
|
||||
CONST_EXC(Implementation, Logic("implementation error: " + msg, loc))
|
||||
CONST_EXC(Range, Logic("range error: " + msg, loc))
|
||||
CONST_EXC(Size, Logic("size error: " + msg, loc))
|
||||
// runtime errors
|
||||
CONST_EXC(Runtime, runtime_error(prefix + msg + ERR_SUFF))
|
||||
CONST_EXC(Runtime, runtime_error(Env::msgPrefix + msg + ERR_SUFF))
|
||||
CONST_EXC(Compilation, Runtime("compilation error: " + msg, loc))
|
||||
CONST_EXC(Io, Runtime("IO error: " + msg, loc))
|
||||
CONST_EXC(Parsing, Runtime(msg, loc))
|
||||
|
@ -29,7 +29,7 @@
|
||||
+ strFrom(__LINE__)
|
||||
#define LATAN_ERROR(exc,msg) throw(Exceptions::exc(msg, SRC_LOC))
|
||||
#define LATAN_WARNING(msg) \
|
||||
std::cerr << Latan::Exceptions::prefix << "warning: " << msg\
|
||||
std::cerr << Env::msgPrefix << "warning: " << msg\
|
||||
<< " (" << SRC_LOC << ")" << std::endl
|
||||
|
||||
#define DECL_EXC(name, base) \
|
||||
@ -43,9 +43,6 @@ BEGIN_NAMESPACE
|
||||
|
||||
namespace Exceptions
|
||||
{
|
||||
// prefix for messages
|
||||
extern const std::string prefix;
|
||||
|
||||
// logic errors
|
||||
DECL_EXC(Logic, std::logic_error);
|
||||
DECL_EXC(Definition, Logic);
|
||||
|
@ -44,14 +44,11 @@ using namespace Latan;
|
||||
/******************************************************************************
|
||||
* Function implementation *
|
||||
******************************************************************************/
|
||||
// constructor/destructor //////////////////////////////////////////////////////
|
||||
// constructor /////////////////////////////////////////////////////////////////
|
||||
Function::Function(const unsigned nArg)
|
||||
: nArg_(nArg)
|
||||
{}
|
||||
|
||||
Function::~Function(void)
|
||||
{}
|
||||
|
||||
// access //////////////////////////////////////////////////////////////////////
|
||||
unsigned int Function::getNArg(void) const
|
||||
{
|
||||
@ -61,15 +58,14 @@ unsigned int Function::getNArg(void) const
|
||||
/******************************************************************************
|
||||
* DoubleFunction implementation *
|
||||
******************************************************************************/
|
||||
// constructor /////////////////////////////////////////////////////////////////
|
||||
DoubleFunction::DoubleFunction(const unsigned nArg, vecFunc f)
|
||||
: Function(nArg)
|
||||
, buffer_(new vector<double>(nArg))
|
||||
, f_(f)
|
||||
{}
|
||||
|
||||
DoubleFunction::~DoubleFunction(void)
|
||||
{}
|
||||
|
||||
// function call ///////////////////////////////////////////////////////////////
|
||||
double DoubleFunction::evaluate(const std::vector<double> &arg) const
|
||||
{
|
||||
return f_(arg);
|
||||
|
@ -35,9 +35,10 @@ BEGIN_NAMESPACE
|
||||
class Function
|
||||
{
|
||||
public:
|
||||
// constructor/destructor
|
||||
// constructor
|
||||
explicit Function(const unsigned nArg);
|
||||
virtual ~Function(void);
|
||||
// destructor
|
||||
virtual ~Function(void) = default;
|
||||
// access
|
||||
unsigned int getNArg(void) const;
|
||||
private:
|
||||
@ -52,9 +53,10 @@ class DoubleFunction: public Function
|
||||
private:
|
||||
typedef std::function<double(const std::vector<double> &)> vecFunc;
|
||||
public:
|
||||
// constructor/destructor
|
||||
// constructor
|
||||
explicit DoubleFunction(const unsigned nArg, vecFunc f = nullptr);
|
||||
virtual ~DoubleFunction(void);
|
||||
// destructor
|
||||
virtual ~DoubleFunction(void) = default;
|
||||
// function call
|
||||
virtual double evaluate(const std::vector<double> &arg) const;
|
||||
double operator()(std::stack<double> &arg) const;
|
||||
|
@ -26,3 +26,5 @@ using namespace Latan;
|
||||
const string Env::fullName = PACKAGE_STRING;
|
||||
const string Env::name = PACKAGE_NAME;
|
||||
const string Env::version = PACKAGE_VERSION;
|
||||
const string Env::msgPrefix = "[" + strFrom(PACKAGE_NAME) + " v"
|
||||
+ strFrom(PACKAGE_VERSION) + "] ";
|
@ -59,6 +59,7 @@ namespace Env
|
||||
extern const std::string fullName;
|
||||
extern const std::string name;
|
||||
extern const std::string version;
|
||||
extern const std::string msgPrefix;
|
||||
}
|
||||
|
||||
// pointer type test
|
||||
|
@ -36,7 +36,7 @@
|
||||
BEGIN_NAMESPACE
|
||||
|
||||
/******************************************************************************
|
||||
* Generic datafile class *
|
||||
* Abstract datafile class *
|
||||
******************************************************************************/
|
||||
typedef std::unordered_map<std::string, std::unique_ptr<IoObject>> IoDataTable;
|
||||
|
||||
|
@ -36,7 +36,9 @@ public:
|
||||
rgState = 3
|
||||
};
|
||||
public:
|
||||
virtual ~IoObject(void) {};
|
||||
// destructor
|
||||
virtual ~IoObject(void) = default;
|
||||
// access
|
||||
virtual IoType getType(void) const = 0;
|
||||
};
|
||||
|
||||
|
@ -37,6 +37,8 @@ public:
|
||||
DMat(void);
|
||||
DMat(const unsigned int nRow, const unsigned int nCol);
|
||||
EIGEN_EXPR_CTOR(DMat, DMat, Base, MatrixBase)
|
||||
// destructor
|
||||
virtual ~DMat(void) = default;
|
||||
// IO
|
||||
virtual IoType getType(void) const;
|
||||
};
|
||||
|
@ -400,10 +400,6 @@ MathInterpreter::MathInterpreter(const std::string &code)
|
||||
setCode(code);
|
||||
}
|
||||
|
||||
// destructor //////////////////////////////////////////////////////////////////
|
||||
MathInterpreter::~MathInterpreter(void)
|
||||
{}
|
||||
|
||||
// access //////////////////////////////////////////////////////////////////////
|
||||
const Instruction * MathInterpreter::operator[](const unsigned int i) const
|
||||
{
|
||||
|
@ -239,7 +239,7 @@ public:
|
||||
MathInterpreter(void);
|
||||
MathInterpreter(const std::string &code);
|
||||
// destructor
|
||||
~MathInterpreter(void);
|
||||
~MathInterpreter(void) = default;
|
||||
// access
|
||||
const Instruction * operator[](const unsigned int i) const;
|
||||
const ExprNode * getAST(void) const;
|
||||
|
@ -34,7 +34,7 @@ public:
|
||||
explicit ParserState(std::istream *streamPt, std::string *namePt,
|
||||
DataObj *dataPt);
|
||||
// destructor
|
||||
virtual ~ParserState(void);
|
||||
virtual ~ParserState(void) = default;
|
||||
private:
|
||||
// scanner allocation/deallocation
|
||||
virtual void initScanner(void) = 0;
|
||||
@ -56,10 +56,6 @@ ParserState<DataObj>::ParserState(std::istream *streamPt, std::string *namePt,
|
||||
, streamName(namePt)
|
||||
{}
|
||||
|
||||
template <typename DataObj>
|
||||
ParserState<DataObj>::~ParserState(void)
|
||||
{}
|
||||
|
||||
END_NAMESPACE
|
||||
|
||||
#endif // Latan_ParserState_hpp_
|
||||
|
@ -36,17 +36,12 @@ PlotCommand::PlotCommand(const string &command)
|
||||
: command_(command)
|
||||
{}
|
||||
|
||||
// destructor //////////////////////////////////////////////////////////////////
|
||||
PlotCommand::~PlotCommand(void)
|
||||
{}
|
||||
|
||||
// access //////////////////////////////////////////////////////////////////////
|
||||
const std::string & PlotCommand::getCommand(void) const
|
||||
{
|
||||
return command_;
|
||||
}
|
||||
|
||||
|
||||
/******************************************************************************
|
||||
* Plot implementation *
|
||||
******************************************************************************/
|
||||
|
@ -42,10 +42,11 @@ BEGIN_NAMESPACE
|
||||
class PlotCommand
|
||||
{
|
||||
public:
|
||||
// constructors/destructor
|
||||
// constructors
|
||||
PlotCommand(void);
|
||||
PlotCommand(const std::string &command);
|
||||
virtual ~PlotCommand(void);
|
||||
// destructor
|
||||
virtual ~PlotCommand(void) = default;
|
||||
// access
|
||||
virtual const std::string & getCommand(void) const;
|
||||
protected:
|
||||
|
@ -30,13 +30,11 @@ using namespace Latan;
|
||||
/******************************************************************************
|
||||
* RandGen implementation *
|
||||
******************************************************************************/
|
||||
// State implentation //////////////////////////////////////////////////////////
|
||||
// State constructor ///////////////////////////////////////////////////////////
|
||||
RandGen::State::State(void)
|
||||
{}
|
||||
|
||||
RandGen::State::~State(void)
|
||||
{}
|
||||
|
||||
// State IO type ///////////////////////////////////////////////////////////////
|
||||
IoObject::IoType RandGen::State::getType(void) const
|
||||
{
|
||||
return IoType::rgState;
|
||||
@ -647,10 +645,6 @@ RandGen::RandGen(const State &state)
|
||||
setState(state);
|
||||
}
|
||||
|
||||
// destructor //////////////////////////////////////////////////////////////////
|
||||
RandGen::~RandGen(void)
|
||||
{}
|
||||
|
||||
// state management ////////////////////////////////////////////////////////////
|
||||
RandGen::State RandGen::getState(void) const
|
||||
{
|
||||
|
@ -42,7 +42,7 @@ public:
|
||||
// constructor
|
||||
State(void);
|
||||
// destructor
|
||||
~State(void);
|
||||
virtual ~State(void) = default;
|
||||
// IO type
|
||||
IoType getType(void) const;
|
||||
};
|
||||
@ -61,6 +61,7 @@ private:
|
||||
} rlxd_dble_vec_t __attribute__ ((aligned (16)));
|
||||
public:
|
||||
RanLxd(void);
|
||||
~RanLxd(void) = default;
|
||||
void ranlxd(double r[],int n);
|
||||
void rlxd_init(int level,int seed);
|
||||
int rlxd_size(void) const;
|
||||
@ -86,7 +87,7 @@ public:
|
||||
RandGen(const int seed);
|
||||
RandGen(const State &state);
|
||||
// destructor
|
||||
virtual ~RandGen(void);
|
||||
virtual ~RandGen(void) = default;
|
||||
// state management
|
||||
State getState(void) const;
|
||||
void setState(const State &state);
|
||||
|
@ -38,10 +38,6 @@ DMatSample::DMatSample(const unsigned int nSample, const unsigned int nRow,
|
||||
resizeMat(nRow, nCol);
|
||||
}
|
||||
|
||||
// destructor //////////////////////////////////////////////////////////////////
|
||||
DMatSample::~DMatSample(void)
|
||||
{}
|
||||
|
||||
// resize all matrices /////////////////////////////////////////////////////////
|
||||
void DMatSample::resizeMat(const unsigned int nRow, const unsigned int nCol)
|
||||
{
|
||||
|
@ -43,7 +43,7 @@ public:
|
||||
// constructors
|
||||
using Base::Base;
|
||||
// destructor
|
||||
virtual ~Sample(void);
|
||||
virtual ~Sample(void) = default;
|
||||
};
|
||||
|
||||
/******************************************************************************
|
||||
@ -58,21 +58,13 @@ public:
|
||||
const unsigned int nCol);
|
||||
using Sample<DMat>::Sample;
|
||||
// destructor
|
||||
virtual ~DMatSample(void);
|
||||
virtual ~DMatSample(void) = default;
|
||||
// resize all matrices
|
||||
void resizeMat(const unsigned int nRow, const unsigned int nCol);
|
||||
// IO type
|
||||
virtual IoType getType(void) const;
|
||||
};
|
||||
|
||||
/******************************************************************************
|
||||
* Sample class template implementation *
|
||||
******************************************************************************/
|
||||
// destructor //////////////////////////////////////////////////////////////////
|
||||
template <typename T>
|
||||
Sample<T>::~Sample(void)
|
||||
{}
|
||||
|
||||
END_NAMESPACE
|
||||
|
||||
#endif // Latan_Sample_hpp_
|
||||
|
@ -41,7 +41,7 @@ public:
|
||||
EIGEN_EXPR_CTOR(StatArray, unique_arg(StatArray<T, offset>), Base,
|
||||
ArrayBase)
|
||||
// destructor
|
||||
virtual ~StatArray(void);
|
||||
virtual ~StatArray(void) = default;
|
||||
// access
|
||||
unsigned int size(void) const;
|
||||
// operators
|
||||
@ -80,11 +80,6 @@ StatArray<T, offset>::StatArray(const unsigned int size)
|
||||
: Base(static_cast<typename Base::Index>(size + offset))
|
||||
{}
|
||||
|
||||
// destructor //////////////////////////////////////////////////////////////////
|
||||
template <typename T, unsigned int offset>
|
||||
StatArray<T, offset>::~StatArray(void)
|
||||
{}
|
||||
|
||||
// access //////////////////////////////////////////////////////////////////////
|
||||
template <typename T, unsigned int offset>
|
||||
unsigned int StatArray<T, offset>::size(void) const
|
||||
|
Loading…
Reference in New Issue
Block a user