Go to the documentation of this file.
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);
void validateConformance(const ArrayBase &) const
Various helper functions.
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.
Specify which elements to extract from an n-dimensional array.
void baseReform(ArrayBase &tmp, const IPosition &shape, Bool strict=True) const
Reform the array to a shape with the same nr of elements.
virtual Bool ok() const
Check to see if the Array is consistent.
IPosition length_p
Used to hold the shape, increment into the underlying storage and originalLength of the array.
A Vector of integers, for indexing into Array<T> objects.
virtual void * getVStorage(Bool &deleteIt)
The following functions behave the same as the corresponding getStorage functions in the derived temp...
Bool empty() const
Is the array empty (i.e.
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",...
size_t nelements() const
How many elements does this array have? Product of all axis lengths.
StorageInitPolicy
A global enum used by some Array constructors.
IPosition endPosition() const
A convenience function: endPosition(i) = shape(i) - 1; i.e.
Referenced counted pointer for constant data.
uInt ndim() const
The dimensionality of this array.
Non-templated base class for templated Array class.
IPosition steps_p
Used to hold the step to next element in each dimension.
@ TAKE_OVER
TAKE_OVER is used to indicate that the Array should just use the external storage (i....
virtual void assignBase(const ArrayBase &source, Bool checkType=True)
Assign the source array to this array.
Bool copyVectorHelper(const ArrayBase &other)
Helper function for templated Vector class.
A global enum used by some Array/Block constructors.
Bool conform2(const ArrayBase &other) const
Are the shapes identical?
size_t nels_p
Number of elements in the array.
static uInt arrayVersion()
Array version for major change (used by ArrayIO).
void validateIndex(const IPosition &) const
const IPosition & steps() const
Return steps to be made if stepping one element in a dimension.
const IPosition & shape() const
The length of each axis.
virtual void putVStorage(void *&storage, Bool deleteAndCopy)
virtual void resize(const IPosition &newShape, Bool copyValues=False)
Resize the array and optionally copy the values.
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.
void baseCopy(const ArrayBase &that)
@ COPY
COPY is used when an internal copy of the storage is to be made.
void baseMakeSteps()
Make the indexing step sizes.
virtual CountedPtr< ArrayBase > makeArray() const
Make an empty array of the same type.
Bool isEqual(const IPosition &other) const
Element-by-element comparison for equality.
virtual ~ArrayBase()
Destructor.
void throwNdimVector()
Throw expection if vector dimensionality is incorrect.
this file contains all the compiler specific defines
void baseAddDegenerate(ArrayBase &, uInt numAxes)
These member functions return an Array reference with the specified number of extra axes,...
size_t ArrayVolume(uInt Ndim, const Int *Shape)
General global functions for Arrays.
const Double e
e and functions thereof:
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...
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.
long long Int64
Define the extra non-standard types used by Casacore (like proposed uSize, Size)
@ SHARE
Share means that the Array will just use the pointer (no copy), however the Array will NOT delete it ...
bool Bool
Define the standard types used by Casacore.
Bool contiguousStorage() const
Are the array data contiguous? If they are not contiguous, getStorage (see below) needs to make a cop...
uInt ndimen_p
Dimensionality of the array.
IPosition originalLength_p
virtual CountedPtr< ArrayPositionIterator > makeIterator(uInt byDim) const
Create an ArrayIterator object of the correct type.
size_t makeSubset(ArrayBase &out, const IPosition &b, const IPosition &e, const IPosition &i)
Make a subset of an array.
ArrayBase & operator=(const ArrayBase &)
Assignment.
void checkVectorShape()
Check if the shape of a vector is correct.
Bool isStorageContiguous() const
Determine if the storage of a subset is contiguous.
Bool contiguous_p
Are the data contiguous?
void checkCubeShape()
Check if the shape of a cube is correct.
void checkArrayShapes(const ArrayBase &left, const ArrayBase &right, const char *name)
virtual void freeVStorage(const void *&storage, Bool deleteIt) const