CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
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 
44  inline void clear() {counter_ = 0UL;}
45  inline void process(const Input&) {++counter_;}
46  inline unsigned long result() {return counter_;}
47 
48  private:
49  unsigned long counter_;
50  };
51 }
52 
53 #endif // ABSVISITOR_HH_
54 
virtual ~AbsVisitor()
Definition: AbsVisitor.h:21
virtual void clear()=0
virtual void process(const Input &value)=0
#define Input(cl)
Definition: vmac.h:188
virtual Result result()=0
void process(const Input &)
Definition: AbsVisitor.h:45
unsigned long counter_
Definition: AbsVisitor.h:49
unsigned long result()
Definition: AbsVisitor.h:46