casacore
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
LatticeStatsDataProviderBase.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 LATTICES_LATTICESTATSDATAPROVIDERBASE_H
28 #define LATTICES_LATTICESTATSDATAPROVIDERBASE_H
29 
31 
35 
36 #include <casacore/casa/aips.h>
37 
38 namespace casacore {
39 
40 class LatticeProgress;
41 
42 // Abstract base class of data providers which allows stats framework to iterate through a lattice.
43 
44 template <class T> class LatticeStatsDataProviderBase
45  : public StatsDataProvider<typename NumericTraits<T>::PrecisionType, const T*, const Bool*> {
46 
47 public:
48 
50 
51  // estimated number of steps to iterate through the the lattice
52  virtual uInt estimatedSteps() const = 0;
53 
54  virtual void finalize();
55 
56  // Get the stride for the current mask (only called if hasMask() returns True).
58 
59  // Get the associated range(s) of the current dataset. Only called if hasRanges() returns True;
60  std::vector<std::pair<typename NumericTraits<T>::PrecisionType, typename NumericTraits<T>::PrecisionType> > getRanges();
61 
62  // Get the stride for the current data set.
63  uInt getStride();
64 
65  // Returns NULL; lattices do not have associated weights.
66  const T* getWeights();
67 
68  // Does the current data set have associated range(s)?
69  Bool hasRanges() const;
70 
71  // returns False; lattices do not have associated weights.
72  Bool hasWeights() const;
73 
74  // If the associated data set has ranges, are these include (return True) or
75  // exclude (return False) ranges?
76  Bool isInclude() const;
77 
78  // get the positions of the min and max
79  void minMaxPos(IPosition& minpos, IPosition& maxpos) const;
80 
81  virtual void reset();
82 
84 
85  // set the data ranges
86  void setRanges(
87  const std::vector<std::pair<typename NumericTraits<T>::PrecisionType, typename NumericTraits<T>::PrecisionType> >& ranges,
88  Bool isInclude
89  );
90 
91 protected:
93 
94  void _updateMaxPos(const IPosition& maxPos) { _maxPos = maxPos; }
95 
96  void _updateMinPos(const IPosition& minPos) { _minPos = minPos; }
97 
98  void _updateProgress();
99 
100 private:
102  std::vector<std::pair<typename NumericTraits<T>::PrecisionType, typename NumericTraits<T>::PrecisionType> > _ranges;
105 };
106 
107 }
108 
109 #ifndef CASACORE_NO_AUTO_TEMPLATES
110 #include <casacore/lattices/LatticeMath/LatticeStatsDataProviderBase.tcc>
111 #endif //# CASACORE_NO_AUTO_TEMPLATES
112 
113 #endif
A Vector of integers, for indexing into Array&lt;T&gt; objects.
Definition: IPosition.h:118
const T * getWeights()
Returns NULL; lattices do not have associated weights.
void setProgressMeter(CountedPtr< LattStatsProgress > pm)
Bool hasWeights() const
returns False; lattices do not have associated weights.
Abstract base class which defines interface for providing &quot;datasets&quot; to the statistics framework in c...
void setRanges(const std::vector< std::pair< typename NumericTraits< T >::PrecisionType, typename NumericTraits< T >::PrecisionType > > &ranges, Bool isInclude)
set the data ranges
std::vector< std::pair< typename NumericTraits< T >::PrecisionType, typename NumericTraits< T >::PrecisionType > > getRanges()
Get the associated range(s) of the current dataset.
Bool isInclude() const
If the associated data set has ranges, are these include (return True) or exclude (return False) rang...
Bool hasRanges() const
Does the current data set have associated range(s)?
Char PrecisionType
Higher precision type (Float-&gt;Double)
Referenced counted pointer for constant data.
Definition: CountedPtr.h:80
Abstract base class of data providers which allows stats framework to iterate through a lattice...
virtual void finalize()
Take any actions necessary to finalize the provider.
uInt getMaskStride()
Get the stride for the current mask (only called if hasMask() returns True).
bool Bool
Define the standard types used by Casacore.
Definition: aipstype.h:42
std::vector< std::pair< typename NumericTraits< T >::PrecisionType, typename NumericTraits< T >::PrecisionType > > _ranges
virtual void reset()
reset the provider to point to the beginning of the first data set it manages.
void minMaxPos(IPosition &minpos, IPosition &maxpos) const
get the positions of the min and max
virtual uInt estimatedSteps() const =0
estimated number of steps to iterate through the the lattice
unsigned int uInt
Definition: aipstype.h:51
uInt getStride()
Get the stride for the current data set.