34 #include <casacore/casa/aips.h> 35 #include <casacore/casa/Arrays/ArrayBase.h> 36 #include <casacore/casa/Containers/Block.h> 37 #include <casacore/casa/Utilities/CountedPtr.h> 38 #include <casacore/casa/Arrays/MaskLogiArrFwd.h> 39 #include <casacore/casa/Arrays/IPosition.h> 40 #include <casacore/casa/ostream.h> 42 #include <casacore/casa/stdvector.h> 256 void set(
const T &
value);
262 void apply(T (*
function)(T));
265 void apply(T (*
function)(
const T &));
376 void tovector(vector<T, U> &out)
const;
423 uInt resizePercentage = 0,
438 uInt resizePercentage = 0,
439 bool resizeIfNeeded =
True);
690 class BaseIteratorSTL
722 {
return const_cast<T*
>(
itsPos); }
725 { os << iter.
itsPos;
return os; }
774 {
return *this->
getPos(); }
776 {
return this->
getPos(); }
862 const_iterator
end()
const 948 #ifndef CASACORE_NO_AUTO_TEMPLATES 949 #include <casacore/casa/Arrays/Array.tcc> 950 #endif //# CASACORE_NO_AUTO_TEMPLATES
ConstIteratorSTL(const T *end=0)
Create the end const_iterator object for an Array.
Bool contiguous_p
Are the data contiguous?
A Vector of integers, for indexing into Array<T> objects.
ConstIteratorSTL operator++(int)
long long Int64
Define the extra non-standard types used by Casacore (like proposed uSize, Size)
size_t capacity() const
Returns the number of elements allocated.
virtual void assignBase(const ArrayBase &other, Bool checkType=True)
Assign the source array to this array.
Non-templated base class for templated Array class.
Array< T > diagonals(uInt firstAxis=0, Int64 diag=0) const
Get the diagonal of each matrix part in the full array.
void putStorage(T *&storage, Bool deleteAndCopy)
putStorage() is normally called after a call to getStorage() (cf).
static ArrayInitPolicy defaultArrayInitPolicy()
const T * getStorage(Bool &deleteIt) const
static void copyToContiguousStorage(T *dst, Array< T > const &src, ArrayInitPolicy policy)
Array< T > copy(ArrayInitPolicy policy=ArrayInitPolicies::NO_INIT) const
This makes a copy of the array and returns it.
void freeStorage(const T *&storage, Bool deleteIt) const
If deleteIt is set, delete "storage".
vector< T > tovector() const
virtual void preTakeStorage(const IPosition &)
pre/post processing hook of takeStorage() for subclasses.
Map a domain object into a range object via operator().
IteratorSTL(Array< T > &arr)
Create the begin iterator object for an Array.
static constexpr ArrayInitPolicy NO_INIT
Don't initialize elements in the array.
LatticeExprNode mask(const LatticeExprNode &expr)
This function returns the mask of the given expression.
ConstIteratorSTL(const IteratorSTL &iter)
Create from a non-const iterator.
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.
Array< T > operator[](size_t i) const
Get the subset given by the i-th value of the last axis.
uInt nrefs() const
The number of references the underlying storage has assigned to it.
StorageInitPolicy
A global enum used by some Array constructors.
bool adjustLastAxis(const IPosition &newShape, uInt resizePercentage=0, bool resizeIfNeeded=True)
Use this method to extend or reduce the last dimension of an array.
bool operator!=(const BaseIteratorSTL &other) const
virtual ~Array()
Frees up storage only if this array was the last reference to it.
ptrdiff_t difference_type
size_t nels_p
Number of elements in the array.
void makeSteps()
Fill the steps and the end for a derived class.
static bool init_anyway()
const value_type * pointer
const Array< T > addDegenerate(uInt numAxes) const
This member function returns an Array reference with the specified number of extra axes...
virtual void * getVStorage(Bool &deleteIt)
The following functions behave the same as the corresponding getStorage functions in the derived temp...
See the function begin() and end() for a detailed description of the STL iterator capability...
Allocator_private::BulkAllocator< T > * nonNewDelAllocator() const
If the current allocator is NewDelAllocator<T>, BulkAllocator for DefaultAllocator<T> is returned...
A 2-D Specialization of the Array class.
iterator begin()
Get the begin iterator object for any array.
TableExprNode marray(const TableExprNode &array, const TableExprNode &mask)
Form a masked array.
virtual void assign(const Array< T > &other)
Assign the other array to this array.
void copyMatchingPart(const Array< T > &from)
This function copies the matching part of from array to this array.
contiter cbegin()
Get the begin iterator object for a contiguous array.
A global enum used by some Array/Block constructors.
Iterate an Array cursor through another Array.
virtual void reference(const Array< T > &other)
After invocation, this array and other reference the same storage.
IPosition length_p
Used to hold the shape, increment into the underlying storage and originalLength of the array...
virtual Bool ok() const
Check to see if the Array is consistent.
virtual void doNonDegenerate(const Array< T > &other, const IPosition &ignoreAxes)
Remove the degenerate axes from the Array object.
friend ostream & operator<<(ostream &os, const BaseIteratorSTL &iter)
T * data()
Get a pointer to the beginning of the array.
Class for masking an Array for operations on that Array.
T * getStorage(Bool &deleteIt)
Generally use of this should be shunned, except to use a FORTRAN routine or something similar...
virtual void resize()
Make this array a different shape.
const_contiter cbegin() const
Bool conform2(const ArrayBase &other) const
Are the shapes identical?
void increment()
Increment iterator for a non-contiguous array.
const T & operator*() const
Referenced counted pointer for constant data.
Array< T > reform(const IPosition &shape) const
It is occasionally useful to have an array which access the same storage appear to have a different s...
T value_type
Define the STL-style iterator functions (only forward iterator).
const Array< T > * itsArray
virtual Array< T > & operator=(const Array< T > &other)
Copy the values in other to this.
std::forward_iterator_tag iterator_category
BaseIteratorSTL(const Array< T > &)
Create the begin const_iterator object for an Array.
ptrdiff_t difference_type
void nonDegenerate(const Array< T > &other, const IPosition &ignoreAxes)
Array()
Result has dimensionality of zero, and nelements is zero.
const_iterator end() const
IteratorSTL operator++(int)
T * end_p
The end for an STL-style iteration.
T & operator()(const IPosition &)
Access a single element of the array.
ConstIteratorSTL(const Array< T > &arr)
Create the begin const_iterator object for an Array.
bool Bool
Define the standard types used by Casacore.
const IteratorSTL & operator++()
void removeDegenerate(uInt startingAxis=0, Bool throwIfError=True)
Remove degenerate axes from this Array object.
static constexpr ArrayInitPolicy INIT
Initialize all elements in the array with the default value.
T * begin_p
This pointer is adjusted to point to the first element of the array.
void freeVStorage(const void *&storage, Bool deleteIt) const
void apply(T(*function)(T))
Apply the function to every element of the array.
void setEndIter()
Set the end iterator.
std::forward_iterator_tag iterator_category
virtual void postTakeStorage()
template <class T, class U> class vector;
void baseMakeSteps()
Make the indexing step sizes.
const_contiter cend() const
Specify which elements to extract from an n-dimensional array.
COPY is used when an internal copy of the storage is to be made.
bool reformOrResize(const IPosition &newShape, uInt resizePercentage=0, Bool resizeIfNeeded=True)
Having an array that can be reused without requiring reallocation can be useful for large arrays...
virtual CountedPtr< ArrayBase > getSection(const Slicer &) const
Get a reference to a section of an array.
virtual void takeStorage(const IPosition &shape, T *storage, StorageInitPolicy policy=COPY)
Replace the data values with those in the pointer storage.
Array< T > nonDegenerate(uInt startingAxis=0, Bool throwIfError=True) const
These member functions remove degenerate (ie.
CountedPtr< Block< T > > data_p
Reference counted block that contains the storage.
const ConstIteratorSTL & operator++()
virtual CountedPtr< ArrayPositionIterator > makeIterator(uInt byDim) const
Create an ArrayIterator object of the correct type.
Bool conform(const Array< T > &other) const
Are the shapes identical?
void unique()
This ensures that this array does not reference any other storage.
bool operator==(const BaseIteratorSTL &other) const
const_iterator begin() const
this file contains all the compiler specific defines
LatticeExprNode value(const LatticeExprNode &expr)
This function returns the value of the expression without a mask.
virtual CountedPtr< ArrayBase > makeArray() const
Make an empty array of the same template type.
ConstIteratorSTL const_iterator
IteratorSTL(const T *end=0)
Create the end iterator object for an Array.
virtual void putVStorage(void *&storage, Bool deleteAndCopy)