StatisticsIncrementer.h

Go to the documentation of this file.
00001 //# Copyright (C) 2000,2001
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 //# $Id: Array.h 21545 2015-01-22 19:36:35Z gervandiepen $
00026 
00027 #ifndef SCIMATH_STATISTICSINCREMENTER_H
00028 #define SCIMATH_STATISTICSINCREMENTER_H
00029 
00030 #include <casacore/casa/aips.h>
00031 
00032 namespace casacore {
00033 
00034 // Utility functions used for incrementing pointers in a data set used by the stats framework.
00035 
00036 template <class DataIterator, class MaskIterator=const Bool *, class WeightsIterator=DataIterator>
00037 class StatisticsIncrementer {
00038 public:
00039 
00040         ~StatisticsIncrementer() {}
00041 
00042         //<group>
00043         // NOTE versions with <src>unityStride</src> are deprecated, but left for
00044         // backward compatibility. Use versions without <src>unityStride</src> for
00045         // new code (and update existing code to use new versions).
00046         // <src> loopCount is always incremented by one, independent of the values
00047         // of <src>dataStride</src> and <src>maskStride</src>
00048         inline static void increment(
00049                 DataIterator& datum, Int64& loopCount, Bool unityStride, uInt dataStride
00050         );
00051 
00052         inline static void increment(
00053                 DataIterator& datum, Int64& loopCount, WeightsIterator& weight,
00054                 Bool unityStride, uInt dataStride
00055         );
00056 
00057         inline static void increment(
00058                 DataIterator& datum, Int64& loopCount, MaskIterator& mask,
00059                 Bool unityStride, uInt dataStride, uInt maskStride
00060         );
00061 
00062         inline static void increment(
00063                 DataIterator& datum, Int64& loopCount,
00064                 WeightsIterator& weight, MaskIterator& mask,
00065                 Bool unityStride, uInt dataStride, uInt maskStride
00066         );
00067 
00068     inline static void increment(
00069         DataIterator& datum, Int64& loopCount, uInt dataStride
00070     ) {
00071         std::advance(datum, dataStride);
00072         ++loopCount;
00073     }
00074 
00075     inline static void increment(
00076         DataIterator& datum, Int64& loopCount,
00077         WeightsIterator& weight, uInt dataStride
00078     ) {
00079         std::advance(datum, dataStride);
00080         std::advance(weight, dataStride);
00081         ++loopCount;
00082     }
00083 
00084     inline static void increment(
00085         DataIterator& datum, Int64& loopCount, MaskIterator& mask,
00086         uInt dataStride, uInt maskStride
00087     ) {
00088         std::advance(datum, dataStride);
00089         std::advance(mask, maskStride);
00090         ++loopCount;
00091     }
00092 
00093     inline static void increment(
00094         DataIterator& datum, Int64& loopCount,
00095         WeightsIterator& weight, MaskIterator& mask,
00096         uInt dataStride, uInt maskStride
00097     ) {
00098         std::advance(datum, dataStride);
00099         std::advance(weight, dataStride);
00100         std::advance(mask, maskStride);
00101         ++loopCount;
00102     }
00103         // </group>
00104 
00105 private:
00106         // Just static methods, disallow constructor
00107         StatisticsIncrementer() {}
00108 
00109 };
00110 
00111 }
00112 
00113 #ifndef CASACORE_NO_AUTO_TEMPLATES
00114 #include <casacore/scimath/Mathematics/StatisticsIncrementer.tcc>
00115 #endif
00116 
00117 #endif
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines

Generated on 31 Aug 2016 for casa by  doxygen 1.6.1