casacore
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: aips2-request@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 //# $Id$
27 
28 #ifndef TABLES_ROWNUMBERS_H
29 #define TABLES_ROWNUMBERS_H
30 
31 //# Includes
32 #include <casacore/casa/aips.h>
33 #include <casacore/casa/Arrays/Vector.h>
34 
35 namespace casacore { //#Begin namespace casacore
36 
37  class RowNumbers: public Vector<rownr_t>
38  {
39  public:
40  // Construct an empty RowNumbers Vector.
42  {}
43 
44  // Construct with the given length.
45  explicit RowNumbers (size_t n)
46  : Vector<rownr_t> (n)
47  {}
48 
49  // Construct from a Vector of row numbers.
51  : Vector<rownr_t> (rows)
52  {}
53 
54  // Construct from a std::vector of row numbers.
55  RowNumbers (const std::vector<rownr_t>& rows);
56 
57  // Array<T> has this virtual function, so also define in this
58  // class to avoid 'virtual function override' warning.
59  virtual Array<rownr_t>& operator= (const Array<rownr_t>& other);
60 
61  // Construct from a Vector or std::vector of old style row numbers.
62 #ifdef IMPLICIT_CTDS_32BIT
63  RowNumbers (const Vector<uInt>& rows);
64  RowNumbers (const std::vector<uInt>& rows);
65 #else
66  explicit RowNumbers (const Vector<uInt>& rows);
67  explicit RowNumbers (const std::vector<uInt>& rows);
68 #endif
69 
70  // Conversion operator to convert Vector<rownr_t> to Vector<uInt>.
71  // This is for backward compatibility of Table::rowNumbers.
72 #ifdef IMPLICIT_CTDS_32BIT
73  operator Vector<uInt>() const
74 #else
75  explicit operator Vector<uInt>() const
76 #endif
77  { return convertRownrVector (*this); }
78 
79  // Do the actual conversion.
80  // An exception is thrown if a row number exceeds 32 bits.
82  };
83 
84 } //#End namespace casacore
85 
86 #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:50
static Vector< uInt > convertRownrVector(const Vector< rownr_t > &)
Do the actual conversion.
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:45
RowNumbers()
Construct an empty RowNumbers Vector.
Definition: RowNumbers.h:41
this file contains all the compiler specific defines
Definition: mainpage.dox:28
uInt64 rownr_t
Define the type of a row number in a table.
Definition: aipsxtype.h:46