NSCL DDAS  1.0
Support for XIA DDAS at the NSCL
 All Classes Namespaces Files Functions Variables Macros Pages
Public Member Functions | List of all members
TrAnal::TrRange< T > Class Template Reference

TrRange class. More...

#include <TrIterator.hpp>

Public Member Functions

 TrRange (const TrIterator< T > &b=TrIterator< T >(), const TrIterator< T > &e=TrIterator< T >())
 Default constructor. More...
 
 TrRange (const TrIterator< T > &ref, int range)
 Range specified constructor. More...
 
 TrRange (const TrRange &that)
 Copy constructor.
 
TrRangeoperator= (const TrRange &that)
 Assignment operator.
 
TrIterator< T > begin () const
 Get value of begin iterator.
 
TrIterator< T > end () const
 Get value of end iterator.
 
TrRangeoperator++ ()
 ++range style incrementation More...
 
TrRange operator++ (int)
 range++ style incrementation More...
 
TrRangeoperator-- ()
 –range style decrementation More...
 
TrRange operator-- (int)
 Decrementation range–;. More...
 
TrRange operator+ (int n) const
 range+n style increment More...
 
TrRange operator- (int n) const
 range-n style decrement More...
 
TrRangeoperator+= (int n)
 range += n support More...
 
TrRangeoperator-= (int n)
 range -=n style decrement More...
 
TrIterator< T >::difference_type range () const
 Compute distance between begin and end. More...
 
void invert ()
 Swap begin and end iterators.
 
bool operator== (const TrRange &that) const
 Equality operator. More...
 
bool operator!= (const TrRange &that) const
 Inequality operator.
 
bool operator< (const TrRange &that) const
 Less than operator. More...
 
bool operator> (const TrRange &that) const
 Greater than operator. More...
 
bool operator<= (const TrRange &that) const
 Greater than or equal operator.
 
bool operator>= (const TrRange &that) const
 Less than or equal operator.
 

Detailed Description

template<class T>
class TrAnal::TrRange< T >

TrRange class.

A convenience class for defining iterator ranges. Most algorithms operate within a bounded region, and this provides a means for defining ranges for use in those algorithms. A strength of this class is the ability to define a range based on a single iterator and integral range specification. Ranges are typically used such that begin() is the first element of a range of valid elements and end() is the first element beyond valid elements, i.e., [begin, end) in mathematical notation.

NOTE: This class cannot determine whether or not the two iterators provided to it are associated with each other. For example, it is possible to construct a range in the following way without any errors.

TrRange<type> range( trace0.begin(), trace1.end() );

Constructor & Destructor Documentation

template<class T>
TrAnal::TrRange< T >::TrRange ( const TrIterator< T > &  b = TrIterator<T>(),
const TrIterator< T > &  e = TrIterator<T>() 
)
inline

Default constructor.

Constructs a range from two iterators. There is no ability to determine whether the two arguments are associated with the same trace. If they are not, then problems are likely to ensue.

Parameters
biterator defining beginning of range
eiterator defining ending of range
template<class T>
TrAnal::TrRange< T >::TrRange ( const TrIterator< T > &  ref,
int  range 
)
inline

Range specified constructor.

Construct a range based on a single iterator and an offset from it. If the range is negative, the range will be generated such that ref is at the end by swapping begin and end. In this way, this constructor will always guarantee that the the beginning and end of the range are in increasing order.

Parameters
refiterator identifying begining (end) of range if range arg is positive (negative)
rangewidth of range, can be either positive or negative

Member Function Documentation

template<class T>
TrRange TrAnal::TrRange< T >::operator+ ( int  n) const
inline

range+n style increment

Increments both the begin and end iterators together.

Returns
copy of range after incrementing
template<class T>
TrRange& TrAnal::TrRange< T >::operator++ ( )
inline

++range style incrementation

Increments both the begin and end iterators together.

Returns
reference to this after incrementing
template<class T>
TrRange TrAnal::TrRange< T >::operator++ ( int  )
inline

range++ style incrementation

Returns a copy of the current range while also incrementing both the begin and end iterators.

Returns
copy of range before incrementing
template<class T>
TrRange& TrAnal::TrRange< T >::operator+= ( int  n)
inline

range += n support

Increments both the begin and end iterators together.

Returns
reference to this range after incrementing
template<class T>
TrRange TrAnal::TrRange< T >::operator- ( int  n) const
inline

range-n style decrement

Decrements both the begin and end iterators together.

Returns
copy of range after decrementing
template<class T>
TrRange& TrAnal::TrRange< T >::operator-- ( )
inline

–range style decrementation

Decrements both the begin and end iterators together.

Returns
reference to this range after decrementing
template<class T>
TrRange TrAnal::TrRange< T >::operator-- ( int  )
inline

Decrementation range–;.

Returns a copy of the current range while also decrementing both the begin and end iterators.

Returns
copy of range before decrementing
template<class T>
TrRange& TrAnal::TrRange< T >::operator-= ( int  n)
inline

range -=n style decrement

Decrements both the begin and end iterators together.

Returns
reference to this range after decrementing
template<class T>
bool TrAnal::TrRange< T >::operator< ( const TrRange< T > &  that) const
inline

Less than operator.

Ensures that both begin and end iterators are less than their counterparts. This definition allows ranges to overlap.

Parameters
thatrange to compare against
Returns
true if this->begin()<that.begin() && this->end()<that.end()
template<class T>
bool TrAnal::TrRange< T >::operator== ( const TrRange< T > &  that) const
inline

Equality operator.

Equality implies that both begin and end iterators are the same

template<class T>
bool TrAnal::TrRange< T >::operator> ( const TrRange< T > &  that) const
inline

Greater than operator.

Ensures that both begin and end iterators are greater than their counterparts This definition allows ranges to overlap.

Parameters
thatrange to compare against
Returns
true if this->begin()>that.begin() && this->end()>that.end()
template<class T>
TrIterator<T>::difference_type TrAnal::TrRange< T >::range ( ) const
inline

Compute distance between begin and end.

Returns
number of elements between begin and end

The documentation for this class was generated from the following file: