CMS 3D CMS Logo

IterateNTimesLooper.cc
Go to the documentation of this file.
1 // -*- C++ -*-
2 //
3 // Package: Modules
4 // Class : IterateNTimesLooper
5 //
6 // Implementation:
7 // <Notes on implementation>
8 //
9 // Original Author: Chris Jones
10 // Created: Tue Jul 11 11:16:14 EDT 2006
11 //
12 
13 // system include files
14 
15 // user include files
19 
20 namespace edm {
21 
22  class IterateNTimesLooper : public EDLooper {
23  public:
25  IterateNTimesLooper(IterateNTimesLooper const&) = delete; // stop default
26  IterateNTimesLooper const& operator=(IterateNTimesLooper const&) = delete; // stop default
27  ~IterateNTimesLooper() override;
28 
29  // ---------- const member functions ---------------------
30 
31  // ---------- static member functions --------------------
32 
33  // ---------- member functions ---------------------------
34  void startingNewLoop(unsigned int) override;
35  Status duringLoop(Event const&, EventSetup const&) override;
36  Status endOfLoop(EventSetup const&, unsigned int) override;
37 
38  private:
39  // ---------- member data --------------------------------
40  unsigned int max_;
41  unsigned int times_;
43  };
44 
45  //
46  //
47  // constructors and destructor
48  //
50  : max_(iConfig.getParameter<unsigned int>("nTimes")), times_(0), shouldStop_(false) {}
51 
52  // IterateNTimesLooper::IterateNTimesLooper(IterateNTimesLooper const& rhs) {
53  // // do actual copying here;
54  // }
55 
57 
58  //
59  // assignment operators
60  //
61  // IterateNTimesLooper const& IterateNTimesLooper::operator=(IterateNTimesLooper const& rhs) {
62  // //An exception safe implementation is
63  // IterateNTimesLooper temp(rhs);
64  // swap(rhs);
65  //
66  // return *this;
67  // }
68 
69  //
70  // member functions
71  //
72  void IterateNTimesLooper::startingNewLoop(unsigned int iIteration) {
73  times_ = iIteration;
74  if (iIteration >= max_) {
75  shouldStop_ = true;
76  }
77  }
78 
80  return shouldStop_ ? kStop : kContinue;
81  }
82 
83  EDLooper::Status IterateNTimesLooper::endOfLoop(EventSetup const&, unsigned int /*iCounter*/) {
84  ++times_;
85  return (times_ < max_) ? kContinue : kStop;
86  }
87 } // namespace edm
88 
edm::IterateNTimesLooper
Definition: IterateNTimesLooper.cc:22
edm::EDLooperBase::Status
Status
Definition: EDLooperBase.h:82
funct::false
false
Definition: Factorize.h:29
edm
HLT enums.
Definition: AlignableModifier.h:19
edm::IterateNTimesLooper::startingNewLoop
void startingNewLoop(unsigned int) override
Definition: IterateNTimesLooper.cc:72
DEFINE_FWK_LOOPER
#define DEFINE_FWK_LOOPER(type)
Definition: LooperFactory.h:108
edm::IterateNTimesLooper::IterateNTimesLooper
IterateNTimesLooper(ParameterSet const &)
Definition: IterateNTimesLooper.cc:49
edm::EDLooper
Definition: EDLooper.h:27
edm::EDLooperBase::kStop
Definition: EDLooperBase.h:82
edm::IterateNTimesLooper::duringLoop
Status duringLoop(Event const &, EventSetup const &) override
Definition: IterateNTimesLooper.cc:79
LooperFactory.h
edm::ParameterSet
Definition: ParameterSet.h:47
createfilelist.int
int
Definition: createfilelist.py:10
edm::EventSetup
Definition: EventSetup.h:58
edm::EDLooperBase::kContinue
Definition: EDLooperBase.h:82
edm::IterateNTimesLooper::endOfLoop
Status endOfLoop(EventSetup const &, unsigned int) override
Definition: IterateNTimesLooper.cc:83
edm::IterateNTimesLooper::max_
unsigned int max_
Definition: IterateNTimesLooper.cc:40
edm::IterateNTimesLooper::times_
unsigned int times_
Definition: IterateNTimesLooper.cc:41
edm::IterateNTimesLooper::~IterateNTimesLooper
~IterateNTimesLooper() override
Definition: IterateNTimesLooper.cc:56
edm::IterateNTimesLooper::shouldStop_
bool shouldStop_
Definition: IterateNTimesLooper.cc:42
ParameterSet.h
EDLooper.h
edm::Event
Definition: Event.h:73
edm::IterateNTimesLooper::operator=
IterateNTimesLooper const & operator=(IterateNTimesLooper const &)=delete