Bayeux  3.4.1
Core Foundation library for SuperNEMO
plain_function_wrapper.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_PLAIN_FUNCTION_WRAPPER_H
22 #define MYGSL_PLAIN_FUNCTION_WRAPPER_H
23 
24 // This project:
25 #include <mygsl/i_unary_function.h>
26 #include <mygsl/math.h>
27 
28 namespace datatools {
29  // Forward class declaration:
30  class properties;
31 }
32 
33 namespace mygsl {
34 
37  {
38  public:
39 
41  void set_plain_function_by_name(const std::string &);
42 
45 
47  bool has_plain_function() const;
48 
51 
53  plain_function_wrapper(const std::string &);
54 
57 
59  virtual ~plain_function_wrapper();
60 
62  virtual bool is_initialized() const;
63 
65  virtual void initialize(const datatools::properties & config_,
66  const unary_function_dict_type & functors_);
67 
69  virtual void reset();
70 
71  protected:
72 
74  virtual double _eval(double x_) const;
75 
76  private:
77 
78  plain_function_type _plain_function_;
79 
82 
83  };
84 
85 } // end of namespace mygsl
86 
87 #endif // MYGSL_PLAIN_FUNCTION_WRAPPER_H
88 
89 /* Local Variables: */
90 /* mode: c++ */
91 /* coding: utf-8 */
92 /* End: */
A composite function from two unary functors.
virtual ~plain_function_wrapper()
Destructor.
virtual bool is_initialized() const
Check initialization status.
bool has_plain_function() const
Check is the plain function is defined.
void set_plain_function(plain_function_type)
Set the address of the plain function.
Abstract interface for unary functions : R -> R.
Definition: i_unary_function.h:44
virtual void initialize(const datatools::properties &config_, const unary_function_dict_type &functors_)
Initialization from a container of parameters and a dictionary of functors.
Top-level namespace of the Bayeux/mygsl module library.
Definition: base_decay_driver.h:47
The Bayeux/datatools library top-level namespace.
Definition: algo.h:13
virtual double _eval(double x_) const
Evaluation method.
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
void set_plain_function_by_name(const std::string &)
Set the plain function by name.
virtual void reset()
Reset the functor.
plain_function_wrapper()
Default constructor.
double(* plain_function_type)(double)
Typedef for a simple function C-style function :
Definition: math.h:32
Wrapper for C/C++ plain function with signature 'double (*)(double)'.
Definition: plain_function_wrapper.h:36
A dictionary of arbitrary properties.
Definition: properties.h:125