CMS 3D CMS Logo

List of all members | Public Member Functions | Private Attributes
npstat::VisitCounter< Input > Class Template Reference

#include <AbsVisitor.h>

Inheritance diagram for npstat::VisitCounter< Input >:
npstat::AbsVisitor< Input, unsigned long >

Public Member Functions

void clear ()
 
void process (const Input &)
 
unsigned long result ()
 
 VisitCounter ()
 
virtual ~VisitCounter ()
 
- Public Member Functions inherited from npstat::AbsVisitor< Input, unsigned long >
virtual ~AbsVisitor ()
 

Private Attributes

unsigned long counter_
 

Detailed Description

template<typename Input>
class npstat::VisitCounter< Input >

Simple counter of visits is needed often, so it makes sense to put it together with AbsVisitor in the same header. Do not derive from this class, its destructor is not virtual.

Definition at line 38 of file AbsVisitor.h.

Constructor & Destructor Documentation

◆ VisitCounter()

template<typename Input >
npstat::VisitCounter< Input >::VisitCounter ( )
inline

Definition at line 40 of file AbsVisitor.h.

40 : counter_(0UL) {}

◆ ~VisitCounter()

template<typename Input >
virtual npstat::VisitCounter< Input >::~VisitCounter ( )
inlinevirtual

Definition at line 41 of file AbsVisitor.h.

41 {}

Member Function Documentation

◆ clear()

template<typename Input >
void npstat::VisitCounter< Input >::clear ( void  )
inlinevirtual

Clear all accumulated results

Implements npstat::AbsVisitor< Input, unsigned long >.

Definition at line 43 of file AbsVisitor.h.

43 { counter_ = 0UL; }

References npstat::VisitCounter< Input >::counter_.

◆ process()

template<typename Input >
void npstat::VisitCounter< Input >::process ( const Input &  value)
inlinevirtual

Process one array point

Implements npstat::AbsVisitor< Input, unsigned long >.

Definition at line 44 of file AbsVisitor.h.

44 { ++counter_; }

References npstat::VisitCounter< Input >::counter_.

◆ result()

template<typename Input >
unsigned long npstat::VisitCounter< Input >::result ( )
inlinevirtual

Return the result at the end of array processing

Implements npstat::AbsVisitor< Input, unsigned long >.

Definition at line 45 of file AbsVisitor.h.

45 { return counter_; }

References npstat::VisitCounter< Input >::counter_.

Member Data Documentation

◆ counter_

template<typename Input >
unsigned long npstat::VisitCounter< Input >::counter_
private
npstat::VisitCounter::counter_
unsigned long counter_
Definition: AbsVisitor.h:48