casacore
Loading...
Searching...
No Matches
casacore::RowNumbers Class Reference

#include <RowNumbers.h>

Public Member Functions

 RowNumbers ()
 Construct an empty RowNumbers Vector.
 RowNumbers (size_t n)
 Construct with the given length.
 RowNumbers (const Vector< rownr_t > &rows)
 Construct from a Vector of row numbers.
 RowNumbers (const std::vector< rownr_t > &rows)
 Construct from a std::vector of row numbers.
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.
 RowNumbers (const Vector< uInt > &rows)
 Construct from a Vector or std::vector of old style row numbers.
 RowNumbers (const std::vector< uInt > &rows)
 operator Vector< uInt > () const
 Conversion operator to convert Vector<rownr_t> to Vector<uInt>.
Public Member Functions inherited from casacore::Vector< rownr_t >
 Vector ()
 A zero-length Vector.
void resize (size_t len, bool copyValues=false)
Vector< rownr_t > & assign_conforming (const Vector< rownr_t > &source)
Vector< rownr_t > & operator= (const Vector< rownr_t > &source)
rownr_toperator[] (size_t index)
 Convert a Vector to a Block, resizing the block and copying values.
rownr_toperator() (const IPosition &i)
const IPositionshape () const
 The length of the Vector.
virtual bool ok () const final override
 Verify that dimensionality is 1 and then call Array<T>::ok().
Public Member Functions inherited from casacore::Array< rownr_t >
 Array ()
 Result has dimensionality of zero, and nelements is zero.
virtual ~Array () noexcept
 Frees up storage only if this array was the last reference to it.
virtual std::unique_ptr< ArrayBasemakeArray () const override
 Make an empty array of the same template type.
void assign (const Array< rownr_t > &other)
 Assign the other array to this array.
void assignBase (const ArrayBase &other, bool checkType=true) override
 Assign the source array to this array.
void set (const rownr_t &value)
 Set every element of the array to "value." Also could use the assignment operator which assigns an array from a scalar.
void apply (Callable function)
 Apply the function to every element of the array.
virtual void reference (const Array< rownr_t > &other)
 After invocation, this array and other reference the same storage.
Array< rownr_t > & assign_conforming (const Array< rownr_t > &other)
 Copy the values in other to this.
Array< rownr_t > & operator= (const Array< rownr_t > &other)
 TODO we should change the semantics.
Array< rownr_tcopy () const
 This makes a copy of the array and returns it.
void copyMatchingPart (const Array< rownr_t > &from)
 This function copies the matching part of from array to this array.
void unique ()
 This ensures that this array does not reference any other storage.
void tovector (std::vector< rownr_t, U > &out) const
 Create an STL vector from an Array.
Array< rownr_treform (const IPosition &shape) const
 It is occasionally useful to have an array which access the same storage appear to have a different shape.
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.
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.
size_t capacity () const
 Returns the number of elements allocated.
Array< rownr_tnonDegenerate (size_t startingAxis=0, bool throwIfError=true) const
 These member functions remove degenerate (ie.
void removeDegenerate (size_t startingAxis=0, bool throwIfError=true)
 Remove degenerate axes from this Array object.
const Array< rownr_taddDegenerate (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.
void resize ()
 Make this array a different shape.
rownr_toperator() (const IPosition &)
 Access a single element of the array.
std::unique_ptr< ArrayBasegetSection (const Slicer &) const override
 Get a reference to a section of an array.
Array< rownr_toperator[] (size_t i) const
 Get the subset given by the i-th value of the last axis.
Array< rownr_tdiagonals (size_t firstAxis=0, long long diag=0) const
 Get the diagonal of each matrix part in the full array.
size_t nrefs () const
 The number of references the underlying storage has assigned to it.
bool conform (const Array< rownr_t > &other) const
 Are the shapes identical?
rownr_tdata ()
 Get a pointer to the beginning of the array.
rownr_tgetStorage (bool &deleteIt)
 Generally use of this should be shunned, except to use a FORTRAN routine or something similar.
void * getVStorage (bool &deleteIt) override
 The following functions behave the same as the corresponding getStorage functions in the derived templated Array class.
void putStorage (rownr_t *&storage, bool deleteAndCopy)
 putStorage() is normally called after a call to getStorage() (cf).
void putVStorage (void *&storage, bool deleteAndCopy) override
void freeStorage (const rownr_t *&storage, bool deleteIt) const
 If deleteIt is set, delete "storage".
void freeVStorage (const void *&storage, bool deleteIt) const override
virtual void takeStorage (const IPosition &shape, rownr_t *storage, StorageInitPolicy policy=COPY)
 Replace the data values with those in the pointer storage.
std::unique_ptr< ArrayPositionIteratormakeIterator (size_t byDim) const override
 Create an ArrayIterator object of the correct type.
iterator begin ()
 Get the begin iterator object for any array.
iterator end ()
contiter cbegin ()
 Get the begin iterator object for a contiguous array.
contiter cend ()
Public Member Functions inherited from casacore::ArrayBase
 ArrayBase () noexcept
 ArrayBase (const IPosition &shape)
 Create an array of the given shape, i.e.
 ArrayBase (const ArrayBase &other)
 Copy constructor.
 ArrayBase (ArrayBase &&source) noexcept
ArrayBaseassign (const ArrayBase &)
 Assignment.
ArrayBaseoperator= (const ArrayBase &)=delete
ArrayBaseoperator= (ArrayBase &&) noexcept
virtual ~ArrayBase () noexcept
 Destructor.
size_t ndim () const
 The dimensionality of this array.
size_t nelements () const
 How many elements does this array have?
size_t size () const
bool empty () const
 Is the array empty (i.e.
bool contiguousStorage () const
 Are the array data contiguous?
const IPositionshape () const
 The length of each axis.
IPosition endPosition () const
 A convenience function: endPosition(i) = shape(i) - 1; i.e.
const IPositionsteps () const
 Return steps to be made if stepping one element in a dimension.
virtual void resize (const IPosition &newShape, bool copyValues=false)
 Resize the array and optionally copy the values.
virtual const void * getVStorage (bool &deleteIt) const
void validateConformance (const ArrayBase &) const
 Various helper functions.
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.
Static Public Member Functions inherited from casacore::ArrayBase
static unsigned arrayVersion ()
 Array version for major change (used by ArrayIO).

Additional Inherited Members

Public Types inherited from casacore::Array< rownr_t >
typedef rownr_t value_type
 Define the STL-style iterator functions (only forward iterator).
typedef const rownr_tconst_reference
 TODO This is how std containers define a reference type, but the name 'reference' is already taken by a method.
typedef rownr_tpointer
 Pointer to an element type.
typedef const rownr_tconst_pointer
 Constant pointer to the element type.
typedef IteratorSTL iterator
typedef ConstIteratorSTL const_iterator
typedef rownr_tcontiter
typedef const rownr_tconst_contiter
Static Public Attributes inherited from casacore::Array< rownr_t >
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.
virtual size_t fixedDimensionality () const final override
 Subclasses can return their dimensionality.
Protected Member Functions inherited from casacore::Array< rownr_t >
virtual void preTakeStorage (const IPosition &)
 pre/post processing hook of takeStorage() for subclasses.
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.
virtual void checkAssignableType (ArrayBase &arrayBase) const
void makeSteps ()
 Fill the steps and the end for a derived class.
void setEndIter ()
 Set the end iterator.
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.
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.
bool isStorageContiguous () const
 Determine if the storage of a subset is contiguous.
void checkVectorShape ()
 Check if the shape of a vector is correct.
void checkMatrixShape ()
 Check if the shape of a matrix is correct.
void checkCubeShape ()
 Check if the shape of a cube is correct.
void baseReform (ArrayBase &tmp, const IPosition &shape, bool strict=true) const
 Reform the array to a shape with the same nr of elements.
void baseNonDegenerate (const ArrayBase &other, const IPosition &ignoreAxes)
 Remove the degenerate axes from the Array object.
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.
size_t makeSubset (ArrayBase &out, const IPosition &b, const IPosition &e, const IPosition &i)
 Make a subset of an array.
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.
bool conform2 (const ArrayBase &other) const
 Are the shapes identical?
void baseMakeSteps ()
 Make the indexing step sizes.
bool copyVectorHelper (const ArrayBase &other)
 Helper function for templated Vector class.
Protected Attributes inherited from casacore::Array< rownr_t >
std::shared_ptr< arrays_internal::Storage< rownr_t > > data_p
 Shared pointer to a Storage that contains the data.
rownr_tbegin_p
 This pointer is adjusted to point to the first element of the array.
rownr_tend_p
 The end for an STL-style iteration.
Protected Attributes inherited from casacore::ArrayBase
size_t nels_p
 Number of elements in the array.
size_t ndimen_p
 Dimensionality of the array.
bool contiguous_p
 Are the data contiguous?
IPosition length_p
 Used to hold the shape, increment into the underlying storage and originalLength of the array.
IPosition inc_p
IPosition originalLength_p
IPosition steps_p
 Used to hold the step to next element in each dimension.

Detailed Description

Definition at line 35 of file RowNumbers.h.

Constructor & Destructor Documentation

◆ RowNumbers() [1/6]

casacore::RowNumbers::RowNumbers ( )
inline

Construct an empty RowNumbers Vector.

Definition at line 39 of file RowNumbers.h.

◆ RowNumbers() [2/6]

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

Construct with the given length.

Definition at line 43 of file RowNumbers.h.

References casacore::Vector< rownr_t >::Vector().

◆ RowNumbers() [3/6]

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

Construct from a Vector of row numbers.

Definition at line 48 of file RowNumbers.h.

References casacore::Vector< rownr_t >::Vector().

◆ 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.

References casacore::Vector< rownr_t >::Vector().

◆ RowNumbers() [6/6]

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

Member Function Documentation

◆ convertRownrVector()

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.

References casacore::Vector< rownr_t >::Vector().

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 73 of file RowNumbers.h.

References convertRownrVector(), and casacore::Vector< rownr_t >::Vector().

◆ 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.

References casacore::Vector< rownr_t >::Vector().


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