lsst.afw  14.0-42-g99f9a3040+1
Functor.h
Go to the documentation of this file.
1 // -*- lsst-c++ -*-
2 
3 /*
4  * LSST Data Management System
5  * Copyright 2015 LSST Corporation.
6  *
7  * This product includes software developed by the
8  * LSST Project (http://www.lsst.org/).
9  *
10  * This program is free software: you can redistribute it and/or modify
11  * it under the terms of the GNU General Public License as published by
12  * the Free Software Foundation, either version 3 of the License, or
13  * (at your option) any later version.
14  *
15  * This program is distributed in the hope that it will be useful,
16  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18  * GNU General Public License for more details.
19  *
20  * You should have received a copy of the LSST License Statement and
21  * the GNU General Public License along with this program. If not,
22  * see <http://www.lsstcorp.org/LegalNotices/>.
23  */
24 
25 /*
26  * Functor classes used by SeparableXYTransform.
27  */
28 
29 #ifndef LSST_AFW_GEOM_FUNCTOR_H
30 #define LSST_AFW_GEOM_FUNCTOR_H
31 
32 #include <string>
33 #include <memory>
34 #include "lsst/base.h"
35 #include "lsst/daf/base.h"
36 
37 namespace lsst {
38 namespace afw {
39 namespace geom {
40 
50 class Functor : public daf::base::Citizen {
51 public:
56  explicit Functor(std::string const& name);
57 
58  Functor(Functor const &);
59  Functor(Functor &&);
60  Functor &operator=(Functor const &);
62 
63  virtual ~Functor() = default;
64 
65  virtual std::shared_ptr<Functor> clone() const = 0;
66 
68  virtual double operator()(double x) const = 0;
69 
81  virtual double inverse(double y, double tol = 1e-10, unsigned int maxiter = 1000) const;
82 
86  virtual double derivative(double x) const = 0;
87 
88 private:
89  std::string _name;
90 };
91 
95 class LinearFunctor : public Functor {
96 public:
97  LinearFunctor(double slope, double intercept);
98 
103 
104  ~LinearFunctor() = default;
105 
106  virtual std::shared_ptr<Functor> clone() const;
107 
108  virtual double operator()(double x) const;
109 
110  virtual double derivative(double x) const;
111 
112 private:
113  double _slope;
114  double _intercept;
115 };
116 
117 } // namespace geom
118 } // namespace af
119 } // namespace lsst
120 
121 #endif // LSST_AFW_GEOM_FUNCTOR_H
virtual double inverse(double y, double tol=1e-10, unsigned int maxiter=1000) const
virtual double operator()(double x) const =0
table::Key< std::string > name
Definition: ApCorrMap.cc:71
STL class.
Concrete implementation of Functor subclass for testing.
Definition: Functor.h:95
Functor & operator=(Functor const &)
A base class for image defects.
virtual double derivative(double x) const =0
virtual std::shared_ptr< Functor > clone() const =0
double x
Abstract base class for function objects.
Definition: Functor.h:50
Functor(std::string const &name)
virtual ~Functor()=default