A one-dimensional sequence class with lazy copying and reference counting. More...
#include <Sequence1.hpp>
Public Types | |
typedef T | ElemType |
The type of the element in the sequence. More... | |
typedef Array1< T >::ConstIterator | ConstIterator |
The const iterator for the sequence. More... | |
typedef Array1< T >::Iterator | Iterator |
The mutable iterator for the sequence. More... | |
Public Member Functions | |
Sequence1 () | |
The default constructor. More... | |
Sequence1 (int startInd, int size) | |
Construct a sequence with the specified start index and size. More... | |
Sequence1 (int startInd, int size, const T &value) | |
Construct a sequence with the specified start index and size, with all elements set to the given value. More... | |
template<class InputIterator > | |
Sequence1 (int startInd, int size, 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... | |
Sequence1 (const Sequence1 &f) | |
The copy constructor. More... | |
template<class OtherT > | |
Sequence1 (const Sequence1< OtherT > &f) | |
Create a sequence from another sequence having elements of a different type. More... | |
Sequence1 (const Array1< T > &data) | |
Create a sequence from an array. More... | |
Sequence1 (int startInd, const Array1< T > &data) | |
Create a sequence from an array using the given starting index. More... | |
~Sequence1 () | |
The destructor. More... | |
Sequence1 & | operator= (const Sequence1 &f) |
The assignment operator. More... | |
template<class OtherT > | |
Sequence1 & | operator= (const Sequence1< OtherT > &f) |
Assign another sequence with elements of a different type to this sequence. More... | |
Sequence1 & | operator+= (const Sequence1 &f) |
Add another sequence to this one. More... | |
Sequence1 & | operator-= (const Sequence1 &f) |
Subtract another sequence from this one. More... | |
Sequence1 & | operator*= (const Sequence1 &f) |
Multiply elementwise this sequence by another one. More... | |
Sequence1 & | operator/= (const Sequence1 &f) |
Divide elementwise this sequence by another one. More... | |
Sequence1 & | operator+= (const T &value) |
Add a value to each element of this sequence. More... | |
Sequence1 & | operator-= (const T &value) |
Subtract a value from each element of this sequence. More... | |
Sequence1 & | operator*= (const T &value) |
Multiply each element of this sequence by the specified value. More... | |
Sequence1 & | operator/= (const T &value) |
Divide each element of the sequence by the given value. More... | |
int | getStartInd () const |
Get the start index for the sequence. More... | |
int | getEndInd () const |
Get the end index for the sequence. More... | |
int | getSize () const |
Get the length of the sequence. More... | |
bool | isShared () const |
Is the array for this sequence shared with another array? More... | |
const T & | operator() (int i) const |
Get the specified element in the sequence. More... | |
T & | operator() (int i) |
Get the specified element in the sequence. More... | |
ConstIterator | begin () const |
Get an iterator referencing the first element in the sequence. More... | |
Iterator | begin () |
Get an iterator referencing the first element in the sequence. More... | |
ConstIterator | end () const |
Get an iterator referencing just after the last element in the sequence. More... | |
Iterator | end () |
Get an iterator referencing just after the last element in 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... | |
Array1< T > | getArray () const |
Get a copy of the underlying array. More... | |
void | swapArray (Array1< T > &data) |
Swap the data for the underlying array and the specified array. More... | |
void | fill (const T &value) |
Set all of the elements in the sequence to the specified value. More... | |
Sequence1 & | translate (int delta) |
Translate (i.e., shift) a sequence by the specified displacement. More... | |
A one-dimensional sequence class with lazy copying and reference counting.
typedef Array1<T>::ConstIterator SPL::Sequence1< T >::ConstIterator |
The const iterator for the sequence.
typedef T SPL::Sequence1< T >::ElemType |
The type of the element in the sequence.
typedef Array1<T>::Iterator SPL::Sequence1< T >::Iterator |
The mutable iterator for the sequence.
SPL::Sequence1< T >::Sequence1 | ( | int | startInd, |
int | size, | ||
InputIterator | data | ||
) |
Construct a sequence with the specified start index and size, with the elements initialized to the data read from the given iterator.
Effects: A sequence with a starting index of startInd and size size is created, with the elements being initialized by the data pointed to by data.
SPL::Sequence1< T >::Sequence1 | ( | const Sequence1< OtherT > & | f | ) |
Create a sequence from another sequence having elements of a different type.
Sequence1& SPL::Sequence1< T >::operator= | ( | const Sequence1< OtherT > & | f | ) |
Assign another sequence with elements of a different type to this sequence.
The type OtherT must be assignable to the type T.