Last change
on this file since 3750 was 3409, checked in by cmv, 18 years ago |
operator(double) de ClassFunc et GenericFunc n'est plus const , cmv 25/11/2007
|
File size:
774 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 |
|
---|
10 | namespace SOPHYA {
|
---|
11 |
|
---|
12 | //! Abstract interface definition for functions (double f(double)) viewed as classes
|
---|
13 | class ClassFunc {
|
---|
14 | public:
|
---|
15 | virtual ~ClassFunc(void) { }
|
---|
16 | virtual double operator()(double x) =0;
|
---|
17 | };
|
---|
18 |
|
---|
19 | //ClassFunc constructed from a a function:simple forward to function
|
---|
20 | class Function : public ClassFunc {
|
---|
21 | private:
|
---|
22 | double (*f)(double);
|
---|
23 | public:
|
---|
24 | Function(double (*g)(double)):f(g){}
|
---|
25 | virtual double operator()(double x) { return f(x);}
|
---|
26 | };
|
---|
27 |
|
---|
28 | }
|
---|
29 |
|
---|
30 | #endif
|
---|
Note:
See
TracBrowser
for help on using the repository browser.