casacore
StatisticsIncrementer.h
Go to the documentation of this file.
1 //# Copyright (C) 2000,2001
2 //# Associated Universities, Inc. Washington DC, USA.
3 //#
4 //# This library is free software; you can redistribute it and/or modify it
5 //# under the terms of the GNU Library General Public License as published by
6 //# the Free Software Foundation; either version 2 of the License, or (at your
7 //# option) any later version.
8 //#
9 //# This library is distributed in the hope that it will be useful, but WITHOUT
10 //# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 //# FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public
12 //# License for more details.
13 //#
14 //# You should have received a copy of the GNU Library General Public License
15 //# along with this library; if not, write to the Free Software Foundation,
16 //# Inc., 675 Massachusetts Ave, Cambridge, MA 02139, USA.
17 //#
18 //# Correspondence concerning AIPS++ should be addressed as follows:
19 //# Internet email: aips2-request@nrao.edu.
20 //# Postal address: AIPS++ Project Office
21 //# National Radio Astronomy Observatory
22 //# 520 Edgemont Road
23 //# Charlottesville, VA 22903-2475 USA
24 //#
25 //# $Id: Array.h 21545 2015-01-22 19:36:35Z gervandiepen $
26 
27 #ifndef SCIMATH_STATISTICSINCREMENTER_H
28 #define SCIMATH_STATISTICSINCREMENTER_H
29 
30 #include <casacore/casa/aips.h>
31 
32 namespace casacore {
33 
34 // Utility functions used for incrementing pointers in a data set used by the stats framework.
35 
36 template <class DataIterator, class MaskIterator=const Bool *, class WeightsIterator=DataIterator>
38 public:
39 
41 
42  //<group>
43  // NOTE versions with <src>unityStride</src> are deprecated, but left for
44  // backward compatibility. Use versions without <src>unityStride</src> for
45  // new code (and update existing code to use new versions).
46  // <src> loopCount is always incremented by one, independent of the values
47  // of <src>dataStride</src> and <src>maskStride</src>
48  inline static void increment(
49  DataIterator& datum, Int64& loopCount, Bool unityStride, uInt dataStride
50  );
51 
52  inline static void increment(
53  DataIterator& datum, Int64& loopCount, WeightsIterator& weight,
54  Bool unityStride, uInt dataStride
55  );
56 
57  inline static void increment(
58  DataIterator& datum, Int64& loopCount, MaskIterator& mask,
59  Bool unityStride, uInt dataStride, uInt maskStride
60  );
61 
62  inline static void increment(
63  DataIterator& datum, Int64& loopCount,
64  WeightsIterator& weight, MaskIterator& mask,
65  Bool unityStride, uInt dataStride, uInt maskStride
66  );
67 
68  inline static void increment(
69  DataIterator& datum, Int64& loopCount, uInt dataStride
70  ) {
71  std::advance(datum, dataStride);
72  ++loopCount;
73  }
74 
75  inline static void increment(
76  DataIterator& datum, Int64& loopCount,
77  WeightsIterator& weight, uInt dataStride
78  ) {
79  std::advance(datum, dataStride);
80  std::advance(weight, dataStride);
81  ++loopCount;
82  }
83 
84  inline static void increment(
85  DataIterator& datum, Int64& loopCount, MaskIterator& mask,
86  uInt dataStride, uInt maskStride
87  ) {
88  std::advance(datum, dataStride);
89  std::advance(mask, maskStride);
90  ++loopCount;
91  }
92 
93  inline static void increment(
94  DataIterator& datum, Int64& loopCount,
95  WeightsIterator& weight, MaskIterator& mask,
96  uInt dataStride, uInt maskStride
97  ) {
98  std::advance(datum, dataStride);
99  std::advance(weight, dataStride);
100  std::advance(mask, maskStride);
101  ++loopCount;
102  }
103  // </group>
104 
105 private:
106  // Just static methods, disallow constructor
108 
109 };
110 
111 }
112 
113 #ifndef CASACORE_NO_AUTO_TEMPLATES
114 #include <casacore/scimath/Mathematics/StatisticsIncrementer.tcc>
115 #endif
116 
117 #endif
long long Int64
Define the extra non-standard types used by Casacore (like proposed uSize, Size)
Definition: aipsxtype.h:38
static void increment(DataIterator &datum, Int64 &loopCount, Bool unityStride, uInt dataStride)
NOTE versions with unityStride are deprecated, but left for backward compatibility.
LatticeExprNode mask(const LatticeExprNode &expr)
This function returns the mask of the given expression.
static void increment(DataIterator &datum, Int64 &loopCount, WeightsIterator &weight, MaskIterator &mask, uInt dataStride, uInt maskStride)
StatisticsIncrementer()
Just static methods, disallow constructor.
Utility functions used for incrementing pointers in a data set used by the stats framework.
bool Bool
Define the standard types used by Casacore.
Definition: aipstype.h:42
static void increment(DataIterator &datum, Int64 &loopCount, WeightsIterator &weight, uInt dataStride)
static void increment(DataIterator &datum, Int64 &loopCount, uInt dataStride)
this file contains all the compiler specific defines
Definition: mainpage.dox:28
static void increment(DataIterator &datum, Int64 &loopCount, MaskIterator &mask, uInt dataStride, uInt maskStride)
unsigned int uInt
Definition: aipstype.h:51