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
32namespace casacore {
33
34// Utility functions used for incrementing pointers in a data set used by the
35// stats framework.
36
37template <
38 class DataIterator, class MaskIterator=const Bool *,
39 class WeightsIterator=DataIterator
41public:
42
44
46
47 //<group>
48 // <src>loopCount</src> is always incremented by one, independent of the
49 // value of <src>dataStride</src> and <src>maskStride</src>
50
51 inline static void increment(
52 DataIterator& datum, uInt64& loopCount, uInt dataStride
53 ) {
54 std::advance(datum, dataStride);
55 ++loopCount;
56 }
57
58 inline static void increment(
59 DataIterator& datum, uInt64& loopCount,
60 WeightsIterator& weight, uInt dataStride
61 ) {
62 std::advance(datum, dataStride);
63 std::advance(weight, dataStride);
64 ++loopCount;
65 }
66
67 inline static void increment(
68 DataIterator& datum, uInt64& loopCount, MaskIterator& mask,
69 uInt dataStride, uInt maskStride
70 ) {
71 std::advance(datum, dataStride);
72 std::advance(mask, maskStride);
73 ++loopCount;
74 }
75
76 inline static void increment(
77 DataIterator& datum, uInt64& loopCount, WeightsIterator& weight,
78 MaskIterator& mask, uInt dataStride, uInt maskStride
79 ) {
80 std::advance(datum, dataStride);
81 std::advance(weight, dataStride);
82 std::advance(mask, maskStride);
83 ++loopCount;
84 }
85 // </group>
86
87};
88
89}
90
91#endif
Utility functions used for incrementing pointers in a data set used by the stats framework.
static void increment(DataIterator &datum, uInt64 &loopCount, WeightsIterator &weight, MaskIterator &mask, uInt dataStride, uInt maskStride)
static void increment(DataIterator &datum, uInt64 &loopCount, uInt dataStride)
loopCount is always incremented by one, independent of the value of dataStride and maskStride
static void increment(DataIterator &datum, uInt64 &loopCount, WeightsIterator &weight, uInt dataStride)
static void increment(DataIterator &datum, uInt64 &loopCount, MaskIterator &mask, uInt dataStride, uInt maskStride)
this file contains all the compiler specific defines
Definition: mainpage.dox:28
unsigned int uInt
Definition: aipstype.h:51
LatticeExprNode mask(const LatticeExprNode &expr)
This function returns the mask of the given expression.
bool Bool
Define the standard types used by Casacore.
Definition: aipstype.h:42
unsigned long long uInt64
Definition: aipsxtype.h:39