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  {
21  inline virtual ~AbsVisitor() {}
22 
24  virtual void clear() = 0;
25 
27  virtual void process(const Input& value) = 0;
28 
30  virtual Result result() = 0;
31  };
32 
38  template <typename Input>
39  class VisitCounter : public AbsVisitor<Input,unsigned long>
40  {
41  public:
42  inline VisitCounter() : counter_(0UL) {}
43  inline virtual ~VisitCounter() {}
44 
45  inline void clear() {counter_ = 0UL;}
46  inline void process(const Input&) {++counter_;}
47  inline unsigned long result() {return counter_;}
48 
49  private:
50  unsigned long counter_;
51  };
52 }
53 
54 #endif // ABSVISITOR_HH_
55 
virtual ~AbsVisitor()
Definition: AbsVisitor.h:21
virtual void clear()=0
virtual void process(const Input &value)=0
virtual Result result()=0
#define Input(cl)
Definition: vmac.h:190
void process(const Input &)
Definition: AbsVisitor.h:46
unsigned long counter_
Definition: AbsVisitor.h:50
Definition: value.py:1
unsigned long result()
Definition: AbsVisitor.h:47
virtual ~VisitCounter()
Definition: AbsVisitor.h:43