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$ 00028 00029 #ifndef SCIMATH_MARSHBUTTERWORTHBANDPASS_H 00030 #define SCIMATH_MARSHBUTTERWORTHBANDPASS_H 00031 00032 #include <casacore/casa/aips.h> 00033 #include <casacore/scimath/Functionals/SimButterworthBandpass.h> 00034 #include <casacore/scimath/Functionals/FunctionMarshallable.h> 00035 00036 namespace casacore { //# NAMESPACE CASACORE - 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 00064 // 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 public: 00091 static const String FUNCTYPE; 00092 static const String FUNCFIELDS[]; 00093 00094 // definitions of the fields stored in a serialized Record. The 00095 // actual string names are stored in FUNCFIELDS 00096 enum FieldNames { 00097 // the minimum cutoff, center, and maximum cutoff values 00098 BPASS, 00099 // the orders of the transitions between pass and no-pass 00100 ORDER, 00101 // the peak value 00102 PEAK, 00103 // the number of supported fields 00104 NFieldNames 00105 }; 00106 00107 //# Constructors 00108 // create a zero-th order (all-pass) Butterworth bandpass. 00109 MarshButterworthBandpass() : 00110 SimButterworthBandpass<T>(), FunctionMarshallable(FUNCTYPE) {} 00111 00112 // create a Butterworth bandpass function. 00113 MarshButterworthBandpass(uInt minord, uInt maxord, 00114 T mincut=T(-1), T maxcut=T(1), 00115 T center=T(0), T peak=T(1)) : 00116 SimButterworthBandpass<T>(minord, maxord, mincut, maxcut, 00117 center, peak), 00118 FunctionMarshallable(FUNCTYPE) 00119 {} 00120 00121 // create a fully specified Butterworth polynomial from parameters 00122 // stored in a Record. 00123 explicit MarshButterworthBandpass(const Record& gr) 00124 throw(InvalidSerializationError); 00125 00126 // create a deep copy of another Butterworth polynomial 00127 // <group> 00128 MarshButterworthBandpass(const SimButterworthBandpass<T> &other) : 00129 SimButterworthBandpass<T>(other), FunctionMarshallable(FUNCTYPE) {} 00130 MarshButterworthBandpass(const MarshButterworthBandpass<T> &other) : 00131 SimButterworthBandpass<T>(other), FunctionMarshallable(other) {} 00132 // </group> 00133 00134 // make a (deep) copy of another Butterworth polynomial 00135 // <group> 00136 MarshButterworthBandpass<T> &operator=( 00137 const MarshButterworthBandpass<T> &other) 00138 { 00139 FunctionMarshallable::operator=(other); 00140 SimButterworthBandpass<T>::operator=(other); 00141 return *this; 00142 } 00143 MarshButterworthBandpass<T> &operator=( 00144 const SimButterworthBandpass<T> &other) 00145 { 00146 SimButterworthBandpass<T>::operator=(other); 00147 return *this; 00148 } 00149 // </group> 00150 00151 // Destructor 00152 virtual ~MarshButterworthBandpass() {} 00153 00154 // store the state of this Function into a Record 00155 virtual void store(Record& gr) const; 00156 00157 // Create a copy of this object. The caller is responsible for 00158 // deleting the pointer. 00159 virtual Function<T> *clone() const { 00160 return new MarshButterworthBandpass<T>(*this); 00161 } 00162 }; 00163 00164 00165 } //# NAMESPACE CASACORE - END 00166 00167 #ifndef CASACORE_NO_AUTO_TEMPLATES 00168 #include <casacore/scimath/Functionals/MarshButterworthBandpass.tcc> 00169 #endif //# CASACORE_NO_AUTO_TEMPLATES 00170 #endif