00001 //# SpecificFunctionFactory.h: a class for creating a Function object from Records 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_SPECIFICFUNCTIONFACTORY_H 00030 #define SCIMATH_SPECIFICFUNCTIONFACTORY_H 00031 00032 #include <casacore/casa/aips.h> 00033 #include <casacore/scimath/Functionals/Function.h> 00034 #include <casacore/scimath/Functionals/AbstractFunctionFactory.h> 00035 00036 namespace casacore { //# NAMESPACE CASACORE - BEGIN 00037 00038 //# Forward Declarations 00039 class Record; 00040 00041 // <summary> 00042 // 00043 // 00044 // 00045 // 00046 // 00047 // </summary> 00048 00049 // <use visibility=export> 00050 00051 // <reviewed reviewer="" date="yyyy/mm/dd" tests="" demos=""> 00052 // </reviewed> 00053 00054 // <prerequisite> 00055 // <li> FunctionFactory 00056 // </prerequisite> 00057 // 00058 // <etymology> 00059 // This class is based on the Factory pattern, similar to the 00060 // ApplicationObjectFactory 00061 // </etymology> 00062 // 00063 // <synopsis> 00064 // 00065 // 00066 // 00067 // 00068 // </synopsis> 00069 // 00070 // <example> 00071 // 00072 // 00073 // 00074 // </example> 00075 // 00076 // <motivation> 00077 // 00078 // 00079 // 00080 // </motivation> 00081 // 00082 // <templating arg=T> 00083 // <li> F class must be a subclass of Function<T> 00084 // <li> F class must have a constructor for the form F(const Record&) 00085 // </templating> 00086 // 00087 // <thrown> 00088 // <li> 00089 // <li> 00090 // </thrown> 00091 // 00092 // <todo asof="yyyy/mm/dd"> 00093 // <li> 00094 // <li> 00095 // <li> 00096 // </todo> 00097 template<class T, class F> 00098 class SpecificFunctionFactory : public FunctionFactory<T> 00099 { 00100 public: 00101 SpecificFunctionFactory() {} 00102 SpecificFunctionFactory(const SpecificFunctionFactory<T,F>& factory) {} 00103 virtual ~SpecificFunctionFactory() {} 00104 virtual Function<T> *create(const Record& gr) const 00105 throw (FunctionFactoryError) 00106 { 00107 return new F(gr); 00108 } 00109 SpecificFunctionFactory<T,F>& 00110 operator=(const SpecificFunctionFactory<T,F>& factory) 00111 { 00112 return *this; 00113 } 00114 }; 00115 00116 00117 } //# NAMESPACE CASACORE - END 00118 00119 #endif 00120 00121