casacore
Loading...
Searching...
No Matches
RowNumbers.h
Go to the documentation of this file.
1// # RowNumbers.h: Vector of row numbers
2// # Copyright (C) 2019
3// # Associated Universities, Inc. Washington DC, USA.
4// #
5// # This library is free software; you can redistribute it and/or modify it
6// # under the terms of the GNU Library General Public License as published by
7// # the Free Software Foundation; either version 2 of the License, or (at your
8// # option) any later version.
9// #
10// # This library is distributed in the hope that it will be useful, but WITHOUT
11// # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
12// # FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public
13// # License for more details.
14// #
15// # You should have received a copy of the GNU Library General Public License
16// # along with this library; if not, write to the Free Software Foundation,
17// # Inc., 675 Massachusetts Ave, Cambridge, MA 02139, USA.
18// #
19// # Correspondence concerning AIPS++ should be addressed as follows:
20// # Internet email: casa-feedback@nrao.edu.
21// # Postal address: AIPS++ Project Office
22// # National Radio Astronomy Observatory
23// # 520 Edgemont Road
24// # Charlottesville, VA 22903-2475 USA
25
26#ifndef TABLES_ROWNUMBERS_H
27#define TABLES_ROWNUMBERS_H
28
29// # Includes
30#include <casacore/casa/aips.h>
31#include <casacore/casa/Arrays/Vector.h>
32
33namespace casacore { // #Begin namespace casacore
34
35class RowNumbers : public Vector<rownr_t> {
36 public:
37 // Construct an empty RowNumbers Vector.
39
40 // Construct with the given length.
41 explicit RowNumbers(size_t n) : Vector<rownr_t>(n) {}
42
43 // Construct from a Vector of row numbers.
44 RowNumbers(const Vector<rownr_t>& rows) : Vector<rownr_t>(rows) {}
45
46 // Construct from a std::vector of row numbers.
47 RowNumbers(const std::vector<rownr_t>& rows);
48
49 // Array<T> has this virtual function, so also define in this
50 // class to avoid 'virtual function override' warning.
51 virtual Array<rownr_t>& operator=(const Array<rownr_t>& other);
52
53 // Construct from a Vector or std::vector of old style row numbers.
54#ifdef IMPLICIT_CTDS_32BIT
55 RowNumbers(const Vector<uInt>& rows);
56 RowNumbers(const std::vector<uInt>& rows);
57#else
58 explicit RowNumbers(const Vector<uInt>& rows);
59 explicit RowNumbers(const std::vector<uInt>& rows);
60#endif
61
62 // Conversion operator to convert Vector<rownr_t> to Vector<uInt>.
63 // This is for backward compatibility of Table::rowNumbers.
64#ifdef IMPLICIT_CTDS_32BIT
65 operator Vector<uInt>() const
66#else
67 explicit operator Vector<uInt>() const
68#endif
69 {
70 return convertRownrVector(*this);
71 }
72
73 // Do the actual conversion.
74 // An exception is thrown if a row number exceeds 32 bits.
76};
77
78} // namespace casacore
79
80#endif
RowNumbers(const std::vector< rownr_t > &rows)
Construct from a std::vector of row numbers.
RowNumbers(const Vector< uInt > &rows)
Construct from a Vector or std::vector of old style row numbers.
RowNumbers(const Vector< rownr_t > &rows)
Construct from a Vector of row numbers.
Definition RowNumbers.h:44
virtual Array< rownr_t > & operator=(const Array< rownr_t > &other)
Array<T> has this virtual function, so also define in this class to avoid 'virtual function override'...
RowNumbers(const std::vector< uInt > &rows)
RowNumbers(size_t n)
Construct with the given length.
Definition RowNumbers.h:41
RowNumbers()
Construct an empty RowNumbers Vector.
Definition RowNumbers.h:38
static Vector< uInt > convertRownrVector(const Vector< rownr_t > &)
Do the actual conversion.
For temporary backward namespace compatibility, use casa as alias for casacore.
Definition mainpage.dox:28
uInt64 rownr_t
Define the type of a row number in a table.
Definition aipsxtype.h:44