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;
179 IPosition(
const std::vector<Int>& other);
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)
A Vector of integers, for indexing into Array<T> objects.
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.
AipsIO is the object persistency mechanism of Casacore
Bool operator==(const IPosition &left, const IPosition &right)
Each operation is done on corresponding elements of the IPositions.
bool operator!=(const casacore_allocator< T, ALIGNMENT > &, const casacore_allocator< T, ALIGNMENT > &)
IPosition min(const IPosition &left, const IPosition &right)
Bool empty() const
Is the IPosition empty (i.e.
const typedef value_type & const_reference
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....
const typedef ssize_t * const_iterator
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().
const typedef value_type * const_pointer
bool operator==(const casacore_allocator< T, ALIGNMENT > &, const casacore_allocator< T, ALIGNMENT > &)
ostream-like interface to creating log messages.
void operator*=(const IPosition &other)
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)
LatticeExprNode max(const LatticeExprNode &left, const LatticeExprNode &right)
IPosition operator+(const IPosition &left, const IPosition &right)
Each operation is done on corresponding elements of the IPositions.
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.
LatticeExprNode min(const LatticeExprNode &left, const LatticeExprNode &right)
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)
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.
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.
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
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.
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.
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).
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.