casacore
StatsDataProvider.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_STATSDATAPROVIDER_H
28 #define SCIMATH_STATSDATAPROVIDER_H
29 
30 #include <casacore/scimath/Mathematics/StatisticsTypes.h>
31 
32 #include <casacore/casa/aips.h>
33 
34 namespace casacore {
35 
36 // Abstract base class which defines interface for providing "datasets" to the statistics framework
37 // when nontrivial means of doing so are not sufficient.
38 
39 template <class AccumType, class DataIterator, class MaskIterator=const Bool *, class WeightsIterator=DataIterator>
41 public:
42 
43  virtual ~StatsDataProvider();
44 
45  // increment the data provider to the next dataset, mask, range set, and weights.
46  virtual void operator++() = 0;
47 
48  // Are there any data sets left to provide?
49  virtual Bool atEnd() const = 0;
50 
51  // Take any actions necessary to finalize the provider. This will be called when
52  // atEnd() returns True.
53  virtual void finalize() = 0;
54 
55  // get the count of elements in the current data set. When implementing this method, be
56  // certain to take stride into account; ie for a data set with nominally 100 elements that
57  // is to have a stride of two, this method should return 50.
58  virtual uInt64 getCount() = 0;
59 
60  // get the current dataset
61  virtual DataIterator getData() = 0;
62 
63  // Get the associated mask of the current dataset. Only called if hasMask() returns True;
64  virtual MaskIterator getMask() = 0;
65 
66  // Get the stride for the current mask (only called if hasMask() returns True).
67  virtual uInt getMaskStride() = 0;
68 
69  // Get the associated range(s) of the current dataset. Only called if hasRanges() returns True;
70  virtual DataRanges getRanges() = 0;
71 
72  // Get the stride for the current data set.
73  virtual uInt getStride() = 0;
74 
75  // Get the associated weights of the current dataset. Only called if hasWeights() returns True;
76  virtual WeightsIterator getWeights() = 0;
77 
78  // Does the current data set have an associated mask?
79  virtual Bool hasMask() const = 0;
80 
81  // Does the current data set have associated range(s)?
82  virtual Bool hasRanges() const = 0;
83 
84  // Does the current data set have associated weights?
85  virtual Bool hasWeights() const = 0;
86 
87  // If the associated data set has ranges, are these include (return True) or
88  // exclude (return False) ranges?
89  virtual Bool isInclude() const = 0;
90 
91  // reset the provider to point to the first data set it manages.
92  virtual void reset() = 0;
93 
94  // <group>
95  // In general, unless you are writing statistics algorithm code, you shouldn't need
96  // to call these methods.
97  // The statistics framework calls these methods when the min and max posiitons are
98  // updated. It passes in the relevant index of the current sub dataset it is processing.
99  // Data providers can use this information to transform into something more useful, eg
100  // an IPosition for lattice data providers, so that they may be retreived easily after
101  // statistics have been calculated. The default implementations do nothing.
102  virtual void updateMaxPos(const std::pair<Int64, Int64>&) {}
103 
104  virtual void updateMinPos(const std::pair<Int64, Int64>&) {}
105  // </group>
106 
107 protected:
108 
110 
111 };
112 
113 }
114 
115 #ifndef CASACORE_NO_AUTO_TEMPLATES
116 #include <casacore/scimath/Mathematics/StatsDataProvider.tcc>
117 #endif //# CASACORE_NO_AUTO_TEMPLATES
118 
119 #endif
virtual void reset()=0
reset the provider to point to the first data set it manages.
unsigned long long uInt64
Definition: aipsxtype.h:39
virtual DataRanges getRanges()=0
Get the associated range(s) of the current dataset.
virtual uInt64 getCount()=0
get the count of elements in the current data set.
virtual WeightsIterator getWeights()=0
Get the associated weights of the current dataset.
virtual void operator++()=0
increment the data provider to the next dataset, mask, range set, and weights.
Abstract base class which defines interface for providing "datasets" to the statistics framework when...
virtual Bool hasWeights() const =0
Does the current data set have associated weights?
virtual Bool hasMask() const =0
Does the current data set have an associated mask?
virtual Bool hasRanges() const =0
Does the current data set have associated range(s)?
virtual Bool isInclude() const =0
If the associated data set has ranges, are these include (return True) or exclude (return False) rang...
virtual void finalize()=0
Take any actions necessary to finalize the provider.
virtual uInt getStride()=0
Get the stride for the current data set.
virtual MaskIterator getMask()=0
Get the associated mask of the current dataset.
virtual uInt getMaskStride()=0
Get the stride for the current mask (only called if hasMask() returns True).
#define DataRanges
Commonly used types in statistics framework.
bool Bool
Define the standard types used by Casacore.
Definition: aipstype.h:42
virtual Bool atEnd() const =0
Are there any data sets left to provide?
virtual DataIterator getData()=0
get the current dataset
virtual void updateMaxPos(const std::pair< Int64, Int64 > &)
In general, unless you are writing statistics algorithm code, you shouldn&#39;t need to call these method...
virtual void updateMinPos(const std::pair< Int64, Int64 > &)
this file contains all the compiler specific defines
Definition: mainpage.dox:28
unsigned int uInt
Definition: aipstype.h:51