#include <GaudiUtils/Range.h>
Inheritance diagram for Gaudi::Range_< CONTAINER >:
Public Types | ||||
| typedef std::pair< typename CONTAINER::const_iterator, typename CONTAINER::const_iterator > | Base | |||
| typedef CONTAINER | Container | |||
| type for actual contained iterator | ||||
| typedef Container::value_type | value_type | |||
| typedef Container::const_iterator | iterator | |||
| typedef Container::const_iterator | const_iterator | |||
| typedef Container::const_reverse_iterator | reverse_iterator | |||
| typedef Container::const_reverse_iterator | const_reverse_iterator | |||
| typedef Container::const_reference | reference | |||
| typedef Container::const_reference | const_reference | |||
| typedef std::pair< iterator, iterator > | _Base | |||
| internal types | ||||
| typedef Range_< Container > | _Self | |||
Public Member Functions | ||||
| Range_ () | ||||
| default constructor | ||||
| Range_ (iterator ibegin, iterator iend) | ||||
| Constructor. | ||||
| Range_ (const Base &base) | ||||
| constructor from the pair of iterators | ||||
| Range_ (const Container &cont) | ||||
| constructor from the container | ||||
| Range_ (iterator ibegin) | ||||
| ~Range_ () | ||||
| destructor | ||||
| bool | empty () const | |||
| empty sequence ? | ||||
| size_t | size () const | |||
| size of the sequence (number of elements) | ||||
| iterator | begin () const | |||
| access to begin of the sequence (const version ) | ||||
| iterator | end () const | |||
| access to end of the sequence (const version) | ||||
| reverse_iterator | rbegin () const | |||
| access to begin of the reversed sequence (const) | ||||
| reverse_iterator | rend () const | |||
| access to begin of the reversed sequence (const) | ||||
| const_reference | front () const | |||
| access for the first element (only for non-empty ranges!) | ||||
| const_reference | back () const | |||
| access for the back element (only for non-empty ranges!) | ||||
| Range_ | slice (long index1, long index2) const | |||
| get a "slice" of a range, in Python style | ||||
| const_reference | operator() (const size_t index) const | |||
| non-checked access to the elements by index (valid only for non-empty sequences) | ||||
| const_reference | operator[] (const long index) const | |||
| non-checked access to the elements by index (valid only for non-empty sequences) | ||||
| const_reference | at (const long index) const | |||
Checked access to the elements by index (valid for all sequences)
| ||||
| bool | operator< (const Range_ &right) const | |||
| compare with another range | ||||
| bool | operator< (const Container &right) const | |||
| compare with the base container | ||||
| bool | operator== (const Range_ &right) const | |||
| equality with another range | ||||
| bool | operator== (const Container &right) const | |||
| equality with the base container | ||||
| bool | operator! () const | |||
| empty sequence? | ||||
| operator const Base & () const | ||||
| conversion operator to the std::pair | ||||
| const Base & | base () const | |||
| conversion operator to the std::pair | ||||
Private Attributes | ||||
| Base | m_base | |||
| the base itself | ||||
The range could be created over *ALL* container types which supports at least bidirectional iterators.
The minimum requirements from the container type:
Definition at line 84 of file Range.h.
| typedef std::pair<typename CONTAINER::const_iterator, typename CONTAINER::const_iterator> Gaudi::Range_< CONTAINER >::Base |
| typedef CONTAINER Gaudi::Range_< CONTAINER >::Container |
| typedef Container::value_type Gaudi::Range_< CONTAINER >::value_type |
| typedef Container::const_iterator Gaudi::Range_< CONTAINER >::iterator |
| typedef Container::const_iterator Gaudi::Range_< CONTAINER >::const_iterator |
| typedef Container::const_reverse_iterator Gaudi::Range_< CONTAINER >::reverse_iterator |
| typedef Container::const_reverse_iterator Gaudi::Range_< CONTAINER >::const_reverse_iterator |
| typedef Container::const_reference Gaudi::Range_< CONTAINER >::reference |
| typedef Container::const_reference Gaudi::Range_< CONTAINER >::const_reference |
| typedef std::pair<iterator,iterator> Gaudi::Range_< CONTAINER >::_Base |
| Gaudi::Range_< CONTAINER >::Range_ | ( | ) | [inline] |
| Gaudi::Range_< CONTAINER >::Range_ | ( | iterator | ibegin, | |
| iterator | iend | |||
| ) | [inline] |
| Gaudi::Range_< CONTAINER >::Range_ | ( | const Base & | base | ) | [inline] |
| Gaudi::Range_< CONTAINER >::Range_ | ( | const Container & | cont | ) | [inline] |
| Gaudi::Range_< CONTAINER >::Range_ | ( | iterator | ibegin | ) | [inline] |
| Gaudi::Range_< CONTAINER >::~Range_ | ( | ) | [inline] |
| bool Gaudi::Range_< CONTAINER >::empty | ( | ) | const [inline] |
| size_t Gaudi::Range_< CONTAINER >::size | ( | ) | const [inline] |
| iterator Gaudi::Range_< CONTAINER >::begin | ( | ) | const [inline] |
| iterator Gaudi::Range_< CONTAINER >::end | ( | ) | const [inline] |
| reverse_iterator Gaudi::Range_< CONTAINER >::rbegin | ( | ) | const [inline] |
access to begin of the reversed sequence (const)
Definition at line 140 of file Range.h.
00140 { return reverse_iterator ( end () ) ; }
| reverse_iterator Gaudi::Range_< CONTAINER >::rend | ( | ) | const [inline] |
access to begin of the reversed sequence (const)
Definition at line 142 of file Range.h.
00142 { return reverse_iterator ( begin () ) ; }
| const_reference Gaudi::Range_< CONTAINER >::front | ( | ) | const [inline] |
| const_reference Gaudi::Range_< CONTAINER >::back | ( | ) | const [inline] |
access for the back element (only for non-empty ranges!)
Definition at line 146 of file Range.h.
00147 { 00148 const_iterator i = end() ; 00149 std::advance ( i , -1 ) ; 00150 return *i ; 00151 }
| Range_ Gaudi::Range_< CONTAINER >::slice | ( | long | index1, | |
| long | index2 | |||
| ) | const [inline] |
get a "slice" of a range, in Python style
Definition at line 154 of file Range.h.
00155 { 00156 // trivial cases 00157 if ( empty() || index1 == index2 ) { return Range_() ; } // RETURN 00158 // adjust indices 00159 if ( index1 < 0 ) { index1 += size () ; } 00160 if ( index2 < 0 ) { index2 += size () ; } 00161 // check 00162 if ( index1 < 0 ) { return Range_ () ; } // RETURN 00163 if ( index2 < index1 ) { return Range_ () ; } // RETURN 00164 00165 if ( index1 > (long) size () ) { return Range_() ; } // RETURN 00166 if ( index2 > (long) size () ) { index2 = size() ; } 00167 00168 const_iterator i1 = begin() ; 00169 std::advance ( i1 , index1 ) ; 00170 const_iterator i2 = begin() ; 00171 std::advance ( i2 , index2 ) ; 00172 // construct the slice 00173 return Range_( i1 , i2 ) ; // RETURN 00174 }
| 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)
| index | the index of the lement to be accessed |
Definition at line 180 of file Range.h.
00181 { 00182 const_iterator i = begin() ; 00183 std::advance ( i , index ) ; 00184 return *i ; 00185 }
| const_reference Gaudi::Range_< CONTAINER >::operator[] | ( | const long | index | ) | const [inline] |
| const_reference Gaudi::Range_< CONTAINER >::at | ( | const long | index | ) | const [inline] |
Checked access to the elements by index (valid for all sequences)
| GaudiException | for out-of-range access. |
| index | the index of the element to be accessed |
Definition at line 197 of file Range.h.
00198 { 00199 if ( index < 0 || index >= (long) size () ) 00200 { Gaudi::details::rangeException( index , size() ) ; } 00201 return (*this) ( index ); 00202 }
| bool Gaudi::Range_< CONTAINER >::operator< | ( | const Range_< CONTAINER > & | right | ) | const [inline] |
| bool Gaudi::Range_< CONTAINER >::operator< | ( | const Container & | right | ) | const [inline] |
| bool Gaudi::Range_< CONTAINER >::operator== | ( | const Range_< CONTAINER > & | right | ) | const [inline] |
| bool Gaudi::Range_< CONTAINER >::operator== | ( | const Container & | right | ) | const [inline] |
| bool Gaudi::Range_< CONTAINER >::operator! | ( | ) | const [inline] |
| Gaudi::Range_< CONTAINER >::operator const Base & | ( | ) | const [inline] |
| const Base& Gaudi::Range_< CONTAINER >::base | ( | ) | const [inline] |
Base Gaudi::Range_< CONTAINER >::m_base [private] |
1.4.7