28 #ifndef CASA_ARRAYBASE_H 29 #define CASA_ARRAYBASE_H 33 #include <casacore/casa/aips.h> 34 #include <casacore/casa/Arrays/IPosition.h> 35 #include <casacore/casa/Utilities/CountedPtr.h> 36 #include <casacore/casa/Containers/Allocator.h> 41 class ArrayPositionIterator;
191 Int64 nElementsAllocated,
192 Bool copyDataIfNeeded,
193 uInt resizePercentage);
309 const ssize_t* Origin,
const ssize_t* Inc,
312 const ssize_t* Inc,
const IPosition& Index);
Bool contiguous_p
Are the data contiguous?
A Vector of integers, for indexing into Array<T> objects.
ArrayBase & operator=(const ArrayBase &)
Assignment.
virtual void resize(const IPosition &newShape, Bool copyValues=False)
Resize the array and optionally copy the values.
long long Int64
Define the extra non-standard types used by Casacore (like proposed uSize, Size)
Non-templated base class for templated Array class.
const IPosition & steps() const
Return steps to be made if stepping one element in a dimension.
void throwNdimVector()
Throw expection if vector dimensionality is incorrect.
IPosition endPosition() const
A convenience function: endPosition(i) = shape(i) - 1; i.e.
uInt ndim() const
The dimensionality of this array.
const IPosition & shape() const
The length of each axis.
IPosition steps_p
Used to hold the step to next element in each dimension.
IPosition originalLength_p
uInt ndimen_p
Dimensionality of the array.
StorageInitPolicy
A global enum used by some Array constructors.
size_t nels_p
Number of elements in the array.
virtual void assignBase(const ArrayBase &source, Bool checkType=True)
Assign the source array to this array.
void checkMatrixShape()
Check if the shape of a matrix is correct.
void throwArrayShapes(const IPosition &shape1, const IPosition &shape2, const char *name)
Function to check the shapes.
size_t makeSubset(ArrayBase &out, const IPosition &b, const IPosition &e, const IPosition &i)
Make a subset of an array.
A global enum used by some Array/Block constructors.
IPosition length_p
Used to hold the shape, increment into the underlying storage and originalLength of the array...
Bool isStorageContiguous() const
Determine if the storage of a subset is contiguous.
size_t ArrayIndexOffset(uInt 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.
void baseCopy(const ArrayBase &that)
Bool conform2(const ArrayBase &other) const
Are the shapes identical?
virtual ~ArrayBase()
Destructor.
Referenced counted pointer for constant data.
size_t nelements() const
How many elements does this array have? Product of all axis lengths.
Bool contiguousStorage() const
Are the array data contiguous? If they are not contiguous, getStorage (see below) needs to make a cop...
void checkVectorShape()
Check if the shape of a vector is correct.
Bool isEqual(const IPosition &other) const
Element-by-element comparison for equality.
virtual void freeVStorage(const void *&storage, Bool deleteIt) const
void baseAddDegenerate(ArrayBase &, uInt numAxes)
These member functions return an Array reference with the specified number of extra axes...
void checkCubeShape()
Check if the shape of a cube is correct.
bool Bool
Define the standard types used by Casacore.
void baseMakeSteps()
Make the indexing step sizes.
size_t ArrayVolume(uInt Ndim, const Int *Shape)
General global functions for Arrays.
Specify which elements to extract from an n-dimensional array.
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 ...
virtual CountedPtr< ArrayPositionIterator > makeIterator(uInt byDim) const
Create an ArrayIterator object of the correct type.
static uInt arrayVersion()
Array version for major change (used by ArrayIO).
Bool empty() const
Is the array empty (i.e.
void baseNonDegenerate(const ArrayBase &other, const IPosition &ignoreAxes)
Remove the degenerate axes from the Array object.
virtual CountedPtr< ArrayBase > getSection(const Slicer &) const
Get a reference to a section of an array.
Bool copyVectorHelper(const ArrayBase &other)
Helper function for templated Vector class.
size_t makeDiagonal(uInt firstAxis, Int64 diag)
Set the length and stride such that the diagonal of the matrices defined by two consecutive axes is f...
virtual CountedPtr< ArrayBase > makeArray() const
Make an empty array of the same type.
virtual Bool ok() const
Check to see if the Array is consistent.
void validateIndex(const IPosition &) const
Bool reformOrResize(const IPosition &newShape, Bool resizeIfNeeded, uInt nReferences, Int64 nElementsAllocated, Bool copyDataIfNeeded, uInt resizePercentage)
Either reforms the array if size permits or resizes it to the new shape.
void validateConformance(const ArrayBase &) const
Various helper functions.
this file contains all the compiler specific defines
virtual void putVStorage(void *&storage, Bool deleteAndCopy)
void baseReform(ArrayBase &tmp, const IPosition &shape, Bool strict=True) const
Reform the array to a shape with the same nr of elements.
TAKE_OVER is used to indicate that the Array should just use the external storage (i...
virtual void * getVStorage(Bool &deleteIt)
The following functions behave the same as the corresponding getStorage functions in the derived temp...