File indexing completed on 2026-06-02 08:48:21
0001 #ifndef FUNCTOR_1D
0002 #define FUNCTOR_1D
0003
0004
0005
0006
0007
0008
0009
0010
0011 #include <vector>
0012
0013 #include "FunctionType1D.h"
0014
0015 namespace NumA {
0016
0017
0018
0019
0020
0021
0022
0023
0024
0025
0026 template<typename PointerToObj, typename PointerToFunc>
0027 class Functor1D: public FunctionType1D {
0028 public:
0029
0030
0031
0032
0033
0034 Functor1D(PointerToObj* object, PointerToFunc function) :
0035 m_pObject(object), m_pFunction(function) {
0036 }
0037
0038
0039
0040
0041 virtual ~Functor1D() {
0042 }
0043
0044 inline double operator()(double x, std::vector<double> ¶meters) {
0045 return ((*m_pObject).*m_pFunction)(x, parameters);
0046 }
0047 inline double operator()(double x) {
0048 std::vector<double> parameters;
0049 return ((*m_pObject).*m_pFunction)(x, parameters);
0050 }
0051
0052 private:
0053 PointerToObj* m_pObject;
0054 PointerToFunc m_pFunction;
0055
0056 Functor1D(const Functor1D&);
0057 Functor1D& operator=(const Functor1D&);
0058 };
0059
0060 }
0061
0062 #endif