casacore
Loading...
Searching...
No Matches
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: casa-feedback@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#ifndef SCIMATH_WRAPPERPARAM_H
27#define SCIMATH_WRAPPERPARAM_H
28
29// # Includes
30#include <casacore/casa/aips.h>
31#include <casacore/scimath/Functionals/Function.h>
32#include <casacore/casa/Arrays/Vector.h>
33#include <casacore/casa/BasicSL/String.h>
34
35namespace casacore { // # NAMESPACE CASACORE - BEGIN
36
37// # Forward declarations
38
39// <summary> Parameter handling for wrapped function objects
40// </summary>
41//
42// <use visibility=local>
43//
44// <reviewed reviewer="UNKNOWN" date="before2004/08/25" tests="" demos="">
45// </reviewed>
46//
47// <prerequisite>
48// <li> <linkto class="Function">Function</linkto> class
49// <li> <linkto class="FunctionWrapper">FunctionWrapper</linkto>
50// </prerequisite>
51//
52// <synopsis>
53// This class is provided to enable easy specialization for the actual
54// <src>FunctionWrapper</src> class.
55// </synopsis>
56
57// <example>
58// <srcblock>
59// Float func(const Vector<Float>& x) {return x(0)*x(1);} // x*y
60// // Convert C++ functions to Function
61// FunctionWrapper<Float> Func(func, 2);
62// </srcblock>
63
64// <templating arg=T>
65// <li> T should have standard numerical operators and exp() function. Current
66// implementation only tested for real types (and their AutoDiffs).
67// </templating>
68
69// <thrown>
70// <li> Assertion in debug mode if attempt is made to set a negative width
71// <li> AipsError if incorrect parameter number specified.
72// </thrown>
73
74// <todo asof="2001/08/19">
75// <li> Nothing I know of
76// </todo>
77
78template <class T>
79class WrapperParam : public Function<T> {
80 public:
81 // # Constructors
82 // Construct with the given parameters
83 // <group>
85 explicit WrapperParam(const T &par);
86 explicit WrapperParam(const Vector<T> &par);
87 // </group>
88
89 // Copy constructor (deep copy)
90 // <group>
92 // </group>
93 // Copy assignment (deep copy)
95
96 // Destructor
97 virtual ~WrapperParam();
98
99 // # Operators
100
101 // # Member functions
102 // Give name of function
103 virtual const String &name() const {
104 static String x("wrapper");
105 return x;
106 }
107
108 protected:
109 // # Make members of parent classes known.
110 using Function<T>::param_p;
111};
112
113} // namespace casacore
114
115#ifndef CASACORE_NO_AUTO_TEMPLATES
116#include <casacore/scimath/Functionals/WrapperParam.tcc>
117#endif // # CASACORE_NO_AUTO_TEMPLATES
118#endif
FunctionParam< T > param_p
The parameters and masks.
Definition Function.h:337
Function()
Constructors.
Definition Function.h:209
String: the storage and methods of handling collections of characters.
Definition String.h:355
virtual const String & name() const
Give name of function.
WrapperParam< T > & operator=(const WrapperParam< T > &other)
Copy assignment (deep copy).
WrapperParam(const T &par)
WrapperParam(const WrapperParam< T > &other)
Copy constructor (deep copy).
virtual ~WrapperParam()
Destructor.
WrapperParam(const Vector< T > &par)
WrapperParam()
Construct with the given parameters.
For temporary backward namespace compatibility, use casa as alias for casacore.
Definition mainpage.dox:28