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