casacore
Loading...
Searching...
No Matches
MarshallableChebyshev.h
Go to the documentation of this file.
1//# MarshalableChebyshev.h: a Marshallable Chebyshev polynomial
2//# Copyright (C) 2002
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//#! ========================================================================
27
28#ifndef SCIMATH_MARSHALLABLECHEBYSHEV_H
29#define SCIMATH_MARSHALLABLECHEBYSHEV_H
30
31#include <casacore/casa/aips.h>
32#include <casacore/scimath/Functionals/Chebyshev.h>
33#include <casacore/scimath/Functionals/FunctionMarshallable.h>
34
35namespace casacore { //# NAMESPACE CASACORE - BEGIN
36
37//# Forward Declarations
38
39// <summary> A Chebyshev function class that supports serialization
40// </summary>
41
42// <use visibility=export>
43
44// <reviewed reviewer="wbrouw" date="2001/11/12" tests="tChebyshev" demos="">
45// </reviewed>
46
47// <prerequisite>
48// <li> <linkto class=Function>Function</linkto>
49// </prerequisite>
50//
51// <etymology>
52// This class is named after Chebyshev Type I polynomials. "Marshallable"
53// means that the class can be serialized into a form that can be transmitted
54// to another execution context.
55// </etymology>
56//
57// <synopsis>
58// This class is a specialization of the Chebyshev class that supports
59// serialization. That is, it allows one to write the state of the Chebyshev
60// polynomial object into a Record. This record can then be transmitted
61// to another execution context where it
62// can be "reconstituted" as a new object with identical state as this one.
63// This documentation focusses on this serialization functionality (also known
64// as "marshalling"); for details about the general features of the Chebyshev
65// polynomial series, see the <linkto class="Chebyshev">Chebyshev</linkto>
66// class.
67// </synopsis>
68//
69// <example>
70// </example>
71//
72// <motivation>
73// Making Chebyshev Marshallable provides a convenient way of configuring
74// the simulator tool from .
75// </motivation>
76//
77// <thrown>
78// <li> Assertion in debug mode if attempt is made to address incorrect
79// coefficients
80// </thrown>
81//
82
83template<class T>
86{
87private:
88 static const String modenames[];
89
90public:
91 static const String FUNCTYPE;
92 static const String FUNCFIELDS[];
93
94 // definitions of the fields stored in a serialized Record. The
95 // actual string names are stored in FUNCFIELDS
97 // the array of coefficients
99 // the default mode
101 // the default value to use when mode=CONSTANT
103 // the 2-element double array
105 // the number of supported fields
107 };
108
109 //# Constructors
110 // create a zero-th order Chebyshev polynomial with the first coefficient
111 // equal to zero. The bounded domain is [T(-1), T(1)]. The
112 // OutOfDomainMode is CONSTANT, and the default value is T(0).
115
116 // create an n-th order Chebyshev polynomial with the coefficients
117 // equal to zero. The bounded domain is [T(-1), T(1)]. The
118 // OutOfDomainMode is CONSTANT, and the default value is T(0).
121
122 // create a zero-th order Chebyshev polynomical with the first coefficient
123 // equal to one.
124 // min is the minimum value of its Chebyshev interval, and
125 // max is the maximum value.
126 // mode sets the behavior of the function outside the Chebyshev interval
127 // (see setOutOfIntervalMode() and OutOfIntervalMode enumeration
128 // definition for details).
129 // defval is the value returned when the function is evaluated outside
130 // the Chebyshev interval and mode=CONSTANT.
131 MarshallableChebyshev(const T &min, const T &max,
132 const typename ChebyshevEnums::
133 OutOfIntervalMode mode=ChebyshevEnums::CONSTANT,
134 const T &defval=T(0)) :
135 Chebyshev<T>(min, max, mode, defval), FunctionMarshallable(FUNCTYPE)
136 {}
137
138 // create a fully specified Chebyshev polynomial.
139 // coeffs holds the coefficients of the Chebyshev polynomial (see
140 // setCoefficients() for details).
141 // min is the minimum value of its canonical range, and
142 // max is the maximum value.
143 // mode sets the behavior of the function outside the Chebyshev interval
144 // (see setOutOfIntervalMode() and OutOfIntervalMode enumeration
145 // definition for details).
146 // defval is the value returned when the function is evaluated outside
147 // the canonical range and mode=CONSTANT.
149 const T &min, const T &max,
150 const typename ChebyshevEnums::
151 OutOfIntervalMode mode=ChebyshevEnums::CONSTANT,
152 const T &defval=T(0)) :
153 Chebyshev<T>(coeffs, min, max, mode, defval),
155 {}
156
157 // create a fully specified Chebyshev polynomial from parameters
158 // stored in a Record.
159 explicit MarshallableChebyshev(const Record& gr)
161
162 // create a deep copy of another Chebyshev polynomial
163 // <group>
168 // </group>
169
170 // make a (deep) copy of another Chebyshev polynomial
171 // <group>
173 const MarshallableChebyshev<T> &other)
174 {
177 return *this;
178 }
180 const Chebyshev<T> &other)
181 {
183 return *this;
184 }
185 // </group>
186
187 // Destructor
189
190 // store the state of this Function into a Record
191 virtual void store(Record& gr) const;
192
193 // Create a copy of this object. The caller is responsible for
194 // deleting the pointer.
195 virtual Function<T> *clone() const {
196 return new MarshallableChebyshev<T>(*this);
197 }
198};
199
200
201} //# NAMESPACE CASACORE - END
202
203#ifndef CASACORE_NO_AUTO_TEMPLATES
204#include <casacore/scimath/Functionals/MarshallableChebyshev.tcc>
205#endif //# CASACORE_NO_AUTO_TEMPLATES
206#endif
Chebyshev< T > & operator=(const Chebyshev< T > &other)
make this instance a (deep) copy of another Chebyshev polynomial
Definition Chebyshev.h:297
virtual FunctionMarshallable & operator=(const FunctionMarshallable &other)
MarshallableChebyshev(const Record &gr)
create a fully specified Chebyshev polynomial from parameters stored in a Record.
MarshallableChebyshev(const uInt n)
create an n-th order Chebyshev polynomial with the coefficients equal to zero.
virtual Function< T > * clone() const
Create a copy of this object.
MarshallableChebyshev()
create a zero-th order Chebyshev polynomial with the first coefficient equal to zero.
MarshallableChebyshev(const MarshallableChebyshev< T > &other)
FieldNames
definitions of the fields stored in a serialized Record.
@ NFieldNames
the number of supported fields
@ COEFFS
the array of coefficients
@ INTERVAL
the 2-element double array
@ DEF
the default value to use when mode=CONSTANT
MarshallableChebyshev(const Chebyshev< T > &other)
create a deep copy of another Chebyshev polynomial
MarshallableChebyshev< T > & operator=(const MarshallableChebyshev< T > &other)
make a (deep) copy of another Chebyshev polynomial
MarshallableChebyshev< T > & operator=(const Chebyshev< T > &other)
MarshallableChebyshev(const Vector< T > &coeffs, const T &min, const T &max, const typename ChebyshevEnums::OutOfIntervalMode mode=ChebyshevEnums::CONSTANT, const T &defval=T(0))
create a fully specified Chebyshev polynomial.
virtual void store(Record &gr) const
store the state of this Function into a Record
MarshallableChebyshev(const T &min, const T &max, const typename ChebyshevEnums::OutOfIntervalMode mode=ChebyshevEnums::CONSTANT, const T &defval=T(0))
create a zero-th order Chebyshev polynomical with the first coefficient equal to one.
String: the storage and methods of handling collections of characters.
Definition String.h:223
this file contains all the compiler specific defines
Definition mainpage.dox:28
LatticeExprNode max(const LatticeExprNode &left, const LatticeExprNode &right)
unsigned int uInt
Definition aipstype.h:49
LatticeExprNode min(const LatticeExprNode &left, const LatticeExprNode &right)