28 #ifndef CASA_VECTOR_2_H
29 #define CASA_VECTOR_2_H
83 template<
typename T,
typename Alloc>
class Vector :
public Array<T, Alloc>
98 Vector(
size_t Length,
const T &initialValue);
111 Vector(
const std::vector<T> &other,
long long nr);
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)
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;
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"
void validateIndex(const IPosition &) const
size_t nelements() const
How many elements does this array have? Product of all axis lengths.
bool contiguous_p
Are the data contiguous?
IPosition length_p
Used to hold the shape, increment into the underlying storage and originalLength of the array.
T & operator()(const IPosition &)
Access a single element of the array.
void resize()
Make this array a different shape.
T * begin_p
This pointer is adjusted to point to the first element of the array.
Alloc & allocator()
Retrieve the allocator associated with this array.
Vector(InputIterator startIter, InputIterator endIter, const Alloc &allocator=Alloc())
Array< T, Alloc > operator()(const IPosition &blc, const IPosition &trc, const IPosition &incr)
Slice using IPositions.
T & operator()(size_t index)
Vector(const std::vector< T > &other, long long nr)
Create a Vector from the given std::vector "other." Make it length "nr" and copy over that many eleme...
const Array< T, Alloc > operator()(const IPosition &blc, const IPosition &trc, const IPosition &incr) const
Vector< T, Alloc > & assign_conforming(Vector< T, Alloc > &&source)
void shape(int &Shape) const
Array< T, Alloc > operator()(const Slicer &slicer)
Vector(const Vector< T, Alloc > &other)
Create a reference to other.
const Vector< T, Alloc > operator()(const Slice &slice) const
Vector()
A zero-length Vector.
Vector< T, Alloc > operator()(const Slice &slice)
Take a slice of this vector.
const Array< T, Alloc > operator()(const Slicer &slicer) const
Array< T, Alloc > operator()(const IPosition &blc, const IPosition &trc)
Vector< T, Alloc > & assign_conforming_implementation(const Vector< T, Alloc > &v, std::false_type isCopyable)
Vector(const IPosition &Length)
const T & operator()(size_t index) const
Vector< T, Alloc > & assign_conforming(const Vector< T, Alloc > &source)
Vector(InputIterator startIter, InputIterator endIter, const Alloc &allocator, std::false_type)
The following two constructors are used to make distinguish between Vector<literal>(literal size,...
const T & operator[](size_t index) const
Vector(const IPosition &Length, typename Array< T, Alloc >::uninitializedType, const Alloc &allocator=Alloc())
Vector(Iterator first, size_t size, int dummy)
Create a Vector from a container iterator and its length.
Vector< T, Alloc > & operator=(const Vector< T, Alloc > &source)
Vector(const IPosition &shape, T *storage, StorageInitPolicy policy=COPY)
Create an Vector of a given shape from a pointer.
Vector(const IPosition &Length, const T &initialValue)
Vector< T, Alloc > & assign_conforming(const Array< T, Alloc > &source)
source must be a 1-dimensional array.
T & operator()(const IPosition &i)
Vector(Vector< T, Alloc > &&source) noexcept
Move.
Vector< T, Alloc > & operator=(Array< T, Alloc > &&source)
Vector< T, Alloc > & assign_conforming(Array< T, Alloc > &&source)
Vector< T, Alloc > & assign_conforming_implementation(const Vector< T, Alloc > &v, std::true_type isCopyable)
const IPosition & shape() const
The length of the Vector.
const Array< T, Alloc > operator()(const IPosition &blc, const IPosition &trc) const
Vector(const std::vector< U, V > &other)
Create a Vector from an STL vector (see tovector() in Array for the reverse operation).
Vector(const IPosition &shape, const T *storage)
Create an Vector of a given shape from a pointer.
virtual bool ok() const final override
Verify that dimensionality is 1 and then call Array<T>::ok()
virtual void resize(const IPosition &len, bool copyValues=false) final override
Resize the array and optionally copy the values.
Vector< T, Alloc > & operator=(const Array< T, Alloc > &source)
virtual size_t fixedDimensionality() const final override
Subclasses can return their dimensionality.
Vector(size_t Length)
A Vector with a defined length and origin of zero.
Vector(const IPosition &shape, T *storage, StorageInitPolicy policy, Alloc &allocator)
Create an Vector of a given shape from a pointer.
Vector< T, Alloc > & operator=(Vector< T, Alloc > &&source)
const T & operator()(const IPosition &i) const
Vector(const Array< T, Alloc > &other)
Create a reference to the other array.
void initVector(const std::vector< T > &, long long nr)
Helper functions for constructors.
Vector(const std::vector< T > &other, const Alloc &allocator=Alloc())
Create a Vector of length other.size() and copy over its values.
Vector(std::initializer_list< T > list)
Create a Vector from an initializer list.
Vector(InputIterator startIter, InputIterator endIter, const Alloc &allocator, std::true_type)
T & operator[](size_t index)
Convert a Vector to a Block, resizing the block and copying values.
virtual void doNonDegenerate(const Array< T > &other, const IPosition &ignoreAxes) final override
Remove the degenerate axes from other and store result in this vector.
Vector(size_t Length, const T &initialValue)
A Vector with a defined length and origin of zero.
Vector(size_t Length, typename Array< T, Alloc >::uninitializedType, const Alloc &allocator=Alloc())
An uninitialized Vector with a defined length.
void resize(size_t len, bool copyValues=false)
@ COPY
COPY is used when an internal copy of the storage is to be made.
this file contains all the compiler specific defines
LatticeExprNode mask(const LatticeExprNode &expr)
This function returns the mask of the given expression.
This is a tag for the constructor that may be used to construct an uninitialized Array.