source: Sophya/trunk/SophyaLib/NTools/classfunc.h@ 3102

Last change on this file since 3102 was 3098, checked in by ansari, 19 years ago

correction bug lie au delete de ClassFunc ds Integrator / petite amelioration interface Integrator - Reza 02/11/2006

File size: 755 bytes
Line 
1////////////////////////////////////////////////////////////////
2//this class provides an alernative to functions which can be viewed as classes
3// S.Plaszczynski 29/11/02
4//////////////////////////////////////////////////////////////////////
5
6
7#ifndef CLASSFUNC_H
8#define CLASSFUNC_H
9
10namespace SOPHYA {
11
12//! Abstract interface definition for functions (double f(double)) viewed as classes
13class ClassFunc {
14public:
15 virtual double operator()(double x) const =0;
16};
17
18//ClassFunc constructed from a a function:simple forward to function
19class Function : public ClassFunc {
20 private:
21 double (*f)(double);
22 public:
23 Function(double (*g)(double)):f(g){}
24 virtual double operator()(double x) const { return f(x);}
25};
26
27}
28
29#endif
Note: See TracBrowser for help on using the repository browser.