00001 //# ArrayMathBase.h: Basic functions and classes for math on Array objects 00002 //# Copyright (C) 2012 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: ArrayMathBase.h 21262 2012-09-07 12:38:36Z gervandiepen $ 00027 00028 #ifndef CASA_ARRAYMATHBASE_H 00029 #define CASA_ARRAYMATHBASE_H 00030 00031 #include <casacore/casa/aips.h> 00032 00033 namespace casacore { 00034 00035 //# Forward declarations. 00036 template<typename T> class Array; 00037 00038 00039 // <summary> 00040 // Basic class for math on Array objects 00041 // </summary> 00042 // 00043 // <reviewed reviewer="UNKNOWN" date="" tests="tArrayMath"> 00044 // 00045 // <prerequisite> 00046 // <li> <linkto class=Array>Array</linkto> 00047 // </prerequisite> 00048 // 00049 // <synopsis> 00050 // The abstract base class ArrayFunctorBase is defined for functors to 00051 // be used in functions like slidingXXX. 00052 // Virtual functions instead of templated functions are used to avoid 00053 // code bloat when used in functions like partialArrayMath. Because a 00054 // reduction operation usually takes much more time than the call, using 00055 // virtual functions hardly imposes a performance penalty. 00056 // </synopsis> 00057 template<typename T, typename RES=T> class ArrayFunctorBase { 00058 public: 00059 virtual ~ArrayFunctorBase() {} 00060 virtual RES operator() (const Array<T>&) const = 0; 00061 }; 00062 00063 // </group> 00064 00065 } //# end namespace 00066 00067 #endif