#ifndef __JROOT__JCOUNTER__ #define __JROOT__JCOUNTER__ #include #include "Rtypes.h" /** * \file * * Type definition for counter for ROOT TTree and auxiliary methods. * \author mdejong */ namespace JROOT {} namespace JPP { using namespace JROOT; } namespace JROOT { /** * Type definition for counter. */ typedef Long64_t counter_type; /** * Advance counter. * * \param counter counter (I/O) * \param value offset * \param limit limit * \return increment */ inline counter_type advance(counter_type& counter, const counter_type value, const counter_type limit = std::numeric_limits::max()) { const counter_type previous = counter; if (counter + value < limit) counter += value; else counter = limit; return counter - previous; } } #endif