2 #define GAUDI_RANGE_H 1 51 template <
typename T1>
static typename T1::Container
test(
int);
52 template <
typename>
static void test(...);
57 template <
class CONTAINER>
59 template <
class CONTAINER>
63 template <
class CONTAINER>
67 typedef typename CONTAINER::const_iterator
Iterator ;
138 Range_( iterator ibegin , iterator iend ) : m_base ( ibegin , iend ) {}
142 Range_(
const Base& base ) : m_base( base ) {}
150 Range_( iterator ibegin ) : m_base( ibegin , ibegin ) {}
155 bool empty ()
const {
return m_base.second == m_base.first ; }
160 iterator
begin ()
const {
return m_base.first ; }
162 iterator
end ()
const {
return m_base.second ; }
164 iterator
cbegin ()
const {
return m_base.first ; }
166 iterator
cend ()
const {
return m_base.second ; }
168 reverse_iterator
rbegin ()
const {
return reverse_iterator (
end () ) ; }
170 reverse_iterator
rend ()
const {
return reverse_iterator (
begin () ) ; }
180 if ( empty() || index1 == index2 ) {
return Range_() ; }
182 if ( index1 < 0 ) { index1 += size () ; }
183 if ( index2 < 0 ) { index2 += size () ; }
185 if ( index1 < 0 ) {
return Range_ () ; }
186 if ( index2 < index1 ) {
return Range_ () ; }
188 if ( index1 > (
long) size () ) {
return Range_() ; }
189 if ( index2 > (
long) size () ) { index2 = size() ; }
206 inline const_reference operator [] (
const long index )
const 207 {
return (*
this)( index ) ; }
213 inline const_reference
at (
const long index )
const 215 if ( index < 0 || index >= (
long) size () )
217 return (*
this) ( index );
223 template <
class C,
class I>
224 bool operator< ( const Range_<C,I>& right )
const 227 (
begin () ,
end () , right.begin () , right.end () ) ;
230 template <
class ANOTHERCONTAINER>
234 (
begin () ,
end () , right.begin () , right.end () ) ;
242 if ( &right ==
this ) {
return true ; }
243 return right.
size() == size() &&
247 template <
class CNT,
class IT>
250 return right.
size() == size() &&
254 template <
class ANOTHERCONTAINER>
257 return right.size() == size() &&
264 bool operator! ()
const {
return empty () ; }
266 explicit operator bool()
const {
return !empty () ; }
271 operator const Base& ()
const {
return base () ; }
273 inline const Base&
base ()
const {
return m_base ; }
309 template <
class CONTAINER>
319 #endif // GAUDI_RANGE_H bool empty() const
empty sequence ?
std::reverse_iterator< iterator > const_reverse_iterator
Base m_base
the base itself
GAUDI_API void rangeException(const long index, const size_t size)
Helpful function to throw an "out-of-range exception" for class Range_.
iterator cbegin() const
access to begin of the sequence (const version )
iter_traits::value_type value_type
std::reverse_iterator< iterator > reverse_iterator
helper structure to get container type
std::iterator_traits< iterator > iter_traits
Range_ slice(long index1, long index2) const
get a "slice" of a range, in Python style
std::pair< ITERATOR, ITERATOR > Base
helper class to simplify the dealing with ranges in Python
CONTAINER::Container Container
reverse_iterator rbegin() const
access to begin of the reversed sequence (const)
iter_traits::reference reference
bool operator==(const Range_< CNT, IT > &right) const
equality with another range type
const_reference front() const
access for the first element (only for non-empty ranges!)
auto begin(reverse_wrapper< T > &w)
Range_(iterator ibegin, iterator iend)
Constructor.
iter_traits::reference const_reference
NamedRange_< CONTAINER > range(const CONTAINER &cnt, std::string name)
simple function to create the named range from arbitrary container
Gaudi::details::container< CONTAINER >::Container Container
type for actual contained iterator
const_reference at(const long index) const
Checked access to the elements by index (valid for all sequences) for out-of-range access...
auto end(reverse_wrapper< T > &w)
Range_(const Base &base)
constructor from the pair of iterators
bool operator<(const EventIDBase &lhs, const EventIDBase &rhs)
T lexicographical_compare(T...args)
bool operator==(const Range_ &right) const
equality with another range
virtual Out operator()(const vector_of_const_< In > &inputs) const =0
boost::spirit::classic::position_iterator2< ForwardIterator > Iterator
iterator end() const
access to end of the sequence (const version)
const Base & base() const
conversion operator to the std::pair
iterator cend() const
access to end of the sequence (const version)
bool operator==(const ANOTHERCONTAINER &right) const
compare with another container
Useful class for representation of "sequence" of the objects through the range of valid iterators...
details::_container< CONTAINER, details::_has_typename_container_< CONTAINER >::value >::Container Container
size_t size() const
size of the sequence (number of elements)
CONTAINER::const_iterator Iterator
reverse_iterator rend() const
access to begin of the reversed sequence (const)
const_reference back() const
access for the back element (only for non-empty ranges!)
Range_(const Container &cont)
constructor from the container
Helper functions to set/get the application return code.
TO * reference(FROM *from)
iterator begin() const
access to begin of the sequence (const version )
static T1::Container test(int)