Jpp test-rotations-new
the software that should make you happy
Loading...
Searching...
No Matches
JROOT/JCounter.hh
Go to the documentation of this file.
1#ifndef __JROOT__JCOUNTER__
2#define __JROOT__JCOUNTER__
3
4#include <limits>
5
6#include "Rtypes.h"
7
8
9/**
10 * \file
11 *
12 * Type definition for counter for ROOT TTree and auxiliary methods.
13 * \author mdejong
14 */
15namespace JROOT {}
16namespace JPP { using namespace JROOT; }
17
18namespace JROOT {
19
20
21 /**
22 * Type definition for counter.
23 */
24 typedef Long64_t counter_type;
25
26
27 /**
28 * Advance counter.
29 *
30 * \param counter counter (I/O)
31 * \param value offset
32 * \param limit limit
33 * \return increment
34 */
36 const counter_type value,
37 const counter_type limit = std::numeric_limits<counter_type>::max())
38 {
39 const counter_type previous = counter;
40
41 if (counter + value < limit)
42 counter += value;
43 else
44 counter = limit;
45
46 return counter - previous;
47 }
48}
49
50#endif
This name space includes all other name spaces (except KM3NETDAQ, KM3NET and ANTARES).
Auxiliary classes and methods for ROOT I/O.
counter_type advance(counter_type &counter, const counter_type value, const counter_type limit=std::numeric_limits< counter_type >::max())
Advance counter.
Long64_t counter_type
Type definition for counter.