28 #ifndef CASA_VECTOR_2_H
29 #define CASA_VECTOR_2_H
83 template<
typename T,
typename Alloc>
class Vector :
public Array<T, Alloc>
91 explicit Vector(
size_t Length);
92 explicit Vector(
const IPosition& Length);
98 Vector(
size_t Length,
const T &initialValue);
99 Vector(
const IPosition& Length,
const T &initialValue);
104 Vector(
size_t Length,
typename Array<T, Alloc>::uninitializedType,
const Alloc&
allocator=Alloc());
105 Vector(
const IPosition& Length,
typename Array<T, Alloc>::uninitializedType,
const Alloc&
allocator=Alloc());
111 Vector(
const std::vector<T> &other,
long long nr);
115 explicit Vector(
const std::vector<T> &other,
const Alloc&
allocator=Alloc());
118 Vector(std::initializer_list<T> list);
121 Vector(
const Vector<T, Alloc> &other);
124 Vector(Vector<T, Alloc>&& source) noexcept;
138 Vector(const IPosition &shape, const T *storage);
140 template<typename InputIterator>
141 Vector(InputIterator startIter, InputIterator endIter, const Alloc& allocator = Alloc());
148 template <typename U, typename V>
149 explicit
Vector(const std::vector<U, V> &other);
157 template<typename Iterator>
168 void resize(
size_t len,
bool copyValues=false)
170 virtual void resize(
const IPosition &len,
bool copyValues=
false) final override;
221 #if defined(AIPS_ARRAY_INDEX_CHECK)
229 #if defined(AIPS_ARRAY_INDEX_CHECK)
307 virtual bool ok() const final override;
314 const
IPosition &ignoreAxes) final override;
323 void initVector(
const std::vector<T>&,
long long nr);
329 template<
typename InputIterator>
330 Vector(InputIterator startIter, InputIterator endIter,
const Alloc&
allocator, std::false_type );
332 template<
typename InputIterator>
333 Vector(InputIterator startIter, InputIterator endIter,
const Alloc&
allocator, std::true_type );
338 #include "Vector.tcc"
339 #include "Vector2.tcc"
A Vector of integers, for indexing into Array<T> objects.
T & operator[](size_t index)
Convert a Vector to a Block, resizing the block and copying values.
A 1-D Specialization of the Array class.
const Array< T, Alloc > operator()(const IPosition &blc, const IPosition &trc) const
Vector< T, Alloc > & operator=(Vector< T, Alloc > &&source)
bool contiguous_p
Are the data contiguous?
size_t nelements() const
How many elements does this array have? Product of all axis lengths.
LatticeExprNode mask(const LatticeExprNode &expr)
This function returns the mask of the given expression.
void shape(int &Shape) const
Vector< T, Alloc > & operator=(Array< T, Alloc > &&source)
Array< T, Alloc > operator()(const IPosition &blc, const IPosition &trc)
StorageInitPolicy
A global enum used by some Array constructors.
Vector< T, Alloc > & assign_conforming_implementation(const Vector< T, Alloc > &v, std::false_type isCopyable)
Array(const Alloc &allocator=Alloc())
Result has dimensionality of zero, and nelements is zero.
Array< T, Alloc > operator()(const Slicer &slicer)
virtual bool ok() const finaloverride
Verify that dimensionality is 1 and then call Array<T>::ok()
const T & operator()(const IPosition &i) const
IPosition length_p
Used to hold the shape, increment into the underlying storage and originalLength of the array...
void initVector(const std::vector< T > &, long long nr)
Helper functions for constructors.
Class for masking an Array for operations on that Array.
T & operator()(size_t index)
void validateIndex(const IPosition &) const
T & operator()(const IPosition &)
Access a single element of the array.
T & operator()(const IPosition &i)
define a (start,length,increment) along an axis
const T & operator[](size_t index) const
T * begin_p
This pointer is adjusted to point to the first element of the array.
const Array< T, Alloc > operator()(const IPosition &blc, const IPosition &trc, const IPosition &incr) const
virtual size_t fixedDimensionality() const finaloverride
Subclasses can return their dimensionality.
Alloc & allocator()
Retrieve the allocator associated with this array.
const IPosition & shape() const
The length of the Vector.
Vector()
A zero-length Vector.
A templated N-D Array class with zero origin. Array<T, Alloc> is a templated, N-dimensional, Array class. The origin is zero, but by default indices are zero-based. This Array class is the base class for the Vector, Matrix, and Cube subclasses.
Vector< T, Alloc > & operator=(const Vector< T, Alloc > &source)
Specify which elements to extract from an n-dimensional array.
COPY is used when an internal copy of the storage is to be made.
Vector< T, Alloc > & operator=(const Array< T, Alloc > &source)
const T & operator()(size_t index) const
virtual void doNonDegenerate(const Array< T > &other, const IPosition &ignoreAxes) finaloverride
Remove the degenerate axes from other and store result in this vector.
void resize()
Make this array a different shape.
Array< T, Alloc > operator()(const IPosition &blc, const IPosition &trc, const IPosition &incr)
Slice using IPositions.
Vector< T, Alloc > & assign_conforming(const Vector< T, Alloc > &source)
const Array< T, Alloc > operator()(const Slicer &slicer) const