casa  5.7.0-16
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
WrapperParam.h
Go to the documentation of this file.
1 //# WrapperParam.h: Parameter handling for wrapped function objects
2 //# Copyright (C) 2001,2002,2005
3 //# Associated Universities, Inc. Washington DC, USA.
4 //#
5 //# This library is free software; you can redistribute it and/or modify it
6 //# under the terms of the GNU Library General Public License as published by
7 //# the Free Software Foundation; either version 2 of the License, or (at your
8 //# option) any later version.
9 //#
10 //# This library is distributed in the hope that it will be useful, but WITHOUT
11 //# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
12 //# FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public
13 //# License for more details.
14 //#
15 //# You should have received a copy of the GNU Library General Public License
16 //# along with this library; if not, write to the Free Software Foundation,
17 //# Inc., 675 Massachusetts Ave, Cambridge, MA 02139, USA.
18 //#
19 //# Correspondence concerning AIPS++ should be addressed as follows:
20 //# Internet email: aips2-request@nrao.edu.
21 //# Postal address: AIPS++ Project Office
22 //# National Radio Astronomy Observatory
23 //# 520 Edgemont Road
24 //# Charlottesville, VA 22903-2475 USA
25 //#
26 //# $Id$
27 
28 #ifndef SCIMATH_WRAPPERPARAM_H
29 #define SCIMATH_WRAPPERPARAM_H
30 
31 //# Includes
32 #include <casacore/casa/aips.h>
36 
37 namespace casacore { //# NAMESPACE CASACORE - BEGIN
38 
39 //# Forward declarations
40 
41 // <summary> Parameter handling for wrapped function objects
42 // </summary>
43 //
44 // <use visibility=local>
45 //
46 // <reviewed reviewer="UNKNOWN" date="before2004/08/25" tests="" demos="">
47 // </reviewed>
48 //
49 // <prerequisite>
50 // <li> <linkto class="Function">Function</linkto> class
51 // <li> <linkto class="FunctionWrapper">FunctionWrapper</linkto>
52 // </prerequisite>
53 //
54 // <synopsis>
55 // This class is provided to enable easy specialization for the actual
56 // <src>FunctionWrapper</src> class.
57 // </synopsis>
58 
59 // <example>
60 // <srcblock>
61 // Float func(const Vector<Float>& x) {return x(0)*x(1);} // x*y
62 // // Convert C++ functions to Function
63 // FunctionWrapper<Float> Func(func, 2);
64 // </srcblock>
65 
66 // <templating arg=T>
67 // <li> T should have standard numerical operators and exp() function. Current
68 // implementation only tested for real types (and their AutoDiffs).
69 // </templating>
70 
71 // <thrown>
72 // <li> Assertion in debug mode if attempt is made to set a negative width
73 // <li> AipsError if incorrect parameter number specified.
74 // </thrown>
75 
76 // <todo asof="2001/08/19">
77 // <li> Nothing I know of
78 // </todo>
79 
80 
81 template <class T> class WrapperParam : public Function<T>
82 {
83 public:
84  //# Constructors
85  // Construct with the given parameters
86  // <group>
87  WrapperParam();
88  explicit WrapperParam(const T &par);
89  explicit WrapperParam(const Vector<T> &par);
90  // </group>
91 
92  // Copy constructor (deep copy)
93  // <group>
94  WrapperParam(const WrapperParam<T> &other);
95  // </group>
96  // Copy assignment (deep copy)
98 
99  // Destructor
100  virtual ~WrapperParam();
101 
102  //# Operators
103 
104  //# Member functions
105  // Give name of function
106  virtual const String &name() const { static String x("wrapper");
107  return x; }
108 
109 protected:
110  //# Make members of parent classes known.
111  using Function<T>::param_p;
112 };
113 
114 
115 } //# NAMESPACE CASACORE - END
116 
117 #ifndef CASACORE_NO_AUTO_TEMPLATES
118 #include <casacore/scimath/Functionals/WrapperParam.tcc>
119 #endif //# CASACORE_NO_AUTO_TEMPLATES
120 #endif
A 1-D Specialization of the Array class.
Parameter handling for wrapped function objects.
Definition: WrapperParam.h:81
virtual const String & name() const
Give name of function.
Definition: WrapperParam.h:106
WrapperParam()
Construct with the given parameters.
Numerical functional interface class.
virtual ~WrapperParam()
Destructor.
WrapperParam< T > & operator=(const WrapperParam< T > &other)
Copy assignment (deep copy)
String: the storage and methods of handling collections of characters.
Definition: String.h:223
#define casacore
&lt;X11/Intrinsic.h&gt; #defines true, false, casacore::Bool, and String.
Definition: X11Intrinsic.h:42