casa  $Rev:20696$
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines
PoissonParam.h
Go to the documentation of this file.
00001 //# Copyright (C) 2002,2005
00002 //# Associated Universities, Inc. Washington DC, USA.
00003 //#
00004 //# This library is free software; you can redistribute it and/or modify it
00005 //# under the terms of the GNU Library General Public License as published by
00006 //# the Free Software Foundation; either version 2 of the License, or (at your
00007 //# option) any later version.
00008 //#
00009 //# This library is distributed in the hope that it will be useful, but WITHOUT
00010 //# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
00011 //# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Library General Public
00012 //# License for more details.
00013 //#
00014 //# You should have received a copy of the GNU Library General Public License
00015 //# along with this library; if not, write to the Free Software Foundation,
00016 //# Inc., 675 Massachusetts Ave, Cambridge, MA 02139, USA.
00017 //#
00018 //# Correspondence concerning AIPS++ should be addressed as follows:
00019 //#        Internet email: aips2-request@nrao.edu.
00020 //#        Postal address: AIPS++ Project Office
00021 //#                        National Radio Astronomy Observatory
00022 //#                        520 Edgemont Road
00023 //#                        Charlottesville, VA 22903-2475 USA
00024 //#
00025 
00026 #ifndef SCIMATH_POISSONPARAM_H
00027 #define SCIMATH_POISSONPARAM_H
00028 
00029 //# Includes
00030 #include <casa/aips.h>
00031 #include <scimath/Functionals/Function.h>
00032 #include <casa/BasicSL/String.h>
00033 
00034 namespace casa { //# NAMESPACE CASA - BEGIN
00035 
00036 //# Forward declarations
00037 
00038 // <summary> A one dimensional Poisson function
00039 // </summary>
00040 
00041 // <use visibility=local>
00042 
00043 // <reviewed reviewer="" date="" tests="tFunctionHolder" 
00044 // demos="">
00045 // </reviewed>
00046 
00047 // <prerequisite>
00048 //   <li> <linkto class="FunctionParam">FunctionParam</linkto> class
00049 //   <li> <linkto class="Function">Function</linkto> class
00050 // </prerequisite>
00051 
00052 // <etymology> 
00053 // A 1-dimensional Poisson.
00054 // </etymology>
00055 
00056 // <synopsis> 
00057 // A <src>Poisson</src> is described by lambda
00058 // The value is:
00059 // <srcblock>
00060 //      height          (|x-center| == 0.0)
00061 //      0               (|x-center| != 0.0)
00062 // </srcblock>
00063 // The parameters are enumerated by LAMDA. They have
00064 // default values of 1.
00065 // </synopsis> 
00066 //
00067 // <example>
00068 // <srcblock>
00069 //    PoissonFunction<Double> sf(5.0);
00070 //    sf(25);            // = 5.0
00071 // </srcblock>
00072 // </example>
00073 
00074 // <templating arg=T>
00075 //  <li> T should have standard numerical operators
00076 // </templating>
00077 
00078 // <thrown>
00079 //    <li> AipsError if incorrect parameter number specified.
00080 // </thrown>
00081 
00082 template<class T> class PoissonParam : public Function<T>
00083 {
00084 public:
00085   //# Enumerations
00086   // Parameter numbers
00087   enum { LAMBDA=0, HEIGHT};
00088   
00089   //# Constructors
00090   // Constructs the Poisson, Defaults:
00091   // lambda=1.
00092   // <note role=warning> Could not use default arguments
00093   // that worked both with gcc and IRIX </note>
00094   // <group>
00095   PoissonParam();
00096   explicit PoissonParam(const T &lambda);
00097   PoissonParam( const T &lambda, const T &height );
00098   // </group>
00099   
00100   // Copy constructor (deep copy)
00101   // <group>
00102   PoissonParam(const PoissonParam<T> &other);
00103   template <class W>
00104     PoissonParam(const PoissonParam<W> &other) :
00105     Function<T>(other) {}
00106   // </group>
00107   // Copy assignment (deep copy)
00108   PoissonParam<T> &operator=(const PoissonParam<T> &other);
00109     
00110   // Destructor
00111   virtual ~PoissonParam();
00112 
00113   //# Operators    
00114   virtual uInt ndim() const { return 1; }
00115 
00116   //# Member functions
00117   // Give name of function
00118   virtual const String &name() const {
00119           static String x("poisson");
00120           return x;
00121   }
00122 
00123   // Get or set lambda
00124 
00125    T lambda() const {
00126            return param_p[LAMBDA];
00127    }
00128    void setLambda(const T &lambda) {
00129            param_p[LAMBDA] = lambda;
00130    }
00131 
00132    T height() const {
00133            return param_p[HEIGHT];
00134       }
00135       void setHeight(const T &height) {
00136            param_p[HEIGHT] = height;
00137       }
00138   //# Make members of parent classes known.
00139 protected:
00140   using Function<T>::param_p;
00141 public:
00142   using Function<T>::nparameters;
00143 };
00144 
00145 
00146 
00147 
00148 
00149 } //# NAMESPACE CASA - END
00150 
00151 #ifndef CASACORE_NO_AUTO_TEMPLATES
00152 #include <scimath/Functionals/PoissonParam.tcc>
00153 #endif //# CASACORE_NO_AUTO_TEMPLATES
00154 #endif