CMS 3D CMS Logo

AbsVisitor.h
Go to the documentation of this file.
1 #ifndef NPSTAT_ABSVISITOR_HH_
2 #define NPSTAT_ABSVISITOR_HH_
3 
14 namespace npstat {
18  template <typename Input, typename Result>
19  struct AbsVisitor {
20  inline virtual ~AbsVisitor() {}
21 
23  virtual void clear() = 0;
24 
26  virtual void process(const Input& value) = 0;
27 
29  virtual Result result() = 0;
30  };
31 
37  template <typename Input>
38  class VisitCounter : public AbsVisitor<Input, unsigned long> {
39  public:
40  inline VisitCounter() : counter_(0UL) {}
41  inline virtual ~VisitCounter() {}
42 
43  inline void clear() { counter_ = 0UL; }
44  inline void process(const Input&) { ++counter_; }
45  inline unsigned long result() { return counter_; }
46 
47  private:
48  unsigned long counter_;
49  };
50 } // namespace npstat
51 
52 #endif // ABSVISITOR_HH_
npstat::VisitCounter::process
void process(const Input &)
Definition: AbsVisitor.h:44
npstat::AbsVisitor
Definition: AbsVisitor.h:19
npstat::AbsVisitor::~AbsVisitor
virtual ~AbsVisitor()
Definition: AbsVisitor.h:20
npstat::VisitCounter::~VisitCounter
virtual ~VisitCounter()
Definition: AbsVisitor.h:41
npstat::VisitCounter::counter_
unsigned long counter_
Definition: AbsVisitor.h:48
npstat
Definition: AbsArrayProjector.h:14
npstat::VisitCounter
Definition: AbsVisitor.h:38
npstat::AbsVisitor::process
virtual void process(const Input &value)=0
npstat::VisitCounter::VisitCounter
VisitCounter()
Definition: AbsVisitor.h:40
value
Definition: value.py:1
npstat::VisitCounter::clear
void clear()
Definition: AbsVisitor.h:43
TrackCandidateTopBottomHitFilter_cfi.Input
Input
Definition: TrackCandidateTopBottomHitFilter_cfi.py:4
npstat::AbsVisitor::clear
virtual void clear()=0
npstat::AbsVisitor::result
virtual Result result()=0
npstat::VisitCounter::result
unsigned long result()
Definition: AbsVisitor.h:45