casacore
Loading...
Searching...
No Matches
UnaryParam.h
Go to the documentation of this file.
1//# UnaryParam.h: Parameter handling for one dimensional unary function
2//# Copyright (C) 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_UNARYPARAM_H
27#define SCIMATH_UNARYPARAM_H
28
29//# Includes
30#include <casacore/casa/aips.h>
31#include <casacore/scimath/Functionals/Function.h>
32#include <casacore/casa/BasicSL/String.h>
33
34namespace casacore { //# NAMESPACE CASACORE - BEGIN
35
36//# Forward declarations
37
38// <summary> Parameter handling for one dimensional unary function
39// </summary>
40
41// <use visibility=local>
42
43// <reviewed reviewer="" date="" tests="tFunctionHolder"
44// demos="">
45// </reviewed>
46
47// <prerequisite>
48// <li> <linkto class="FunctionParam">FunctionParam</linkto> class
49// <li> <linkto class="Function">Function</linkto> class
50// </prerequisite>
51
52// <etymology>
53// A 1-dimensional unary hat.
54// </etymology>
55
56// <synopsis>
57// A <src>Unary</src> is described by a height, a center and a width
58// (halfwidth). The value is:
59// <srcblock>
60// height (|x-center| < width)
61// 0.5height (|x-center| == width)
62// 0 (|x-center| > width)
63// </srcblock>
64// The parameters are enumerated by HEIGHT, CENTER and WIDTH. They have
65// default values of (1, 0, 1).
66// </synopsis>
67//
68// <example>
69// <srcblock>
70// UnaryFunction<Double> sf(5.0, 25.0, 7);
71// sf(25); // = 5.0
72// </srcblock>
73// </example>
74
75// <templating arg=T>
76// <li> T should have standard numerical operators
77// </templating>
78
79// <thrown>
80// <li> AipsError if incorrect parameter number specified.
81// </thrown>
82
83template<class T> class UnaryParam : public Function<T>
84{
85public:
86 //# Enumerations
87 // Parameter numbers
88 enum { HEIGHT=0, CENTER, WIDTH };
89
90 //# Constructors
91 // Constructs the Unary, Defaults:
92 // height=1, center=0, width=1.
93 // <note role=warning> Could not use default arguments
94 // that worked both with gcc and IRIX </note>
95 // <group>
97 explicit UnaryParam(const T &height);
98 UnaryParam(const T &height, const T &center);
99 UnaryParam(const T &height, const T &center, const T &width);
100 // </group>
101
102 // Copy constructor (deep copy)
103 // <group>
105 template <class W>
106 UnaryParam(const UnaryParam<W> &other) :
107 Function<T>(other) {}
108 // </group>
109
110 // Copy assignment (deep copy)
112
113 // Destructor
114 virtual ~UnaryParam();
115
116 //# Operators
117 virtual uInt ndim() const { return 1; }
118
119 //# Member functions
120 // Give name of function
121 virtual const String &name() const { static String x("unary");
122 return x; }
123
124 //# Make members of parent classes known.
125protected:
126 using Function<T>::param_p;
127public:
128 using Function<T>::nparameters;
129};
130
131
132} //# NAMESPACE CASACORE - END
133
134#ifndef CASACORE_NO_AUTO_TEMPLATES
135#include <casacore/scimath/Functionals/UnaryParam.tcc>
136#endif //# CASACORE_NO_AUTO_TEMPLATES
137#endif
FunctionParam< T > param_p
The parameters and masks.
Definition Function.h:330
uInt nparameters() const
Returns the number of parameters.
Definition Function.h:228
String: the storage and methods of handling collections of characters.
Definition String.h:223
UnaryParam(const T &height, const T &center)
UnaryParam(const UnaryParam< W > &other)
Definition UnaryParam.h:106
UnaryParam< T > & operator=(const UnaryParam< T > &other)
Copy assignment (deep copy)
UnaryParam(const T &height)
virtual uInt ndim() const
Returns the number of dimensions of function.
Definition UnaryParam.h:117
virtual const String & name() const
Give name of function.
Definition UnaryParam.h:121
UnaryParam(const UnaryParam< T > &other)
Copy constructor (deep copy)
virtual ~UnaryParam()
Destructor.
UnaryParam()
Constructs the Unary, Defaults: height=1, center=0, width=1.
UnaryParam(const T &height, const T &center, const T &width)
this file contains all the compiler specific defines
Definition mainpage.dox:28
unsigned int uInt
Definition aipstype.h:49