Go to the documentation of this file.
28 #ifndef CASA_IPOSITION_H
29 #define CASA_IPOSITION_H
32 #include <casacore/casa/aips.h>
33 #include <casacore/casa/iosfwd.h>
34 #include <casacore/casa/BasicSL/String.h>
37 #include <sys/types.h>
44 template<
class T>
class Array;
45 template<
class T>
class Vector;
184 template<
typename InputIterator>
188 for (
uInt i=0; i<
size; ++i, ++iter) {
195 template<
typename OutputIterator>
196 void copy (OutputIterator iter)
const
256 const ssize_t *
storage()
const;
569 #if defined(AIPS_ARRAY_INDEX_CHECK)
579 #if defined(AIPS_ARRAY_INDEX_CHECK)
589 #if defined(AIPS_ARRAY_INDEX_CHECK)
590 if (
size_p - index <= 0) {
599 #if defined(AIPS_ARRAY_INDEX_CHECK)
600 if (
size_p - index <= 0) {
void operator/=(const IPosition &other)
LatticeExprNode operator+(const LatticeExprNode &expr)
Global functions operating on a LatticeExprNode.
IPosition nonDegenerate(uInt startingAxis=0) const
This member functions return an IPosition which has degenerate (length==1) axes removed and the dimen...
friend std::ostream & operator<<(std::ostream &os, const IPosition &ip)
Write an IPosition to an ostream in a simple text form.
Bool isEqual(const IPosition &other, Bool skipDegeneratedAxes) const
Element-by-element comparison for equality.
Bool operator==(const IPosition &left, const IPosition &right)
Each operation is done on corresponding elements of the IPositions.
const ssize_t * const_iterator
IPosition & operator=(ssize_t value)
Copy "value" into every position of this IPosition.
bool operator!=(const casacore_allocator< T, ALIGNMENT > &, const casacore_allocator< T, ALIGNMENT > &)
IPosition nonDegenerate(const IPosition &ignoreAxes) const
IPosition min(const IPosition &left, const IPosition &right)
static IPosition makeAxisPath(uInt nrdim, const IPosition &partialPath)
Construct a full axis path from a (partially) given axis path.
Bool empty() const
Is the IPosition empty (i.e.
friend AipsIO & operator<<(AipsIO &aio, const IPosition &ip)
Write an IPosition to an AipsIO stream in a binary format.
Bool isSubSet(const IPosition &other) const
Is the other IPosition a subset of (or equal to) this IPosition? It is a subset if zero or more axes ...
static IPosition makeAxisPath(uInt nrdim)
Construct a default axis path consisting of the values 0.
ssize_t buffer_p[BufferLength]
const ssize_t * storage() const
Get the storage.
bool operator()(const IPosition &lhs, const IPosition &rhs) const
allows a way for IPosition to be used as keys in a std::map
LatticeExprNode operator>=(const LatticeExprNode &left, const LatticeExprNode &right)
Bool operator>=(const IPosition &left, const IPosition &right)
friend AipsIO & operator>>(AipsIO &aio, IPosition &ip)
Read an IPosition from an AipsIO stream in a binary format.
LatticeExprNode operator<(const LatticeExprNode &left, const LatticeExprNode &right)
IPosition operator/(const IPosition &left, const IPosition &right)
Logical operations for IPosition's Element by element boolean operations on IPositions.
void throwIndexError() const
Throw an index error exception.
Bool operator!=(const IPosition &left, const IPosition &right)
IPosition operator-(const IPosition &left, const IPosition &right)
const_iterator end() const
void fill(uInt size, InputIterator iter)
Resize and fill this IPosition object.
Bool isInsideArray(const Int64 offset, const IPosition &shape)
Determine if the given offset or IPosition is inside the array.
IPosition getLast(uInt n) const
Construct an IPosition from the last n values of this IPosition.
Bool conform(const IPosition &other) const
conform returns true if nelements() == other.nelements().
bool operator==(const casacore_allocator< T, ALIGNMENT > &, const casacore_allocator< T, ALIGNMENT > &)
void operator*=(const IPosition &other)
IPosition(uInt length)
An IPosition of size "length." The values in the object are undefined.
IPosition removeAxes(const IPosition &axes) const
Return an IPosition where the given axes are reoved.
LatticeExprNode value(const LatticeExprNode &expr)
This function returns the value of the expression without a mask.
Bool operator<(const IPosition &left, const IPosition &right)
IPosition operator+(const IPosition &left, const IPosition &right)
Each operation is done on corresponding elements of the IPositions.
IPosition(uInt length, ssize_t val0, ssize_t val1, ssize_t val2=MIN_INT, ssize_t val3=MIN_INT, ssize_t val4=MIN_INT, ssize_t val5=MIN_INT, ssize_t val6=MIN_INT, ssize_t val7=MIN_INT, ssize_t val8=MIN_INT, ssize_t val9=MIN_INT)
An IPosition of size "length" with defined values.
void operator-=(const IPosition &other)
void setFirst(const IPosition &other)
Set the first values of this IPosition to another IPosition.
TableExprNode shape(const TableExprNode &array)
Function operating on any scalar or array resulting in a Double array containing the shape.
Indexing functions for IPosition's Convert between IPosition and offset in an array.
ssize_t value_type
Define the STL-style iterators.
void allocateBuffer()
Allocate a buffer with length size_p.
LatticeExprNode operator/(const LatticeExprNode &left, const LatticeExprNode &right)
Bool isEqual(const IPosition &other) const
Element-by-element comparison for equality.
const value_type * const_pointer
ssize_t * data_p
When the iposition is length BufferSize or less data is just buffer_p, avoiding calls to new and dele...
ssize_t & last(uInt index=0)
Index into the IPosition from the end.
String toString() const
Write the IPosition into a String.
this file contains all the compiler specific defines
Bool allOne() const
Are all elements equal to 1? Useful to check if a given stride is really a stride.
Bool operator>(const IPosition &left, const IPosition &right)
Bool isEqual(const IPosition &other, uInt nrCompare) const
Element-by-element comparison for (partial) equality.
IPosition max(const IPosition &left, const IPosition &right)
Returns the element by element minimum or maximum.
LatticeExprNode length(const LatticeExprNode &expr, const LatticeExprNode &axis)
2-argument function to get the length of an axis.
void copy(OutputIterator iter) const
Copy the contents of this IPosition object to the output iterator.
IPosition(const std::vector< Int > &other)
Convert an IPosition to and from an Array<Int>.
uInt nelements() const
The number of elements in this IPosition.
std::vector< Int > asStdVector() const
IPosition toIPositionInArray(Int64 offset, const IPosition &shape)
Convert from offset to IPosition in an array.
IPosition & operator=(const IPosition &other)
Makes this a copy of other.
Bool isInsideArray(const IPosition &iposition, const IPosition &shape)
IPosition(const Array< Int > &other)
Convert an IPosition to and from an Array<Int>.
IPosition()
A zero-length IPosition.
ssize_t & operator()(uInt index)
static IPosition otherAxes(uInt nrdim, const IPosition &axes)
Make a list of axes which are the axes not given in axes up to the given dimension.
ptrdiff_t difference_type
friend LogIO & operator<<(LogIO &io, const IPosition &ip)
Write an IPosition to a LogIO stream.
long long Int64
Define the extra non-standard types used by Casacore (like proposed uSize, Size)
const_iterator begin() const
void operator+=(const IPosition &other)
Element-by-element arithmetic.
const value_type & const_reference
iterator begin()
Get the begin and end iterator object for this object.
LatticeExprNode operator<=(const LatticeExprNode &left, const LatticeExprNode &right)
String: the storage and methods of handling collections of characters.
IPosition(const IPosition &other)
Makes a copy (copy, NOT reference, semantics) of other.
Bool ok() const
Is this IPosition consistent?
bool Bool
Define the standard types used by Casacore.
Bool operator<=(const IPosition &left, const IPosition &right)
Arithmetic Operations for IPosition's Element by element arithmetic on IPositions.
void setLast(const IPosition &other)
Set the last values of this IPosition to another IPosition.
void append(const IPosition &other)
Append this IPosition with another one (causing a resize).
MVBaseline operator*(const RotMatrix &left, const MVBaseline &right)
Rotate a Baseline vector with rotation matrix and other multiplications.
LatticeExprNode operator>(const LatticeExprNode &left, const LatticeExprNode &right)
void resize(uInt newSize, Bool copy=True)
Old values are copied on resize if copy==True.
IPosition operator*(const IPosition &left, const IPosition &right)
LatticeExprNode operator-(const LatticeExprNode &expr)
IPosition keepAxes(const IPosition &axes) const
Return an IPosition containing the given axes only.
void prepend(const IPosition &other)
Prepend this IPosition with another one (causing a resize).
IPosition(uInt length, ssize_t val)
An IPosition of size "length." The values in the object get initialized to val.
Int64 toOffsetInArray(const IPosition &iposition, const IPosition &shape)
Convert from IPosition to offset in an array.
IPosition getFirst(uInt n) const
Construct an IPosition from the first n values of this IPosition.
Vector< Int > asVector() const
Int64 product() const
Returns 0 if nelements() == 0, otherwise it returns the product of its elements.
IPosition concatenate(const IPosition &other) const
Return an IPosition as the concetanation of this and another IPosition.
ssize_t & operator[](uInt index)
Index into the IPosition.