2014-02-06 18:52:13 +00:00
|
|
|
/*
|
|
|
|
* Function.hpp, part of LatAnalyze 3
|
|
|
|
*
|
|
|
|
* Copyright (C) 2013 - 2014 Antonin Portelli
|
|
|
|
*
|
|
|
|
* LatAnalyze 3 is free software: you can redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU General Public License as published by
|
|
|
|
* the Free Software Foundation, either version 3 of the License, or
|
|
|
|
* (at your option) any later version.
|
|
|
|
*
|
|
|
|
* LatAnalyze 3 is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
* along with LatAnalyze 3. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef Latan_Function_hpp_
|
|
|
|
#define Latan_Function_hpp_
|
2014-01-30 19:28:30 +00:00
|
|
|
|
|
|
|
#include <latan/Global.hpp>
|
|
|
|
#include <stack>
|
|
|
|
#include <vector>
|
|
|
|
#include <cstdarg>
|
|
|
|
|
2014-02-06 18:52:13 +00:00
|
|
|
BEGIN_NAMESPACE
|
2014-01-30 19:28:30 +00:00
|
|
|
|
|
|
|
/******************************************************************************
|
|
|
|
* Base function class *
|
|
|
|
******************************************************************************/
|
|
|
|
class Function
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
// constructor/destructor
|
|
|
|
explicit Function(const unsigned nArg);
|
2014-02-06 18:07:27 +00:00
|
|
|
virtual ~Function(void);
|
2014-01-30 19:28:30 +00:00
|
|
|
// access
|
2014-02-06 18:07:27 +00:00
|
|
|
unsigned int getNArg(void) const;
|
2014-01-30 19:28:30 +00:00
|
|
|
private:
|
|
|
|
const unsigned int nArg_;
|
|
|
|
};
|
|
|
|
|
|
|
|
/******************************************************************************
|
|
|
|
* Double function class *
|
|
|
|
******************************************************************************/
|
|
|
|
class DoubleFunction: public Function
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
// constructor/destructor
|
|
|
|
explicit DoubleFunction(const unsigned nArg);
|
|
|
|
virtual ~DoubleFunction(void);
|
|
|
|
// function call
|
|
|
|
virtual double operator()(std::vector<double> &arg) = 0;
|
|
|
|
double operator()(std::stack<double> &arg);
|
|
|
|
double operator()(const double x0, ...);
|
|
|
|
private:
|
|
|
|
std::vector<double> buffer_;
|
|
|
|
};
|
|
|
|
|
2014-02-06 18:52:13 +00:00
|
|
|
END_NAMESPACE
|
2014-01-30 19:28:30 +00:00
|
|
|
|
2014-02-06 18:52:13 +00:00
|
|
|
#endif // Latan_Function_hpp_
|