casa  $Rev:20696$
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines
WrapperParam.h
Go to the documentation of this file.
00001 //# WrapperParam.h: Parameter handling for wrapped function objects 
00002 //# Copyright (C) 2001,2002,2005
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 //# $Id: WrapperParam.h 21024 2011-03-01 11:46:18Z gervandiepen $
00027 
00028 #ifndef SCIMATH_WRAPPERPARAM_H
00029 #define SCIMATH_WRAPPERPARAM_H
00030 
00031 //# Includes
00032 #include <casa/aips.h>
00033 #include <scimath/Functionals/Function.h>
00034 #include <casa/Arrays/Vector.h>
00035 #include <casa/BasicSL/String.h>
00036 
00037 namespace casa { //# NAMESPACE CASA - BEGIN
00038 
00039 //# Forward declarations
00040 
00041 // <summary>  Parameter handling for wrapped function objects 
00042 // </summary>
00043 //
00044 // <use visibility=local>
00045 //
00046 // <reviewed reviewer="UNKNOWN" date="before2004/08/25" tests="" demos="">
00047 // </reviewed>
00048 //
00049 // <prerequisite>
00050 //   <li> <linkto class="Function">Function</linkto> class
00051 //   <li> <linkto class="FunctionWrapper">FunctionWrapper</linkto>
00052 // </prerequisite>
00053 //
00054 // <synopsis>
00055 // This class is provided to enable easy specialization for the actual
00056 // <src>FunctionWrapper</src> class.
00057 // </synopsis>
00058 
00059 // <example>
00060 // <srcblock>
00061 // Float func(const Vector<Float>& x) {return x(0)*x(1);}        // x*y
00062 // // Convert C++ functions to Function
00063 // FunctionWrapper<Float> Func(func, 2);
00064 // </srcblock>
00065 
00066 // <templating arg=T>
00067 //  <li> T should have standard numerical operators and exp() function. Current
00068 //      implementation only tested for real types (and their AutoDiffs).
00069 // </templating>
00070 
00071 // <thrown>
00072 //    <li> Assertion in debug mode if attempt is made to set a negative width
00073 //    <li> AipsError if incorrect parameter number specified.
00074 // </thrown>
00075 
00076 // <todo asof="2001/08/19">
00077 //   <li> Nothing I know of
00078 // </todo>
00079 
00080 
00081 template <class T> class WrapperParam : public Function<T>
00082 {
00083 public:
00084   //# Constructors
00085   // Construct with the given parameters
00086   // <group>
00087   WrapperParam();
00088   explicit WrapperParam(const T &par);
00089   explicit WrapperParam(const Vector<T> &par);
00090   // </group>
00091 
00092   // Copy constructor (deep copy)
00093   // <group>
00094   WrapperParam(const WrapperParam<T> &other);
00095   // </group>
00096   // Copy assignment (deep copy)
00097   WrapperParam<T> &operator=(const WrapperParam<T> &other);
00098 
00099   // Destructor
00100   virtual ~WrapperParam();
00101 
00102   //# Operators    
00103 
00104   //# Member functions
00105   // Give name of function
00106   virtual const String &name() const { static String x("wrapper");
00107     return x; }
00108 
00109 protected:
00110   //# Make members of parent classes known.
00111   using Function<T>::param_p;
00112 };
00113 
00114 
00115 } //# NAMESPACE CASA - END
00116 
00117 #ifndef CASACORE_NO_AUTO_TEMPLATES
00118 #include <scimath/Functionals/WrapperParam.tcc>
00119 #endif //# CASACORE_NO_AUTO_TEMPLATES
00120 #endif