Go to the documentation of this file.
32 #include <casacore/casa/aips.h>
33 #include <casacore/casa/Arrays/Array.h>
37 #include <casacore/casa/stdvector.h>
88 template<
class T>
class Vector :
public Array<T>
96 explicit Vector(
size_t Length);
97 Vector(
size_t Length, ArrayInitPolicy initPolicy);
98 explicit Vector(
const IPosition& Length);
99 Vector(
const IPosition& Length, ArrayInitPolicy initPolicy);
105 Vector(
size_t Length,
const T &initialValue);
106 Vector(
const IPosition& Length,
const T &initialValue);
113 explicit Vector(
const Block<T> &other);
116 Vector(
const Vector<T> &other);
122 Vector(
const Array<T> &other);
137 template <
class U,
class V>
138 Vector(
const vector<U, V> &other);
146 template<
typename Iterator>
154 virtual void assign (
const Array<T>& other);
157 virtual void reference(
const Array<T> &other);
204 {
return (this->contiguous_p ? this->begin_p[index] : this->begin_p[index*this->inc_p(0)]); }
206 {
return (this->contiguous_p ? this->begin_p[index] : this->begin_p[index*this->inc_p(0)]); }
213 #if defined(AIPS_ARRAY_INDEX_CHECK)
214 this->validateIndex(index);
216 return *(this->begin_p + index*this->inc_p(0));
221 #if defined(AIPS_ARRAY_INDEX_CHECK)
222 this->validateIndex(index);
224 return *(this->begin_p + index*this->inc_p(0));
294 {
return this->length_p; }
296 { Shape = this->length_p(0); }
316 extern template class Vector<Bool>;
317 extern template class Vector<Char>;
318 extern template class Vector<Short>;
319 extern template class Vector<uShort>;
320 extern template class Vector<Int>;
321 extern template class Vector<uInt>;
322 extern template class Vector<Int64>;
323 extern template class Vector<Float>;
324 extern template class Vector<Double>;
325 extern template class Vector<Complex>;
326 extern template class Vector<DComplex>;
327 extern template class Vector<String>;
332 #ifndef CASACORE_NO_AUTO_TEMPLATES
333 #include <casacore/casa/Arrays/Vector.tcc>
334 #include <casacore/casa/Arrays/Vector2.tcc>
335 #endif //# CASACORE_NO_AUTO_TEMPLATES
Array< T > & operator=(const T &val)
Set every element of this Vector to Val.
Specify which elements to extract from an n-dimensional array.
void shape(Int &Shape) const
virtual ~Vector()
Define a destructor, otherwise the compiler makes a static one.
Vector< T > & operator=(const Vector< T > &other)
Assign to this Vector.
A Vector of integers, for indexing into Array<T> objects.
void toBlock(Block< T > &other) const
Convert a Vector to a Block, resizing the block and copying values.
T & operator()(size_t index)
StorageInitPolicy
A global enum used by some Array constructors.
const Array< T > operator()(const Slicer &slicer) const
const Array< T > operator()(const IPosition &blc, const IPosition &trc) const
virtual void preTakeStorage(const IPosition &shape)
Array< T > operator()(const IPosition &blc, const IPosition &trc, const IPosition &incr)
Slice using IPositions.
virtual void resize()
Make this array a different shape.
const T & operator()(size_t index) const
LatticeExprNode nelements(const LatticeExprNode &expr)
1-argument function to get the number of elements in a lattice.
A global enum used by some Array/Block constructors.
void resize(size_t len, Bool copyValues=False)
virtual void reference(const Array< T > &other)
Create a reference to "other", which must be of dimension one.
void initVector(const Block< T > &, Int64 nr)
Helper functions for constructors.
const IPosition & shape() const
The length of the Vector.
T & operator()(const IPosition &i)
Array< T > operator()(const Slicer &slicer)
T & operator()(const IPosition &)
Access a single element of the array.
@ COPY
COPY is used when an internal copy of the storage is to be made.
virtual Array< T > & operator=(const Array< T > &other)
Copy the values in other to this.
define a (start,length,increment) along an axis
this file contains all the compiler specific defines
const Array< T > operator()(const IPosition &blc, const IPosition &trc, const IPosition &incr) const
void resize(size_t len, Bool copyValues, ArrayInitPolicy policy)
Class for masking an Array for operations on that Array.
long long Int64
Define the extra non-standard types used by Casacore (like proposed uSize, Size)
LatticeExprNode mask(const LatticeExprNode &expr)
This function returns the mask of the given expression.
TableExprNode marray(const TableExprNode &array, const TableExprNode &mask)
Form a masked array.
const T & operator[](size_t index) const
virtual Bool ok() const
Verify that dimensionality is 1 and then call Array<T>::ok()
template <class T, class U> class vector;
const T & operator()(const IPosition &i) const
T & operator[](size_t index)
Single-pixel addressing.
bool Bool
Define the standard types used by Casacore.
Vector()
A zero-length Vector.
A 1-D Specialization of the Array class.
virtual void assign(const Array< T > &other)
Assign the other array (which must be of dimension one) to this vector.
Array< T > operator()(const IPosition &blc, const IPosition &trc)
virtual void doNonDegenerate(const Array< T > &other, const IPosition &ignoreAxes)
Remove the degenerate axes from other and store result in this vector.