28 #ifndef CASA_ARRAYBASE_2_H
29 #define CASA_ARRAYBASE_2_H
39 class ArrayPositionIterator;
122 virtual bool ok()
const;
147 virtual std::unique_ptr<ArrayBase>
makeArray()
const;
160 virtual std::unique_ptr<ArrayPositionIterator>
makeIterator (
size_t byDim)
const;
180 virtual const void*
getVStorage (
bool& deleteIt)
const;
181 virtual void putVStorage(
void*& storage,
bool deleteAndCopy);
182 virtual void freeVStorage(
const void*& storage,
bool deleteIt)
const;
199 long long nElementsAllocated,
200 bool copyDataIfNeeded,
201 size_t resizePercentage);
264 void validateIndex (
size_t index1,
size_t index2,
size_t index3)
const;
305 size_t ArrayVolume (
size_t Ndim,
const int* Shape);
314 const ssize_t* Origin,
const ssize_t* Inc,
317 const ssize_t* Inc,
const IPosition& Index);
IPosition endPosition() const
A convenience function: endPosition(i) = shape(i) - 1; i.e.
A Vector of integers, for indexing into Array<T> objects.
virtual std::unique_ptr< ArrayPositionIterator > makeIterator(size_t byDim) const
Resize the array and optionally copy the values.
bool conform2(const ArrayBase &other) const
Are the shapes identical?
bool contiguousStorage() const
Are the array data contiguous? If they are not contiguous, getStorage (see below) needs to make a cop...
Non-templated base class for templated Array class.
bool contiguous_p
Are the data contiguous?
size_t nelements() const
How many elements does this array have? Product of all axis lengths.
IPosition steps_p
Used to hold the step to next element in each dimension.
IPosition originalLength_p
virtual bool ok() const
Check to see if the Array is consistent.
StorageInitPolicy
A global enum used by some Array constructors.
size_t nels_p
Number of elements in the array.
void checkMatrixShape()
Check if the shape of a matrix is correct.
virtual std::unique_ptr< ArrayBase > getSection(const Slicer &) const
Get a reference to a section of an array.
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.
void throwArrayShapes(const IPosition &shape1, const IPosition &shape2, const char *name)
Function to check the shapes.
size_t ArrayIndexOffset(size_t Ndim, const ssize_t *Shape, const ssize_t *Origin, const ssize_t *Inc, const IPosition &Index)
What is the linear index into an "Ndim" dimensional array of the given "Shape", "Origin", and "Increment" for a given IPosition Index.
virtual std::unique_ptr< ArrayBase > makeArray() const
Make an empty array of the same type.
size_t makeSubset(ArrayBase &out, const IPosition &b, const IPosition &e, const IPosition &i)
Make a subset of an array.
virtual void * getVStorage(bool &deleteIt)
The following functions behave the same as the corresponding getStorage functions in the derived temp...
size_t ndim() const
The dimensionality of this array.
IPosition length_p
Used to hold the shape, increment into the underlying storage and originalLength of the array...
static unsigned arrayVersion()
Array version for major change (used by ArrayIO).
bool isEqual(const IPosition &other) const
Element-by-element comparison for equality.
bool empty() const
Is the array empty (i.e.
void validateIndex(const IPosition &) const
virtual void assignBase(const ArrayBase &source, bool checkType=true)
Assign the source array to this array.
void checkVectorShape()
Check if the shape of a vector is correct.
size_t ndimen_p
Dimensionality of the array.
virtual ~ArrayBase() noexcept
Destructor.
void baseReform(ArrayBase &tmp, const IPosition &shape, bool strict=true) const
Reform the array to a shape with the same nr of elements.
bool copyVectorHelper(const ArrayBase &other)
Helper function for templated Vector class.
void checkCubeShape()
Check if the shape of a cube is correct.
ArrayBase & assign(const ArrayBase &)
Assignment.
void baseMakeSteps()
Make the indexing step sizes.
void baseAddDegenerate(ArrayBase &, size_t numAxes)
These member functions return an Array reference with the specified number of extra axes...
Specify which elements to extract from an n-dimensional 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 f...
COPY is used when an internal copy of the storage is to be made.
void checkArrayShapes(const ArrayBase &left, const ArrayBase &right, const char *name)
const Double e
e and functions thereof:
Share means that the Array will just use the pointer (no copy), however the Array will NOT delete it ...
void validateConformance(const ArrayBase &) const
Various helper functions.
void baseNonDegenerate(const ArrayBase &other, const IPosition &ignoreAxes)
Remove the degenerate axes from the Array object.
ArrayBase & operator=(const ArrayBase &)=delete
const IPosition & steps() const
Return steps to be made if stepping one element in a dimension.
virtual void putVStorage(void *&storage, bool deleteAndCopy)
virtual void freeVStorage(const void *&storage, bool deleteIt) const
virtual void resize(const IPosition &newShape, bool copyValues=false)
Resize the array and optionally copy the values.
void swap(ArrayBase &source) noexcept
bool isStorageContiguous() const
Determine if the storage of a subset is contiguous.
size_t ArrayVolume(size_t Ndim, const int *Shape)
General global functions for Arrays.
TAKE_OVER is used to indicate that the Array should just use the external storage (i...
const IPosition & shape() const
The length of each axis.