Bayeux  3.4.1
Core Foundation library for SuperNEMO
function_with_domain.h
Go to the documentation of this file.
1 //
4 // Copyright (c) 2015 by François Mauger <mauger@lpccaen.in2p3.fr>
5 //
6 // This file is part of Bayeux.
7 //
8 // Bayeux is free software: you can redistribute it and/or modify
9 // it under the terms of the GNU General Public License as published by
10 // the Free Software Foundation, either version 3 of the License, or
11 // (at your option) any later version.
12 //
13 // Bayeux is distributed in the hope that it will be useful,
14 // but WITHOUT ANY WARRANTY; without even the implied warranty of
15 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 // GNU General Public License for more details.
17 //
18 // You should have received a copy of the GNU General Public License
19 // along with Bayeux. If not, see <http://www.gnu.org/licenses/>.
20 
21 #ifndef MYGSL_FUNCTION_WITH_DOMAIN_H
22 #define MYGSL_FUNCTION_WITH_DOMAIN_H
23 
24 // This project:
25 #include <mygsl/i_unary_function.h>
26 #include <mygsl/interval.h>
27 
28 namespace datatools {
29  // Forward class declaration:
30  class properties;
31 }
32 
33 namespace mygsl {
34 
37  {
38  public:
39 
41  bool has_functor() const;
42 
44  void set_functor(const i_unary_function & functor_);
45 
47  bool has_domain_of_definition() const;
48 
50  void set_domain_of_definition(const interval & domain_);
51 
53  const interval & get_domain_of_definition() const;
54 
57 
59  function_with_domain(const i_unary_function & functor_);
60 
62  function_with_domain(const i_unary_function & functor_, const interval & domain_);
63 
65  virtual ~function_with_domain();
66 
68  virtual bool has_explicit_domain_of_definition() const;
69 
71  virtual bool is_in_domain_of_definition(double x_) const;
72 
74  virtual bool is_initialized() const;
75 
77  virtual void initialize(const datatools::properties & config_,
78  const unary_function_dict_type & functors_);
79 
81  virtual void reset();
82 
83  protected:
84 
86  virtual double _eval(double x_) const;
87 
88  private:
89 
90  unary_function_handle _functor_;
91  interval _domain_of_definition_;
92 
95 
96  };
97 
98 } // end of namespace mygsl
99 
100 #endif // MYGSL_FUNCTION_WITH_DOMAIN_H
101 
102 /* Local Variables: */
103 /* mode: c++ */
104 /* coding: utf-8 */
105 /* End: */
virtual void initialize(const datatools::properties &config_, const unary_function_dict_type &functors_)
Initialization from a container of parameters and a dictionary of functors.
virtual ~function_with_domain()
Destructor.
void set_domain_of_definition(const interval &domain_)
Set the domain of definition.
virtual bool is_in_domain_of_definition(double x_) const
Check is a value is in the domain of definition.
virtual bool is_initialized() const
Check initialization status.
virtual bool has_explicit_domain_of_definition() const
Check the domain of definition.
virtual double _eval(double x_) const
Evaluation.
const interval & get_domain_of_definition() const
Return the domain of definition.
Function with interval/domain of definition.
Definition: function_with_domain.h:36
Abstract interface for unary functions : R -> R.
Definition: i_unary_function.h:44
Smart handle to an unary function object.
Definition: unary_function_utils.h:33
function_with_domain()
Default constructor.
bool has_functor() const
Check if the functor is defined.
Top-level namespace of the Bayeux/mygsl module library.
Definition: base_decay_driver.h:47
bool has_domain_of_definition() const
Check if the domain of definition is defined.
void set_functor(const i_unary_function &functor_)
Set the functor.
The Bayeux/datatools library top-level namespace.
Definition: algo.h:13
std::map< std::string, unary_function_handle_type > unary_function_dict_type
Alias for dictionary of handles to unary function objects.
Definition: unary_function_utils.h:30
#define MYGSL_UNARY_FUNCTOR_REGISTRATION_INTERFACE(UnaryFunctorClass)
Definition: i_unary_function.h:206
virtual void reset()
Reset the functor.
An interval with real bounds.
Definition: interval.h:42
A dictionary of arbitrary properties.
Definition: properties.h:125