#ifndef _utl_FunctionEvaluator_h_ #define _utl_FunctionEvaluator_h_ #include #include namespace utl { /** \class FunctionEvaluator FunctionEvaluator.h "utl/FunctionEvaluator.h" \brief Evaluate functions given in a string. \author Darko Veberic \date 27 Aug 2009 \version $Id$ \ingroup math */ class FunctionEvaluator { public: FunctionEvaluator(const std::string& function, const std::string& independentVariableName = "x"); const std::string& GetFunction() const { return fFunction; } const std::string& GetIndependentVariableName() const { return fIndependentVariableName; } double operator()(const double x); void SetFunction(const std::string& function) { fFunction = function; } void SetIndependentVariableName(const std::string& name) { fIndependentVariableName = name; } private: std::string fFunction; std::string fIndependentVariableName; HepTool::Evaluator fEvaluator; }; } #endif