File: scalarcolumniterator.h

package info (click to toggle)
aoflagger 2.13.0-1
  • links: PTS, VCS
  • area: main
  • in suites: buster
  • size: 4,232 kB
  • sloc: cpp: 61,805; python: 60; sh: 23; makefile: 8
file content (49 lines) | stat: -rw-r--r-- 1,219 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
#ifndef SCALARCOLUMNITERATOR_H
#define SCALARCOLUMNITERATOR_H

#include <casacore/ms/MeasurementSets/MSColumns.h>
#include <casacore/tables/Tables/ScalarColumn.h>

template<typename T>
class ScalarColumnIterator {
	public:
		ScalarColumnIterator(class casacore::ScalarColumn<T> &column, unsigned row) :
			_column(&column), _row(row)
		{
		}
		ScalarColumnIterator(const ScalarColumnIterator<T> &source) :
			_column(source._column), _row(source._row)
		{ }
		~ScalarColumnIterator() { }
		ScalarColumnIterator &operator=(const ScalarColumnIterator<T> &source)
		{
			_column = source._column;
			_row = source._row;
			return *this;
		}
		ScalarColumnIterator<T> &operator++() {
			_row++;
			return *this;
		}
		T *operator->() const {
			return (*_column)(_row);
		}
		T operator*() const {
			return (*_column)(_row);
		}
		bool operator!=(const ScalarColumnIterator<T> &other) const {
			return _row!=other._row;
		}
		bool operator==(const ScalarColumnIterator<T> &other) const {
			return _row==other._row;
		}
		static ScalarColumnIterator First(casacore::ScalarColumn<T> &column)
		{
			return ScalarColumnIterator<T>(column, 0);
		}
	private:
		casacore::ScalarColumn<T> *_column;
		unsigned _row;
};

#endif