The Gaudi Framework  v30r3 (a5ef0a68)
NamedRange.h
Go to the documentation of this file.
1 #ifndef GAUDI_NAMEDRANGE_H
2 #define GAUDI_NAMEDRANGE_H 1
3 // ============================================================================
4 // Include files
5 // ============================================================================
6 // STD & STL
7 // ============================================================================
8 #include <string>
9 // ============================================================================
10 // GaudiUtils
11 // ============================================================================
12 #include "GaudiKernel/Range.h"
13 // ============================================================================
29 // ============================================================================
30 namespace Gaudi
31 {
32  // ==========================================================================
43  class NamedRange_ : public Gaudi::Range_<CONTAINER, ITERATOR>
44  {
45  protected:
46  // ========================================================================
51  // ========================================================================
52  public:
53  // ========================================================================
55  NamedRange_() = default;
61  NamedRange_( typename Base::iterator ibegin, typename Base::iterator iend, std::string name = "" )
62  : Base( ibegin, iend ), m_name( std::move( name ) ){};
67  NamedRange_( const Base& base, std::string name = "" ) : Base( base ), m_name( std::move( name ) ){};
72  NamedRange_( const typename Base::Base& base, std::string name = "" ) : Base( base ), m_name( std::move( name ) ){};
77  NamedRange_( const typename Base::Container& base, std::string name = "" )
78  : Base( base ), m_name( std::move( name ) ){};
79  /* constructor of empty range/sequence
80  * @param ibegin iterator to begin of empty sequence
81  * @param name name of the range
82  */
83  NamedRange_( typename Base::iterator ibegin, std::string name = "" )
84  : Base( ibegin, ibegin ), m_name( std::move( name ) ){};
86  ~NamedRange_() = default;
87  // ========================================================================
88  public:
89  // ========================================================================
91  inline NamedRange_ slice( long index1, long index2 ) const
92  {
93  return NamedRange_( Base::slice( index1, index2 ), m_name );
94  }
95  // ========================================================================
96  public:
97  // ========================================================================
99  const std::string& name() const { return m_name; }
101  void setName( const std::string& value ) { m_name = value; }
102  // ========================================================================
103  private:
104  // ========================================================================
106  std::string m_name; // the name associated to the range
107  // ========================================================================
108  };
109  // ==========================================================================
120  template <class CONTAINER>
121  inline NamedRange_<CONTAINER> range( const CONTAINER& cnt, std::string name )
122  {
123  return NamedRange_<CONTAINER>( cnt.begin(), cnt.end(), std::move( name ) );
124  }
125  // ==========================================================================
126 } // end of namespace Gaudi
127 // ============================================================================
128 // The END
129 // ============================================================================
130 #endif // GAUDI_NAMEDRANGE_H
131 // ============================================================================
const std::string & name() const
get the name of the range
Definition: NamedRange.h:99
NamedRange_< CONTAINER, ITERATOR > Self
"self"-type
Definition: NamedRange.h:50
STL namespace.
NamedRange_(const Base &base, std::string name="")
constructor from the base class
Definition: NamedRange.h:67
NamedRange_(const typename Base::Base &base, std::string name="")
constructor from the base class
Definition: NamedRange.h:72
void setName(const std::string &value)
set the name of the range
Definition: NamedRange.h:101
STL class.
NamedRange_(const typename Base::Container &base, std::string name="")
constructor from the base class
Definition: NamedRange.h:77
NamedRange_< CONTAINER > range(const CONTAINER &cnt, std::string name)
simple function to create the named range from arbitrary container
Definition: NamedRange.h:121
NamedRange_ slice(long index1, long index2) const
get a "slice" of a range, in Python style
Definition: NamedRange.h:91
This file has been imported from LoKi project "C++ ToolKit for Smart and Friendly Physics Analysis" ...
NamedRange_()=default
default constructor
T move(T...args)
std::string m_name
the name, associated to the range
Definition: NamedRange.h:106
Gaudi::Range_< CONTAINER, ITERATOR > Base
the base class
Definition: NamedRange.h:48
boost::spirit::classic::position_iterator2< ForwardIterator > Iterator
Definition: Iterator.h:18
NamedRange_(typename Base::iterator ibegin, std::string name="")
Definition: NamedRange.h:83
const Base & base() const
conversion operator to the std::pair
Definition: Range.h:270
NamedRange_(typename Base::iterator ibegin, typename Base::iterator iend, std::string name="")
Constructor.
Definition: NamedRange.h:61
Useful class for representation of "sequence" of the objects through the range of valid iterators...
Definition: Range.h:88
Helper functions to set/get the application return code.
Definition: __init__.py:1
~NamedRange_()=default
destructor