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 #if defined(WHATEVER_VECTOR_FORWARD_DEC) 45 #include <casacore/casa/stdvector.h> 259 void set(
const T &
value);
265 void apply(T (*
function)(T));
268 void apply(T (*
function)(
const T &));
379 void tovector(vector<T, U> &out)
const;
426 uInt resizePercentage = 0,
441 uInt resizePercentage = 0,
442 bool resizeIfNeeded =
True);
689 class BaseIteratorSTL
721 {
return const_cast<T*
>(
itsPos); }
724 { os << iter.
itsPos;
return os; }
773 {
return *this->
getPos(); }
775 {
return this->
getPos(); }
861 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)
virtual Bool ok() const
Check to see if the Array is consistent.
virtual void assignBase(const ArrayBase &other, Bool checkType=True)
Assign the source array to this array.
const_iterator end() const
Non-templated base class for templated Array class.
void putStorage(T *&storage, Bool deleteAndCopy)
putStorage() is normally called after a call to getStorage() (cf).
static ArrayInitPolicy defaultArrayInitPolicy()
static void copyToContiguousStorage(T *dst, Array< T > const &src, ArrayInitPolicy policy)
const_iterator begin() 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.
Allocator_private::BulkAllocator< T > * nonNewDelAllocator() const
If the current allocator is NewDelAllocator<T>, BulkAllocator for DefaultAllocator<T> is returned...
LatticeExprNode mask(const LatticeExprNode &expr)
This function returns the mask of the given expression.
ConstIteratorSTL(const IteratorSTL &iter)
Create from a non-const iterator.
IPosition steps_p
Used to hold the step to next element in each dimension.
static ArrayInitPolicy const NO_INIT
Don't initialize elements in the array.
Array< T > nonDegenerate(uInt startingAxis=0, Bool throwIfError=True) const
These member functions remove degenerate (ie.
const_contiter cbegin() const
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.
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
Array< T > copy(ArrayInitPolicy policy=ArrayInitPolicy::NO_INIT) const
This makes a copy of the array and returns it.
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...
A 2-D Specialization of the Array class.
iterator begin()
Get the begin iterator object for any 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.
#define WHATEVER_VECTOR_FORWARD_DEC
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 CountedPtr< ArrayPositionIterator > makeIterator(uInt byDim) const
Create an ArrayIterator object of the correct type.
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...
Bool conform(const Array< T > &other) const
Are the shapes identical?
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.
bool operator!=(const BaseIteratorSTL &other) const
virtual CountedPtr< ArrayBase > getSection(const Slicer &) const
Get a reference to a section of an array.
Array< T > operator[](size_t i) const
Get the subset given by the i-th value of the last axis.
void increment()
Increment iterator for a non-contiguous array.
Referenced counted pointer for constant data.
T value_type
Define the STL-style iterator functions (only forward iterator).
uInt ndim() const
The dimensionality of this array.
bool operator==(const BaseIteratorSTL &other) const
const Array< T > * itsArray
static ArrayInitPolicy const INIT
Initialize all elements in the array with the default value.
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.
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.
const_contiter cend() const
vector< T > tovector() const
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.
T * begin_p
This pointer is adjusted to point to the first element of the array.
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.
Specify which elements to extract from an n-dimensional array.
Bool conform2(const ArrayBase &other) const
Are the shapes identical?
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...
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...
const T & operator*() const
virtual void takeStorage(const IPosition &shape, T *storage, StorageInitPolicy policy=COPY)
Replace the data values with those in the pointer storage.
CountedPtr< Block< T > > data_p
Reference counted block that contains the storage.
virtual CountedPtr< ArrayBase > makeArray() const
Make an empty array of the same template type.
const ConstIteratorSTL & operator++()
const Array< T > addDegenerate(uInt numAxes) const
This member function returns an Array reference with the specified number of extra axes...
void unique()
This ensures that this array does not reference any other storage.
uInt nrefs() const
The number of references the underlying storage has assigned to it.
void freeStorage(const T *&storage, Bool deleteIt) const
If deleteIt is set, delete "storage".
void freeVStorage(const void *&storage, Bool deleteIt) const
this file contains all the compiler specific defines
const T * getStorage(Bool &deleteIt) const
LatticeExprNode value(const LatticeExprNode &expr)
This function returns the value of the expression without a mask.
size_t capacity() const
Returns the number of elements allocated.
const IPosition & shape() const
The length of each axis.
ConstIteratorSTL const_iterator
IteratorSTL(const T *end=0)
Create the end iterator object for an Array.
virtual void putVStorage(void *&storage, Bool deleteAndCopy)