Useful class for representation of "sequence" of the objects through the range of valid iterators.
More...
#include <GaudiUtils/Range.h>
List of all members.
Detailed Description
template<class CONTAINER>
class Gaudi::Range_< CONTAINER >
Useful class for representation of "sequence" of the objects through the range of valid iterators.
The range could be created over *ALL* container types which supports at least bidirectional iterators.
The minimum requirements from the container type:
- support the concept of "CONTAINER::value_type"
- support the concept of "CONTAINER::const_iterator"
- support the concept of "CONTAINER::const_reference"
- support the concept of "CONTAINER::const_reverse_iterator"
- the iterator should be ok for "std::distance" and "std::advance"
- support for "const_iterator CONTAINER::begin () const"
- support for "const_iterator CONTAINER::end () const"
- support for "const_reverse_iterator CONTAINER::rbegin () const"
- support for "const_reverse_iterator CONTAINER::rend () const"
- Author:
- Vanya Belyaev Ivan.Belyaev@itep.ru
- Date:
- 2002-07-12
Definition at line 76 of file Range.h.
Member Typedef Documentation
template<class CONTAINER>
internal types
Definition at line 95 of file Range.h.
template<class CONTAINER>
template<class CONTAINER>
| typedef std::pair<typename CONTAINER::const_iterator, typename CONTAINER::const_iterator> Gaudi::Range_< CONTAINER >::Base |
template<class CONTAINER>
| typedef Container::const_iterator Gaudi::Range_< CONTAINER >::const_iterator |
template<class CONTAINER>
| typedef Container::const_reference Gaudi::Range_< CONTAINER >::const_reference |
template<class CONTAINER>
template<class CONTAINER>
| typedef CONTAINER Gaudi::Range_< CONTAINER >::Container |
type for actual contained iterator
Definition at line 86 of file Range.h.
template<class CONTAINER>
| typedef Container::const_iterator Gaudi::Range_< CONTAINER >::iterator |
template<class CONTAINER>
| typedef Container::const_reference Gaudi::Range_< CONTAINER >::reference |
template<class CONTAINER>
| typedef Container::const_reverse_iterator Gaudi::Range_< CONTAINER >::reverse_iterator |
template<class CONTAINER>
| typedef Container::value_type Gaudi::Range_< CONTAINER >::value_type |
Constructor & Destructor Documentation
template<class CONTAINER>
| Gaudi::Range_< CONTAINER >::Range_ |
( |
) |
[inline] |
default constructor
Definition at line 101 of file Range.h.
template<class CONTAINER>
Constructor.
- Parameters:
-
| ibegin | iterator to begin of the sequence |
| iend | iterator to end of the sequence |
Definition at line 106 of file Range.h.
: m_base ( ibegin , iend ) {} ;
template<class CONTAINER>
| Gaudi::Range_< CONTAINER >::Range_ |
( |
const Base & |
base ) |
[inline] |
constructor from the pair of iterators
- Parameters:
-
| base | pair of the iterators |
Definition at line 110 of file Range.h.
template<class CONTAINER>
constructor from the container
- Parameters:
-
| cont | reference to the container |
Definition at line 114 of file Range.h.
: m_base( cont.begin() , cont.end() ) {} ;
template<class CONTAINER>
template<class CONTAINER>
| Gaudi::Range_< CONTAINER >::~Range_ |
( |
) |
[inline] |
destructor
Definition at line 120 of file Range.h.
Member Function Documentation
template<class CONTAINER>
Checked access to the elements by index (valid for all sequences)
- Exceptions:
-
- Parameters:
-
| index | the index of the element to be accessed |
Definition at line 189 of file Range.h.
template<class CONTAINER>
access for the back element (only for non-empty ranges!)
Definition at line 138 of file Range.h.
template<class CONTAINER>
| const Base& Gaudi::Range_< CONTAINER >::base |
( |
) |
const [inline] |
template<class CONTAINER>
| iterator Gaudi::Range_< CONTAINER >::begin |
( |
) |
const [inline] |
access to begin of the sequence (const version )
Definition at line 128 of file Range.h.
template<class CONTAINER>
| bool Gaudi::Range_< CONTAINER >::empty |
( |
) |
const [inline] |
empty sequence ?
Definition at line 123 of file Range.h.
template<class CONTAINER>
| iterator Gaudi::Range_< CONTAINER >::end |
( |
) |
const [inline] |
access to end of the sequence (const version)
Definition at line 130 of file Range.h.
template<class CONTAINER>
access for the first element (only for non-empty ranges!)
Definition at line 136 of file Range.h.
{ return *( begin () ) ; }
template<class CONTAINER>
| Gaudi::Range_< CONTAINER >::operator const Base & |
( |
) |
const [inline] |
template<class CONTAINER>
| bool Gaudi::Range_< CONTAINER >::operator! |
( |
) |
const [inline] |
empty sequence?
Definition at line 230 of file Range.h.
template<class CONTAINER>
| const_reference Gaudi::Range_< CONTAINER >::operator() |
( |
const size_t |
index ) |
const [inline] |
non-checked access to the elements by index (valid only for non-empty sequences)
- Parameters:
-
| index | the index of the lement to be accessed |
Definition at line 172 of file Range.h.
template<class CONTAINER>
| bool Gaudi::Range_< CONTAINER >::operator< |
( |
const Range_< CONTAINER > & |
right ) |
const [inline] |
compare with another range
Definition at line 199 of file Range.h.
template<class CONTAINER>
| bool Gaudi::Range_< CONTAINER >::operator< |
( |
const Container & |
right ) |
const [inline] |
compare with the base container
Definition at line 205 of file Range.h.
template<class CONTAINER>
| bool Gaudi::Range_< CONTAINER >::operator== |
( |
const Range_< CONTAINER > & |
right ) |
const [inline] |
equality with another range
Definition at line 214 of file Range.h.
{
if ( &right == this ) { return true ; }
if ( right.size () != size () ) { return false ; }
return std::equal ( begin () , end () , right.begin() ) ;
}
template<class CONTAINER>
| bool Gaudi::Range_< CONTAINER >::operator== |
( |
const Container & |
right ) |
const [inline] |
equality with the base container
Definition at line 221 of file Range.h.
template<class CONTAINER>
non-checked access to the elements by index (valid only for non-empty sequences)
- Parameters:
-
| index | the index of the lement to be accessed |
Definition at line 182 of file Range.h.
{ return (*this)( index ) ; }
template<class CONTAINER>
access to begin of the reversed sequence (const)
Definition at line 132 of file Range.h.
template<class CONTAINER>
access to begin of the reversed sequence (const)
Definition at line 134 of file Range.h.
template<class CONTAINER>
| size_t Gaudi::Range_< CONTAINER >::size |
( |
) |
const [inline] |
size of the sequence (number of elements)
Definition at line 125 of file Range.h.
template<class CONTAINER>
| Range_ Gaudi::Range_< CONTAINER >::slice |
( |
long |
index1, |
|
|
long |
index2 |
|
) |
| const [inline] |
Member Data Documentation
template<class CONTAINER>
Base Gaudi::Range_< CONTAINER >::m_base [private] |
the base itself
Definition at line 242 of file Range.h.
The documentation for this class was generated from the following file:
- /afs/.cern.ch/sw/Gaudi/releases/GAUDI/GAUDI_v22r1/GaudiKernel/GaudiKernel/Range.h