CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
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 
24  public:
26  virtual ~IterateNTimesLooper();
27 
28  // ---------- const member functions ---------------------
29 
30  // ---------- static member functions --------------------
31 
32  // ---------- member functions ---------------------------
33  virtual void startingNewLoop(unsigned int);
34  virtual Status duringLoop(Event const&, EventSetup const&);
35  virtual Status endOfLoop(EventSetup const&, unsigned int);
36 
37  private:
38  IterateNTimesLooper(IterateNTimesLooper const&); // stop default
39 
40  IterateNTimesLooper const& operator=(IterateNTimesLooper const&); // stop default
41 
42  // ---------- member data --------------------------------
43  unsigned int max_;
44  unsigned int times_;
46  };
47 
48  //
49  //
50  // constructors and destructor
51  //
53  max_(iConfig.getParameter<unsigned int>("nTimes")),
54  times_(0),
55  shouldStop_(false) {
56  }
57 
58  // IterateNTimesLooper::IterateNTimesLooper(IterateNTimesLooper const& rhs) {
59  // // do actual copying here;
60  // }
61 
63  }
64 
65  //
66  // assignment operators
67  //
68  // IterateNTimesLooper const& IterateNTimesLooper::operator=(IterateNTimesLooper const& rhs) {
69  // //An exception safe implementation is
70  // IterateNTimesLooper temp(rhs);
71  // swap(rhs);
72  //
73  // return *this;
74  // }
75 
76  //
77  // member functions
78  //
79  void
80  IterateNTimesLooper::startingNewLoop(unsigned int iIteration) {
81  times_ = iIteration;
82  if(iIteration >= max_) {
83  shouldStop_ = true;
84  }
85  }
86 
89  return shouldStop_ ? kStop : kContinue;
90  }
91 
93  IterateNTimesLooper::endOfLoop(EventSetup const&, unsigned int /*iCounter*/) {
94  ++times_;
95  return (times_ < max_) ? kContinue : kStop;
96  }
97 }
98 
virtual Status duringLoop(Event const &, EventSetup const &)
IterateNTimesLooper(ParameterSet const &)
#define DEFINE_FWK_LOOPER(type)
virtual void startingNewLoop(unsigned int)
IterateNTimesLooper const & operator=(IterateNTimesLooper const &)
virtual Status endOfLoop(EventSetup const &, unsigned int)