A two-dimensional sequence class with lazy copying and reference counting. More...
#include <Sequence2.hpp>
Public Types | |
typedef T | ElemType |
The type of the element in the sequence. More... | |
typedef Array2< T >::ConstIterator | ConstIterator |
The const iterator for all elements in the sequence. More... | |
typedef Array2< T >::Iterator | Iterator |
The mutable iterator for all elements in the sequence. More... | |
typedef Array2< T >::ConstXIterator | ConstXIterator |
The const iterator for the elements in a row of the sequence. More... | |
typedef Array2< T >::XIterator | XIterator |
The mutable iterator for the elements in a row of the sequence. More... | |
typedef Array2< T >::ConstYIterator | ConstYIterator |
The const iterator for the elements in a column of the sequence. More... | |
typedef Array2< T >::YIterator | YIterator |
The mutable iterator for the elements in a column of the sequence. More... | |
Public Member Functions | |
Sequence2 () | |
The default constructor. More... | |
Sequence2 (int startX, int startY, int width, int height) | |
Construct a sequence with the specified start index and size. More... | |
Sequence2 (int startX, int startY, int width, int height, const T &data) | |
Construct a sequence with the specified start index and size, with all elements set to the given value. More... | |
template<class InputIterator > | |
Sequence2 (int startX, int startY, int width, int height, InputIterator data) | |
Construct a sequence with the specified start index and size, with the elements initialized to the data read from the given iterator. More... | |
Sequence2 (const Sequence2 &f) | |
The copy constructor. More... | |
template<class OtherT > | |
Sequence2 (const Sequence2< OtherT > &f) | |
Create a sequence from another sequence having elements of a different type. More... | |
Sequence2 (const Array2< T > &data) | |
Create a sequence from an array. More... | |
Sequence2 (int startX, int startY, const Array2< T > &data) | |
Create a sequence from an array using the given starting index. More... | |
~Sequence2 () | |
The destructor. More... | |
Sequence2 & | operator= (const Sequence2 &f) |
The assignment operator. More... | |
template<class OtherT > | |
Sequence2 & | operator= (const Sequence2< OtherT > &f) |
Assign another sequence with elements of a different type to this sequence. More... | |
Sequence2 & | operator+= (const Sequence2 &f) |
Add another sequence to this one. More... | |
Sequence2 & | operator-= (const Sequence2 &f) |
Subtract another sequence from this one. More... | |
Sequence2 & | operator*= (const Sequence2 &f) |
Multiply elementwise this sequence by another one. More... | |
Sequence2 & | operator/= (const Sequence2 &f) |
Divide elementwise this sequence by another one. More... | |
Sequence2 & | operator+= (const T &value) |
Add a value to each element of this sequence. More... | |
Sequence2 & | operator-= (const T &value) |
Subtract a value from each element of this sequence. More... | |
Sequence2 & | operator*= (const T &value) |
Multiply each element of this sequence by the specified value. More... | |
Sequence2 & | operator/= (const T &value) |
Divide each element of the sequence by the given value. More... | |
int | getStartX () const |
Get the x-coordinate of the start index for the sequence. More... | |
int | getStartY () const |
Get the y-coordinate of the start index for the sequence. More... | |
int | getEndX () const |
Get the x-coordinate of the end index for the sequence. More... | |
int | getEndY () const |
Get the y-coordinate of the end index for the sequence. More... | |
int | getWidth () const |
Get the width of the sequence. More... | |
int | getHeight () const |
Get the height of the sequence. More... | |
int | getSize () const |
Get the number of elements in the sequence. More... | |
bool | isShared () const |
Is the array for this sequence shared with another array? More... | |
T & | operator() (int x, int y) |
Get a mutable reference to the specified element in the sequence. More... | |
const T & | operator() (int x, int y) const |
Get a const reference to the specified element in the sequence. More... | |
ConstIterator | begin () const |
Get a const iterator for the first element in the sequence. More... | |
Iterator | begin () |
Get a mutable iterator for the first element in the sequence. More... | |
ConstIterator | end () const |
Get a const iterator for one past the last element in the sequence. More... | |
Iterator | end () |
Get a mutable iterator for one past the last element in the sequence. More... | |
ConstXIterator | rowBegin (int y) const |
Get a const iterator for the first element in the specified row of the sequence. More... | |
XIterator | rowBegin (int y) |
Get a mutable iterator for the first element in the specified row of the sequence. More... | |
ConstXIterator | rowEnd (int y) const |
Get a const iterator for one past the end in the specified row of the sequence. More... | |
XIterator | rowEnd (int y) |
Get a mutable iterator for one past the end in the specified row of the sequence. More... | |
ConstYIterator | colBegin (int x) const |
Get a const iterator for the first element in the specified column of the sequence. More... | |
YIterator | colBegin (int x) |
Get a mutable iterator for the first element in the specified column of the sequence. More... | |
ConstYIterator | colEnd (int x) const |
Get a const iterator for one past the end in the specified column of the sequence. More... | |
YIterator | colEnd (int x) |
Get a mutable iterator for one past the end in the specified column of the sequence. More... | |
T | min () const |
Get the minimum element in the sequence. More... | |
T | max () const |
Get the maximum element in the sequence. More... | |
T | sum () const |
Get the sum of the elements in the sequence. More... | |
std::ostream & | output (std::ostream &out, int fieldWidth) const |
Output a sequence to the specified stream using the given field width for each sequence element. More... | |
Array2< T > | getArray () const |
Get a copy of the underlying array. More... | |
void | swapArray (Array2< T > &data) |
Swap the data for the underlying array and the specified array. More... | |
void | fill (const T &value) |
Get a copy of the underlying array. More... | |
Sequence2 & | translate (int x, int y) |
Translate (i.e., shift) a sequence by the specified displacement. More... | |
A two-dimensional sequence class with lazy copying and reference counting.
typedef Array2<T>::ConstIterator SPL::Sequence2< T >::ConstIterator |
The const iterator for all elements in the sequence.
typedef Array2<T>::ConstXIterator SPL::Sequence2< T >::ConstXIterator |
The const iterator for the elements in a row of the sequence.
typedef Array2<T>::ConstYIterator SPL::Sequence2< T >::ConstYIterator |
The const iterator for the elements in a column of the sequence.
typedef T SPL::Sequence2< T >::ElemType |
The type of the element in the sequence.
typedef Array2<T>::Iterator SPL::Sequence2< T >::Iterator |
The mutable iterator for all elements in the sequence.
typedef Array2<T>::XIterator SPL::Sequence2< T >::XIterator |
The mutable iterator for the elements in a row of the sequence.
typedef Array2<T>::YIterator SPL::Sequence2< T >::YIterator |
The mutable iterator for the elements in a column of the sequence.
SPL::Sequence2< T >::Sequence2 | ( | int | startX, |
int | startY, | ||
int | width, | ||
int | height, | ||
InputIterator | data | ||
) |
Construct a sequence with the specified start index and size, with the elements initialized to the data read from the given iterator.
SPL::Sequence2< T >::Sequence2 | ( | const Sequence2< OtherT > & | f | ) |
Create a sequence from another sequence having elements of a different type.
Sequence2& SPL::Sequence2< T >::operator= | ( | const Sequence2< OtherT > & | f | ) |
Assign another sequence with elements of a different type to this sequence.
The type OtherT must be assignable to the type T.