////////////////////////////////////////////////////////////////
//this class provides an alernative to functions which can be viewed as classes
//                          S.Plaszczynski 29/11/02
//////////////////////////////////////////////////////////////////////


#ifndef CLASSFUNC_H
#define CLASSFUNC_H

namespace SOPHYA {

//! Abstract interface definition for functions (double f(double)) viewed as classes
class ClassFunc {
public:
  virtual ~ClassFunc(void) { }
  virtual double operator()(double x) =0;
};

//ClassFunc constructed from a a function:simple forward to function
class Function : public ClassFunc {
 private:
  double (*f)(double);
 public:
  Function(double (*g)(double)):f(g){}
  virtual  double operator()(double x) { return f(x);}
};

}

#endif
