ATLAS Offline Software
ProductGen.h
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration
3 */
4 
5 #ifndef TRIGHLTJETHYPO_PRODUCTGEN_H
6 #define TRIGHLTJETHYPO_PRODUCTGEN_H
7 
8 #include <vector>
9 
10 // For a vector of vectors, repeated calls to next() returns
11 // indices that point to elements in the inner vectors.
12 // The calls will step through this data structure.
13 class ProductGen{
14  public:
15  ProductGen();
16 
17  // ends contains the sizes of the inner vectors
18  explicit ProductGen(const std::vector<std::size_t>& ends);
19  std::vector<std::size_t> next();
20 
21  private:
22  std::vector<std::size_t> m_ends;
23  std::vector<std::size_t> m_counters;
24  std::size_t m_ncounters;
25  bool m_done{true};
26  bool atEnd(){return (m_counters == m_ends);}
27 };
28 
29 #endif
ProductGen::ProductGen
ProductGen()
Definition: ProductGen.cxx:10
ProductGen::m_counters
std::vector< std::size_t > m_counters
Definition: ProductGen.h:23
ProductGen::atEnd
bool atEnd()
Definition: ProductGen.h:26
ProductGen::m_done
bool m_done
Definition: ProductGen.h:25
ProductGen
Definition: ProductGen.h:13
ProductGen::m_ncounters
std::size_t m_ncounters
Definition: ProductGen.h:24
ProductGen::next
std::vector< std::size_t > next()
Definition: ProductGen.cxx:30
ProductGen::m_ends
std::vector< std::size_t > m_ends
Definition: ProductGen.h:22