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
78
79template <class T> class WrapperParam : public Function<T>
80{
81public:
82 //# Constructors
83 // Construct with the given parameters
84 // <group>
86 explicit WrapperParam(const T &par);
87 explicit WrapperParam(const Vector<T> &par);
88 // </group>
89
90 // Copy constructor (deep copy)
91 // <group>
93 // </group>
94 // Copy assignment (deep copy)
96
97 // Destructor
98 virtual ~WrapperParam();
99
100 //# Operators
101
102 //# Member functions
103 // Give name of function
104 virtual const String &name() const { static String x("wrapper");
105 return x; }
106
107protected:
108 //# Make members of parent classes known.
109 using Function<T>::param_p;
110};
111
112
113} //# NAMESPACE CASACORE - END
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:330
String: the storage and methods of handling collections of characters.
Definition String.h:223
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.
this file contains all the compiler specific defines
Definition mainpage.dox:28