ATLAS Offline Software
Public Member Functions | Private Member Functions | Private Attributes | List of all members
ProductGen Class Reference

#include <ProductGen.h>

Collaboration diagram for ProductGen:

Public Member Functions

 ProductGen ()
 
 ProductGen (const std::vector< std::size_t > &ends)
 
std::vector< std::size_t > next ()
 

Private Member Functions

bool atEnd ()
 

Private Attributes

std::vector< std::size_t > m_ends
 
std::vector< std::size_t > m_counters
 
std::size_t m_ncounters
 
bool m_done {true}
 

Detailed Description

Definition at line 13 of file ProductGen.h.

Constructor & Destructor Documentation

◆ ProductGen() [1/2]

ProductGen::ProductGen ( )

Definition at line 10 of file ProductGen.cxx.

10 {}

◆ ProductGen() [2/2]

ProductGen::ProductGen ( const std::vector< std::size_t > &  ends)
explicit

Definition at line 12 of file ProductGen.cxx.

12  :
13  m_ends(ends), m_counters(ends.size(), 0), m_ncounters(ends.size()){
14 
15  if (!m_ends.empty()){
16  m_done = false;
17  for(auto& i : m_ends){
18  if(i < 1) {
19  m_done = true;
20  break;
21  } else {
22  i -= 1;
23  }
24  }
25  }
26 
27 }

Member Function Documentation

◆ atEnd()

bool ProductGen::atEnd ( )
inlineprivate

Definition at line 26 of file ProductGen.h.

26 {return (m_counters == m_ends);}

◆ next()

std::vector< std::size_t > ProductGen::next ( )

Definition at line 30 of file ProductGen.cxx.

30  {
31 
32  if(m_done){return std::vector<std::size_t>();}
33 
34  auto result = std::vector<std::size_t>(m_counters);
35  m_done = atEnd();
36  for(std::size_t i = 0; i < m_ncounters; ++i){
37 
38  if(m_counters[i] == m_ends[i]){
39  m_counters[i] = 0;
40  } else {
41  m_counters[i] += 1;
42  break;
43  }
44  }
45  return result;
46 }

Member Data Documentation

◆ m_counters

std::vector<std::size_t> ProductGen::m_counters
private

Definition at line 23 of file ProductGen.h.

◆ m_done

bool ProductGen::m_done {true}
private

Definition at line 25 of file ProductGen.h.

◆ m_ends

std::vector<std::size_t> ProductGen::m_ends
private

Definition at line 22 of file ProductGen.h.

◆ m_ncounters

std::size_t ProductGen::m_ncounters
private

Definition at line 24 of file ProductGen.h.


The documentation for this class was generated from the following files:
get_generator_info.result
result
Definition: get_generator_info.py:21
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
lumiFormat.i
int i
Definition: lumiFormat.py:92
ProductGen::m_ncounters
std::size_t m_ncounters
Definition: ProductGen.h:24
ProductGen::m_ends
std::vector< std::size_t > m_ends
Definition: ProductGen.h:22