casacore
Public Member Functions | Static Public Member Functions | List of all members
casacore::RowNumbers Class Reference

#include <RowNumbers.h>

Public Member Functions

 RowNumbers ()
 Construct an empty RowNumbers Vector. More...
 
 RowNumbers (size_t n)
 Construct with the given length. More...
 
 RowNumbers (const Vector< rownr_t > &rows)
 Construct from a Vector of row numbers. More...
 
 RowNumbers (const std::vector< rownr_t > &rows)
 Construct from a std::vector of row numbers. More...
 
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' warning. More...
 
 RowNumbers (const Vector< uInt > &rows)
 Construct from a Vector or std::vector of old style row numbers. More...
 
 RowNumbers (const std::vector< uInt > &rows)
 
 operator Vector< uInt > () const
 Conversion operator to convert Vector<rownr_t> to Vector<uInt>. More...
 
- Public Member Functions inherited from casacore::Vector< rownr_t >
 Vector ()
 A zero-length Vector. More...
 
 Vector (size_t Length)
 A Vector with a defined length and origin of zero. More...
 
 Vector (const IPosition &Length)
 
 Vector (size_t Length, const rownr_t &initialValue)
 A Vector with a defined length and origin of zero. More...
 
 Vector (const IPosition &Length, const rownr_t &initialValue)
 
 Vector (size_t Length, typename Array< rownr_t, Alloc >::uninitializedType, const Alloc &allocator=Alloc())
 An uninitialized Vector with a defined length. More...
 
 Vector (const IPosition &Length, typename Array< rownr_t, Alloc >::uninitializedType, const Alloc &allocator=Alloc())
 
 Vector (const std::vector< rownr_t > &other, long long nr)
 Create a Vector from the given std::vector "other." Make it length "nr" and copy over that many elements. More...
 
 Vector (const std::vector< rownr_t > &other, const Alloc &allocator=Alloc())
 Create a Vector of length other.size() and copy over its values. More...
 
 Vector (std::initializer_list< rownr_t > list)
 Create a Vector from an initializer list. More...
 
 Vector (const Vector< rownr_t, Alloc > &other)
 Create a reference to other. More...
 
 Vector (Vector< rownr_t, Alloc > &&source) noexcept
 Move. More...
 
 Vector (const Array< rownr_t, Alloc > &other)
 Create a reference to the other array. More...
 
 Vector (const IPosition &shape, rownr_t *storage, StorageInitPolicy policy=COPY)
 Create an Vector of a given shape from a pointer. More...
 
 Vector (const IPosition &shape, rownr_t *storage, StorageInitPolicy policy, Alloc &allocator)
 Create an Vector of a given shape from a pointer. More...
 
 Vector (const IPosition &shape, const rownr_t *storage)
 Create an Vector of a given shape from a pointer. More...
 
 Vector (InputIterator startIter, InputIterator endIter, const Alloc &allocator=Alloc())
 
 Vector (const std::vector< U, V > &other)
 Create a Vector from an STL vector (see tovector() in Array for the reverse operation). More...
 
 Vector (Iterator first, size_t size, int dummy)
 Create a Vector from a container iterator and its length. More...
 
void resize (size_t len, bool copyValues=false)
 
virtual void resize (const IPosition &len, bool copyValues=false) final override
 Resize the array and optionally copy the values. More...
 
Vector< rownr_t, Alloc > & assign_conforming (const Vector< rownr_t, Alloc > &source)
 
Vector< rownr_t, Alloc > & assign_conforming (Vector< rownr_t, Alloc > &&source)
 
Vector< rownr_t, Alloc > & assign_conforming (const Array< rownr_t, Alloc > &source)
 source must be a 1-dimensional array. More...
 
Vector< rownr_t, Alloc > & assign_conforming (Array< rownr_t, Alloc > &&source)
 
Vector< rownr_t, Alloc > & operator= (const Vector< rownr_t, Alloc > &source)
 
Vector< rownr_t, Alloc > & operator= (Vector< rownr_t, Alloc > &&source)
 
Vector< rownr_t, Alloc > & operator= (const Array< rownr_t, Alloc > &source)
 
Vector< rownr_t, Alloc > & operator= (Array< rownr_t, Alloc > &&source)
 
rownr_toperator[] (size_t index)
 Convert a Vector to a Block, resizing the block and copying values. More...
 
const rownr_toperator[] (size_t index) const
 
rownr_toperator() (const IPosition &i)
 
const rownr_toperator() (const IPosition &i) const
 
rownr_toperator() (size_t index)
 
const rownr_toperator() (size_t index) const
 
Vector< rownr_t, Alloc > operator() (const Slice &slice)
 Take a slice of this vector. More...
 
const Vector< rownr_t, Alloc > operator() (const Slice &slice) const
 
Array< rownr_t, Alloc > operator() (const IPosition &blc, const IPosition &trc, const IPosition &incr)
 Slice using IPositions. More...
 
const Array< rownr_t, Alloc > operator() (const IPosition &blc, const IPosition &trc, const IPosition &incr) const
 
Array< rownr_t, Alloc > operator() (const IPosition &blc, const IPosition &trc)
 
const Array< rownr_t, Alloc > operator() (const IPosition &blc, const IPosition &trc) const
 
Array< rownr_t, Alloc > operator() (const Slicer &slicer)
 
const Array< rownr_t, Alloc > operator() (const Slicer &slicer) const
 
MaskedArray< rownr_toperator() (const LogicalArray &mask) const
 The array is masked by the input LogicalArray. More...
 
MaskedArray< rownr_toperator() (const LogicalArray &mask)
 Return a MaskedArray. More...
 
MaskedArray< rownr_toperator() (const MaskedLogicalArray &mask) const
 The array is masked by the input MaskedLogicalArray. More...
 
MaskedArray< rownr_toperator() (const MaskedLogicalArray &mask)
 Return a MaskedArray. More...
 
const IPositionshape () const
 The length of the Vector. More...
 
void shape (int &Shape) const
 
virtual bool ok () const final override
 Verify that dimensionality is 1 and then call Array<T>::ok() More...
 
- Public Member Functions inherited from casacore::Array< T, Alloc >
 Array (const Alloc &allocator=Alloc())
 Result has dimensionality of zero, and nelements is zero. More...
 
 Array (const IPosition &shape, const Alloc &allocator=Alloc())
 Create an array of the given shape, i.e. More...
 
 Array (const IPosition &shape, const T &initialValue, const Alloc &allocator=Alloc())
 Create an array of the given shape and initialize it with the initial value. More...
 
 Array (const IPosition &shape, uninitializedType, const Alloc &allocator=Alloc())
 Constructor to create an uninitialized array. More...
 
 Array (std::initializer_list< T > list, const Alloc &allocator=Alloc())
 Construct a one-dimensional array from an initializer list. More...
 
 Array (const Array< T, Alloc > &other)
 After construction, this and other reference the same storage. More...
 
 Array (Array< T, Alloc > &&source) noexcept
 Source will be empty after this call. More...
 
 Array (const IPosition &shape, T *storage, StorageInitPolicy policy=COPY, const Alloc &allocator=Alloc())
 Create an Array of a given shape from a pointer. More...
 
 Array (const IPosition &shape, const T *storage)
 Create an Array of a given shape from a pointer. More...
 
template<typename InputIterator >
 Array (const IPosition &shape, InputIterator startIter, const Alloc &allocator=Alloc())
 Construct an array from an iterator and a shape. More...
 
virtual ~Array () noexcept
 Frees up storage only if this array was the last reference to it. More...
 
virtual std::unique_ptr< ArrayBasemakeArray () const override
 Make an empty array of the same template type. More...
 
Alloc & allocator ()
 Retrieve the allocator associated with this array. More...
 
const Alloc & allocator () const
 
void assign (const Array< T, Alloc > &other)
 Assign the other array to this array. More...
 
void assignBase (const ArrayBase &other, bool checkType=true) override
 Assign the source array to this array. More...
 
void set (const T &value)
 Set every element of the array to "value." Also could use the assignment operator which assigns an array from a scalar. More...
 
template<typename Callable >
void apply (Callable function)
 Apply the function to every element of the array. More...
 
virtual void reference (const Array< T, Alloc > &other)
 After invocation, this array and other reference the same storage. More...
 
Array< T, Alloc > & assign_conforming (const Array< T, Alloc > &other)
 Copy the values in other to this. More...
 
template<typename MaskAlloc >
Array< T, Alloc > & assign_conforming (const MaskedArray< T, Alloc, MaskAlloc > &marray)
 Copy to this those values in marray whose corresponding elements in marray's mask are true. More...
 
Array< T, Alloc > & operator= (const Array< T, Alloc > &other)
 TODO we should change the semantics. More...
 
template<typename MaskAlloc >
Array< T, Alloc > & operator= (const MaskedArray< T, Alloc, MaskAlloc > &marray)
 Calls assign_conforming(). More...
 
Array< T, Alloc > & operator= (Array< T, Alloc > &&other)
 The move operator takes the storage from the given array. More...
 
Array< T, Alloc > & operator= (const T &value)
 Set every element of this array to "value". More...
 
Array< T, Alloc > copy () const
 This makes a copy of the array and returns it. More...
 
void copyMatchingPart (const Array< T, Alloc > &from)
 This function copies the matching part of from array to this array. More...
 
void unique ()
 This ensures that this array does not reference any other storage. More...
 
template<class U >
void tovector (std::vector< T, U > &out) const
 Create an STL vector from an Array. More...
 
std::vector< T > tovector () const
 
Array< T, Alloc > reform (const IPosition &shape) const
 It is occasionally useful to have an array which access the same storage appear to have a different shape. More...
 
bool reformOrResize (const IPosition &newShape, size_t resizePercentage=0, bool resizeIfNeeded=true)
 Having an array that can be reused without requiring reallocation can be useful for large arrays. More...
 
bool adjustLastAxis (const IPosition &newShape, size_t resizePercentage=0, bool resizeIfNeeded=true)
 Use this method to extend or reduce the last dimension of an array. More...
 
size_t capacity () const
 Returns the number of elements allocated. More...
 
Array< T, Alloc > nonDegenerate (size_t startingAxis=0, bool throwIfError=true) const
 These member functions remove degenerate (ie. More...
 
Array< T, Alloc > nonDegenerate (const IPosition &ignoreAxes) const
 
void nonDegenerate (const Array< T, Alloc > &other, size_t startingAxis=0, bool throwIfError=true)
 
void nonDegenerate (const Array< T, Alloc > &other, const IPosition &ignoreAxes)
 
void removeDegenerate (size_t startingAxis=0, bool throwIfError=true)
 Remove degenerate axes from this Array object. More...
 
void removeDegenerate (const IPosition &ignoreAxes)
 
const Array< T, Alloc > addDegenerate (size_t numAxes) const
 This member function returns an Array reference with the specified number of extra axes, all of length one, appended to the end of the Array. More...
 
Array< T, Alloc > addDegenerate (size_t numAxes)
 
void resize ()
 Make this array a different shape. More...
 
T & operator() (const IPosition &)
 Access a single element of the array. More...
 
const T & operator() (const IPosition &) const
 
Array< T, Alloc > operator() (const IPosition &start, const IPosition &end)
 Get a reference to an array section extending from start to end (inclusive). More...
 
const Array< T, Alloc > operator() (const IPosition &start, const IPosition &end) const
 
Array< T, Alloc > operator() (const IPosition &start, const IPosition &end, const IPosition &inc)
 Along the ith axis, every inc[i]'th element is chosen. More...
 
const Array< T, Alloc > operator() (const IPosition &start, const IPosition &end, const IPosition &inc) const
 
Array< T, Alloc > operator() (const Slicer &)
 Get a reference to an array section using a Slicer. More...
 
const Array< T, Alloc > operator() (const Slicer &) const
 
std::unique_ptr< ArrayBasegetSection (const Slicer &) const override
 Get a reference to a section of an array. More...
 
Array< T, Alloc > operator[] (size_t i) const
 Get the subset given by the i-th value of the last axis. More...
 
Array< T, Alloc > diagonals (size_t firstAxis=0, long long diag=0) const
 Get the diagonal of each matrix part in the full array. More...
 
const MaskedArray< T > operator() (const LogicalArray &mask) const
 The array is masked by the input LogicalArray. More...
 
MaskedArray< T > operator() (const LogicalArray &mask)
 
const MaskedArray< T > operator() (const MaskedLogicalArray &mask) const
 The array is masked by the input MaskedLogicalArray. More...
 
MaskedArray< T > operator() (const MaskedLogicalArray &mask)
 
size_t nrefs () const
 The number of references the underlying storage has assigned to it. More...
 
bool conform (const Array< T, Alloc > &other) const
 Are the shapes identical? More...
 
bool conform (const MaskedArray< T > &other) const
 
T * data ()
 Get a pointer to the beginning of the array. More...
 
const T * data () const
 
T * getStorage (bool &deleteIt)
 Generally use of this should be shunned, except to use a FORTRAN routine or something similar. More...
 
const T * getStorage (bool &deleteIt) const
 
void * getVStorage (bool &deleteIt) override
 The following functions behave the same as the corresponding getStorage functions in the derived templated Array class. More...
 
const void * getVStorage (bool &deleteIt) const override
 
void putStorage (T *&storage, bool deleteAndCopy)
 putStorage() is normally called after a call to getStorage() (cf). More...
 
void putVStorage (void *&storage, bool deleteAndCopy) override
 
void freeStorage (const T *&storage, bool deleteIt) const
 If deleteIt is set, delete "storage". More...
 
void freeVStorage (const void *&storage, bool deleteIt) const override
 
virtual void takeStorage (const IPosition &shape, T *storage, StorageInitPolicy policy=COPY, const Alloc &allocator=Alloc())
 Replace the data values with those in the pointer storage. More...
 
virtual void takeStorage (const IPosition &shape, const T *storage, const Alloc &allocator=Alloc())
 Since the pointer is const, a copy is always taken. More...
 
std::unique_ptr< ArrayPositionIteratormakeIterator (size_t byDim) const override
 Create an ArrayIterator object of the correct type. More...
 
iterator begin ()
 Get the begin iterator object for any array. More...
 
const_iterator begin () const
 
iterator end ()
 
const_iterator end () const
 
contiter cbegin ()
 Get the begin iterator object for a contiguous array. More...
 
const_contiter cbegin () const
 
contiter cend ()
 
const_contiter cend () const
 
- Public Member Functions inherited from casacore::ArrayBase
 ArrayBase () noexcept
 
 ArrayBase (const IPosition &shape)
 Create an array of the given shape, i.e. More...
 
 ArrayBase (const ArrayBase &other)
 Copy constructor. More...
 
 ArrayBase (ArrayBase &&source) noexcept
 
ArrayBaseassign (const ArrayBase &)
 Assignment. More...
 
ArrayBaseoperator= (const ArrayBase &)=delete
 
ArrayBaseoperator= (ArrayBase &&) noexcept
 
virtual ~ArrayBase () noexcept
 Destructor. More...
 
size_t ndim () const
 The dimensionality of this array. More...
 
size_t nelements () const
 How many elements does this array have? Product of all axis lengths. More...
 
size_t size () const
 
bool empty () const
 Is the array empty (i.e. More...
 
bool contiguousStorage () const
 Are the array data contiguous? If they are not contiguous, getStorage (see below) needs to make a copy. More...
 
const IPositionshape () const
 The length of each axis. More...
 
IPosition endPosition () const
 A convenience function: endPosition(i) = shape(i) - 1; i.e. More...
 
const IPositionsteps () const
 Return steps to be made if stepping one element in a dimension. More...
 
void validateConformance (const ArrayBase &) const
 Various helper functions. More...
 
void validateIndex (const IPosition &) const
 
void validateIndex (size_t index) const
 
void validateIndex (size_t index1, size_t index2) const
 
void validateIndex (size_t index1, size_t index2, size_t index3) const
 

Static Public Member Functions

static Vector< uIntconvertRownrVector (const Vector< rownr_t > &)
 Do the actual conversion. More...
 
- Static Public Member Functions inherited from casacore::ArrayBase
static unsigned arrayVersion ()
 Array version for major change (used by ArrayIO). More...
 

Additional Inherited Members

- Public Types inherited from casacore::Array< T, Alloc >
typedef Alloc allocator_type
 Define the STL-style iterator functions (only forward iterator). More...
 
typedef T value_type
 Element type. More...
 
typedef const T & const_reference
 TODO This is how std containers define a reference type, but the name 'reference' is already taken by a method. More...
 
typedef T * pointer
 Pointer to an element type. More...
 
typedef const T * const_pointer
 Constant pointer to the element type. More...
 
typedef IteratorSTL iterator
 
typedef ConstIteratorSTL const_iterator
 
typedef T * contiter
 
typedef const T * const_contiter
 
- Static Public Attributes inherited from casacore::Array< T, Alloc >
static struct casacore::Array::uninitializedType uninitialized
 
- Protected Member Functions inherited from casacore::Vector< rownr_t >
virtual void doNonDegenerate (const Array< rownr_t > &other, const IPosition &ignoreAxes) final override
 Remove the degenerate axes from other and store result in this vector. More...
 
virtual size_t fixedDimensionality () const final override
 Subclasses can return their dimensionality. More...
 
- Protected Member Functions inherited from casacore::Array< T, Alloc >
 Array (Array< T, Alloc > &&source, const IPosition &shapeForSource) noexcept
 Source will be empty with given shape after this call. More...
 
void swap (Array< T, Alloc > &other)
 Swap this array with another array. More...
 
virtual void preTakeStorage (const IPosition &)
 pre/post processing hook of takeStorage() for subclasses. More...
 
virtual void postTakeStorage ()
 
void checkBeforeResize (const IPosition &newShape)
 This function is called when this array is about to be resized, before any work is done. More...
 
virtual void checkAssignableType (ArrayBase &arrayBase) const
 
virtual void doNonDegenerate (const Array< T, Alloc > &other, const IPosition &ignoreAxes)
 Remove the degenerate axes from the Array object. More...
 
void makeSteps ()
 Fill the steps and the end for a derived class. More...
 
void setEndIter ()
 Set the end iterator. More...
 
- Protected Member Functions inherited from casacore::ArrayBase
 ArrayBase (ArrayBase &&source, const IPosition &shapeForSource) noexcept
 For subclasses, this move constructor allows the moved-from object to obtain a given shape after resizing. More...
 
void swap (ArrayBase &source) noexcept
 
bool reformOrResize (const IPosition &newShape, bool resizeIfNeeded, size_t nReferences, long long nElementsAllocated, bool copyDataIfNeeded, size_t resizePercentage)
 Either reforms the array if size permits or resizes it to the new shape. More...
 
bool isStorageContiguous () const
 Determine if the storage of a subset is contiguous. More...
 
void checkVectorShape ()
 Check if the shape of a vector is correct. More...
 
void checkMatrixShape ()
 Check if the shape of a matrix is correct. More...
 
void checkCubeShape ()
 Check if the shape of a cube is correct. More...
 
void baseReform (ArrayBase &tmp, const IPosition &shape, bool strict=true) const
 Reform the array to a shape with the same nr of elements. More...
 
void baseNonDegenerate (const ArrayBase &other, const IPosition &ignoreAxes)
 Remove the degenerate axes from the Array object. More...
 
void baseAddDegenerate (ArrayBase &, size_t numAxes)
 These member functions return an Array reference with the specified number of extra axes, all of length one, appended to the end of the Array. More...
 
size_t makeSubset (ArrayBase &out, const IPosition &b, const IPosition &e, const IPosition &i)
 Make a subset of an array. More...
 
size_t makeDiagonal (size_t firstAxis, long long diag)
 Set the length and stride such that the diagonal of the matrices defined by two consecutive axes is formed. More...
 
bool conform2 (const ArrayBase &other) const
 Are the shapes identical? More...
 
void baseMakeSteps ()
 Make the indexing step sizes. More...
 
bool copyVectorHelper (const ArrayBase &other)
 Helper function for templated Vector class. More...
 
- Static Protected Member Functions inherited from casacore::Array< T, Alloc >
static void copyToContiguousStorage (T *dst, Array< T, Alloc > const &src)
 
- Protected Attributes inherited from casacore::Array< T, Alloc >
std::shared_ptr< arrays_internal::Storage< T, Alloc > > data_p
 Shared pointer to a Storage that contains the data. More...
 
T * begin_p
 This pointer is adjusted to point to the first element of the array. More...
 
T * end_p
 The end for an STL-style iteration. More...
 
- Protected Attributes inherited from casacore::ArrayBase
size_t nels_p
 Number of elements in the array. More...
 
size_t ndimen_p
 Dimensionality of the array. More...
 
bool contiguous_p
 Are the data contiguous? More...
 
IPosition length_p
 Used to hold the shape, increment into the underlying storage and originalLength of the array. More...
 
IPosition inc_p
 
IPosition originalLength_p
 
IPosition steps_p
 Used to hold the step to next element in each dimension. More...
 

Detailed Description

Definition at line 37 of file RowNumbers.h.

Constructor & Destructor Documentation

◆ RowNumbers() [1/6]

casacore::RowNumbers::RowNumbers ( )
inline

Construct an empty RowNumbers Vector.

Definition at line 41 of file RowNumbers.h.

◆ RowNumbers() [2/6]

casacore::RowNumbers::RowNumbers ( size_t  n)
inlineexplicit

Construct with the given length.

Definition at line 45 of file RowNumbers.h.

◆ RowNumbers() [3/6]

casacore::RowNumbers::RowNumbers ( const Vector< rownr_t > &  rows)
inline

Construct from a Vector of row numbers.

Definition at line 50 of file RowNumbers.h.

◆ RowNumbers() [4/6]

casacore::RowNumbers::RowNumbers ( const std::vector< rownr_t > &  rows)

Construct from a std::vector of row numbers.

◆ RowNumbers() [5/6]

casacore::RowNumbers::RowNumbers ( const Vector< uInt > &  rows)
explicit

Construct from a Vector or std::vector of old style row numbers.

◆ RowNumbers() [6/6]

casacore::RowNumbers::RowNumbers ( const std::vector< uInt > &  rows)
explicit

Member Function Documentation

◆ convertRownrVector()

static Vector<uInt> casacore::RowNumbers::convertRownrVector ( const Vector< rownr_t > &  )
static

Do the actual conversion.

An exception is thrown if a row number exceeds 32 bits.

Referenced by operator Vector< uInt >().

◆ operator Vector< uInt >()

casacore::RowNumbers::operator Vector< uInt > ( ) const
inlineexplicit

Conversion operator to convert Vector<rownr_t> to Vector<uInt>.

This is for backward compatibility of Table::rowNumbers.

Definition at line 75 of file RowNumbers.h.

References convertRownrVector().

◆ operator=()

virtual Array<rownr_t>& casacore::RowNumbers::operator= ( const Array< rownr_t > &  other)
virtual

Array<T> has this virtual function, so also define in this class to avoid 'virtual function override' warning.


The documentation for this class was generated from the following file: