casa
$Rev:20696$
|
00001 //# MarshButterworthBandpass.h: a Marshallable SimButterworthBandpass 00002 //# Copyright (C) 2002 00003 //# Associated Universities, Inc. Washington DC, USA. 00004 //# 00005 //# This library is free software; you can redistribute it and/or modify it 00006 //# under the terms of the GNU Library General Public License as published by 00007 //# the Free Software Foundation; either version 2 of the License, or (at your 00008 //# option) any later version. 00009 //# 00010 //# This library is distributed in the hope that it will be useful, but WITHOUT 00011 //# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 00012 //# FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public 00013 //# License for more details. 00014 //# 00015 //# You should have received a copy of the GNU Library General Public License 00016 //# along with this library; if not, write to the Free Software Foundation, 00017 //# Inc., 675 Massachusetts Ave, Cambridge, MA 02139, USA. 00018 //# 00019 //# Correspondence concerning AIPS++ should be addressed as follows: 00020 //# Internet email: aips2-request@nrao.edu. 00021 //# Postal address: AIPS++ Project Office 00022 //# National Radio Astronomy Observatory 00023 //# 520 Edgemont Road 00024 //# Charlottesville, VA 22903-2475 USA 00025 //# 00026 //#! ======================================================================== 00027 //# $Id: MarshButterworthBandpass.h 21024 2011-03-01 11:46:18Z gervandiepen $ 00028 00029 #ifndef SCIMATH_MARSHBUTTERWORTHBANDPASS_H 00030 #define SCIMATH_MARSHBUTTERWORTHBANDPASS_H 00031 00032 #include <casa/aips.h> 00033 #include <scimath/Functionals/SimButterworthBandpass.h> 00034 #include <scimath/Functionals/FunctionMarshallable.h> 00035 00036 namespace casa { //# NAMESPACE CASA - BEGIN 00037 00038 //# Forward Declarations 00039 00040 // <summary> A Butterworth function class that supports serialization 00041 // </summary> 00042 00043 // <use visibility=export> 00044 00045 // <reviewed reviewer="" date="" tests="" demos=""> 00046 // </reviewed> 00047 00048 // <prerequisite> 00049 // <li> <linkto class=Function>Function</linkto> 00050 // </prerequisite> 00051 // 00052 // <etymology> 00053 // "Marsh" is short for "Marshallable" which means that the class can 00054 // be serialized into a form that can be transmitted to another 00055 // execution context. "ButterBandpass" refers to its parent class: 00056 // SimButterworthBandpass. 00057 // </etymology> 00058 // 00059 // <synopsis> 00060 // This class is a specialization of SimButterworthBandpass class that 00061 // supports serialization. That is, it allows one to write the state of the 00062 // SimButterworthBandpass function object into a Record. This record 00063 // can then be transmitted to another execution context (e.g. or 00064 // another AIPS++ DO) where it can be "reconstituted" as a new object with 00065 // identical state as this one. This documentation focusses on this 00066 // serialization functionality (also known as "marshalling"); for details 00067 // about the general features of this Butterworth function, see the 00068 // <linkto class="SimButterworthBandpass">SimButterworthBandpass</linkto> 00069 // class. 00070 // </synopsis> 00071 // 00072 // <example> 00073 // </example> 00074 // 00075 // <motivation> 00076 // Making SimButterworthBandpass Marshallable provides a convenient way of 00077 // configuring the simulator tool from . 00078 // </motivation> 00079 // 00080 // <thrown> 00081 // <li> Assertion in debug mode if attempt is made to address incorrect 00082 // coefficients 00083 // </thrown> 00084 // 00085 00086 template<class T> 00087 class MarshButterworthBandpass : public SimButterworthBandpass<T>, 00088 public FunctionMarshallable 00089 { 00090 private: 00091 static const String modenames[]; 00092 00093 public: 00094 static const String FUNCTYPE; 00095 static const String FUNCFIELDS[]; 00096 00097 // definitions of the fields stored in a serialized Record. The 00098 // actual string names are stored in FUNCFIELDS 00099 enum FieldNames { 00100 // the minimum cutoff, center, and maximum cutoff values 00101 BPASS, 00102 // the orders of the transitions between pass and no-pass 00103 ORDER, 00104 // the peak value 00105 PEAK, 00106 // the number of supported fields 00107 NFieldNames 00108 }; 00109 00110 //# Constructors 00111 // create a zero-th order (all-pass) Butterworth bandpass. 00112 MarshButterworthBandpass() : 00113 SimButterworthBandpass<T>(), FunctionMarshallable(FUNCTYPE) {} 00114 00115 // create a Butterworth bandpass function. 00116 MarshButterworthBandpass(uInt minord, uInt maxord, 00117 T mincut=T(-1), T maxcut=T(1), 00118 T center=T(0), T peak=T(1)) : 00119 SimButterworthBandpass<T>(minord, maxord, mincut, maxcut, 00120 center, peak), 00121 FunctionMarshallable(FUNCTYPE) 00122 {} 00123 00124 // create a fully specified Butterworth polynomial from parameters 00125 // stored in a Record. 00126 explicit MarshButterworthBandpass(const Record& gr) 00127 throw(InvalidSerializationError); 00128 00129 // create a deep copy of another Butterworth polynomial 00130 // <group> 00131 MarshButterworthBandpass(const SimButterworthBandpass<T> &other) : 00132 SimButterworthBandpass<T>(other), FunctionMarshallable(FUNCTYPE) {} 00133 MarshButterworthBandpass(const MarshButterworthBandpass<T> &other) : 00134 SimButterworthBandpass<T>(other), FunctionMarshallable(other) {} 00135 // </group> 00136 00137 // make a (deep) copy of another Butterworth polynomial 00138 // <group> 00139 MarshButterworthBandpass<T> &operator=( 00140 const MarshButterworthBandpass<T> &other) 00141 { 00142 FunctionMarshallable::operator=(other); 00143 SimButterworthBandpass<T>::operator=(other); 00144 return *this; 00145 } 00146 MarshButterworthBandpass<T> &operator=( 00147 const SimButterworthBandpass<T> &other) 00148 { 00149 SimButterworthBandpass<T>::operator=(other); 00150 return *this; 00151 } 00152 // </group> 00153 00154 // Destructor 00155 virtual ~MarshButterworthBandpass() {} 00156 00157 // store the state of this Function into a Record 00158 virtual void store(Record& gr) const; 00159 00160 // Create a copy of this object. The caller is responsible for 00161 // deleting the pointer. 00162 virtual Function<T> *clone() const { 00163 return new MarshButterworthBandpass<T>(*this); 00164 } 00165 }; 00166 00167 00168 } //# NAMESPACE CASA - END 00169 00170 #ifndef CASACORE_NO_AUTO_TEMPLATES 00171 #include <scimath/Functionals/MarshButterworthBandpass.tcc> 00172 #endif //# CASACORE_NO_AUTO_TEMPLATES 00173 #endif