Loading [MathJax]/extensions/tex2jax.js
The Gaudi Framework  v31r0 (aeb156f0)
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Modules Pages
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  // ==========================================================================
42  class NamedRange_ : public Gaudi::Range_<CONTAINER, ITERATOR> {
43  protected:
44  // ========================================================================
49  // ========================================================================
50  public:
51  // ========================================================================
53  NamedRange_() = default;
59  NamedRange_( typename Base::iterator ibegin, typename Base::iterator iend, std::string name = "" )
60  : Base( ibegin, iend ), m_name( std::move( name ) ){};
65  NamedRange_( const Base& base, std::string name = "" ) : Base( base ), m_name( std::move( name ) ){};
70  NamedRange_( const typename Base::Base& base, std::string name = "" ) : Base( base ), m_name( std::move( name ) ){};
75  NamedRange_( const typename Base::Container& base, std::string name = "" )
76  : Base( base ), m_name( std::move( name ) ){};
77  /* constructor of empty range/sequence
78  * @param ibegin iterator to begin of empty sequence
79  * @param name name of the range
80  */
81  NamedRange_( typename Base::iterator ibegin, std::string name = "" )
82  : Base( ibegin, ibegin ), m_name( std::move( name ) ){};
84  ~NamedRange_() = default;
85  // ========================================================================
86  public:
87  // ========================================================================
89  inline NamedRange_ slice( long index1, long index2 ) const {
90  return NamedRange_( Base::slice( index1, index2 ), m_name );
91  }
92  // ========================================================================
93  public:
94  // ========================================================================
96  const std::string& name() const { return m_name; }
98  void setName( const std::string& value ) { m_name = value; }
99  // ========================================================================
100  private:
101  // ========================================================================
103  std::string m_name; // the name associated to the range
104  // ========================================================================
105  };
106  // ==========================================================================
117  template <class CONTAINER>
118  inline NamedRange_<CONTAINER> range( const CONTAINER& cnt, std::string name ) {
119  return NamedRange_<CONTAINER>( cnt.begin(), cnt.end(), std::move( name ) );
120  }
121  // ==========================================================================
122 } // end of namespace Gaudi
123 // ============================================================================
124 // The END
125 // ============================================================================
126 #endif // GAUDI_NAMEDRANGE_H
const std::string & name() const
get the name of the range
Definition: NamedRange.h:96
NamedRange_< CONTAINER, ITERATOR > Self
"self"-type
Definition: NamedRange.h:48
STL namespace.
NamedRange_(const Base &base, std::string name="")
constructor from the base class
Definition: NamedRange.h:65
NamedRange_(const typename Base::Base &base, std::string name="")
constructor from the base class
Definition: NamedRange.h:70
void setName(const std::string &value)
set the name of the range
Definition: NamedRange.h:98
STL class.
NamedRange_(const typename Base::Container &base, std::string name="")
constructor from the base class
Definition: NamedRange.h:75
NamedRange_< CONTAINER > range(const CONTAINER &cnt, std::string name)
simple function to create the named range from arbitrary container
Definition: NamedRange.h:118
NamedRange_ slice(long index1, long index2) const
get a "slice" of a range, in Python style
Definition: NamedRange.h:89
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:103
Gaudi::Range_< CONTAINER, ITERATOR > Base
the base class
Definition: NamedRange.h:46
boost::spirit::classic::position_iterator2< ForwardIterator > Iterator
Definition: Iterator.h:18
NamedRange_(typename Base::iterator ibegin, std::string name="")
Definition: NamedRange.h:81
const Base & base() const
conversion operator to the std::pair
Definition: Range.h:239
NamedRange_(typename Base::iterator ibegin, typename Base::iterator iend, std::string name="")
Constructor.
Definition: NamedRange.h:59
Useful class for representation of "sequence" of the objects through the range of valid iterators...
Definition: Range.h:85
Helper functions to set/get the application return code.
Definition: __init__.py:1
~NamedRange_()=default
destructor