LArSoft  v09_90_00
Liquid Argon Software toolkit - https://larsoft.org/
lar::CountersMap< KEY, COUNTER, SIZE, ALLOC, SUBCOUNTERS >::CounterKey_t Struct Reference

Structure with the index of the counter, split as needed. More...

#include "CountersMap.h"

Public Member Functions

 CounterKey_t ()
 
 CounterKey_t (BlockKey_t major, CounterIndex_t minor)
 Constructor from a pair. More...
 
 CounterKey_t (Key_t key)
 Initialize from a mangled key. More...
 
Key_t Key () const
 Returns the full key. More...
 
 operator Key_t () const
 Conversion of this key into a number (. More...
 
CounterKey_toperator++ ()
 
CounterKey_toperator-- ()
 
CounterKey_toperator++ (int)
 
CounterKey_toperator-- (int)
 
CounterKey_tstart_block ()
 Skips to the beginning of this block. More...
 
CounterKey_tprev_block ()
 Skips to the beginning of the previous block. More...
 
CounterKey_tnext_block ()
 Skips to the beginning of the next block. More...
 

Public Attributes

BlockKey_t block
 key of the counter block More...
 
CounterIndex_t counter
 index of the counter in the block More...
 

Static Public Attributes

static constexpr Key_t MinorKeyRange = NSubcounters
 Number of values of the minor key. More...
 
static constexpr Key_t MinorKeyBits = LowestSetBit(MinorKeyRange)
 Number of bits for the minor key. More...
 
static constexpr Key_t MinorKeyMask = MinorKeyRange - 1
 Bit mask for the minor key. More...
 

Detailed Description

template<typename KEY, typename COUNTER, size_t SIZE, typename ALLOC = typename details::CountersMapTraits<KEY, COUNTER, SIZE>::DefaultAllocator_t, unsigned int SUBCOUNTERS = 1>
struct lar::CountersMap< KEY, COUNTER, SIZE, ALLOC, SUBCOUNTERS >::CounterKey_t

Structure with the index of the counter, split as needed.

Definition at line 275 of file CountersMap.h.

Constructor & Destructor Documentation

template<typename KEY, typename COUNTER, size_t SIZE, typename ALLOC = typename details::CountersMapTraits<KEY, COUNTER, SIZE>::DefaultAllocator_t, unsigned int SUBCOUNTERS = 1>
lar::CountersMap< KEY, COUNTER, SIZE, ALLOC, SUBCOUNTERS >::CounterKey_t::CounterKey_t ( )
inline

Definition at line 280 of file CountersMap.h.

280 : block(0), counter(0) {}
CounterIndex_t counter
index of the counter in the block
Definition: CountersMap.h:277
BlockKey_t block
key of the counter block
Definition: CountersMap.h:276
template<typename KEY, typename COUNTER, size_t SIZE, typename ALLOC = typename details::CountersMapTraits<KEY, COUNTER, SIZE>::DefaultAllocator_t, unsigned int SUBCOUNTERS = 1>
lar::CountersMap< KEY, COUNTER, SIZE, ALLOC, SUBCOUNTERS >::CounterKey_t::CounterKey_t ( BlockKey_t  major,
CounterIndex_t  minor 
)
inline

Constructor from a pair.

Definition at line 283 of file CountersMap.h.

283 : block(major), counter(minor) {}
CounterIndex_t counter
index of the counter in the block
Definition: CountersMap.h:277
BlockKey_t block
key of the counter block
Definition: CountersMap.h:276
template<typename KEY, typename COUNTER, size_t SIZE, typename ALLOC = typename details::CountersMapTraits<KEY, COUNTER, SIZE>::DefaultAllocator_t, unsigned int SUBCOUNTERS = 1>
lar::CountersMap< KEY, COUNTER, SIZE, ALLOC, SUBCOUNTERS >::CounterKey_t::CounterKey_t ( Key_t  key)
inline

Initialize from a mangled key.

Definition at line 286 of file CountersMap.h.

287  : // CounterKey_t(key >> MinorKeyBits, key & MinorKeyMask) {}
288  CounterKey_t(key & ~MinorKeyMask, key & MinorKeyMask)
289  {}
static constexpr Key_t MinorKeyMask
Bit mask for the minor key.
Definition: CountersMap.h:352

Member Function Documentation

template<typename KEY, typename COUNTER, size_t SIZE, typename ALLOC = typename details::CountersMapTraits<KEY, COUNTER, SIZE>::DefaultAllocator_t, unsigned int SUBCOUNTERS = 1>
Key_t lar::CountersMap< KEY, COUNTER, SIZE, ALLOC, SUBCOUNTERS >::CounterKey_t::Key ( ) const
inline

Returns the full key.

Definition at line 293 of file CountersMap.h.

References util::counter().

293 { return block + counter; }
CounterIndex_t counter
index of the counter in the block
Definition: CountersMap.h:277
BlockKey_t block
key of the counter block
Definition: CountersMap.h:276
template<typename KEY, typename COUNTER, size_t SIZE, typename ALLOC = typename details::CountersMapTraits<KEY, COUNTER, SIZE>::DefaultAllocator_t, unsigned int SUBCOUNTERS = 1>
CounterKey_t& lar::CountersMap< KEY, COUNTER, SIZE, ALLOC, SUBCOUNTERS >::CounterKey_t::next_block ( )
inline

Skips to the beginning of the next block.

Definition at line 339 of file CountersMap.h.

340  {
341  block += MinorKeyRange;
342  return start_block();
343  }
static constexpr Key_t MinorKeyRange
Number of values of the minor key.
Definition: CountersMap.h:346
BlockKey_t block
key of the counter block
Definition: CountersMap.h:276
CounterKey_t & start_block()
Skips to the beginning of this block.
Definition: CountersMap.h:325
template<typename KEY, typename COUNTER, size_t SIZE, typename ALLOC = typename details::CountersMapTraits<KEY, COUNTER, SIZE>::DefaultAllocator_t, unsigned int SUBCOUNTERS = 1>
lar::CountersMap< KEY, COUNTER, SIZE, ALLOC, SUBCOUNTERS >::CounterKey_t::operator Key_t ( ) const
inline

Conversion of this key into a number (.

See also
Key())

Definition at line 296 of file CountersMap.h.

296 { return Key(); }
Key_t Key() const
Returns the full key.
Definition: CountersMap.h:293
template<typename KEY, typename COUNTER, size_t SIZE, typename ALLOC = typename details::CountersMapTraits<KEY, COUNTER, SIZE>::DefaultAllocator_t, unsigned int SUBCOUNTERS = 1>
CounterKey_t& lar::CountersMap< KEY, COUNTER, SIZE, ALLOC, SUBCOUNTERS >::CounterKey_t::operator++ ( )
inline

Definition at line 298 of file CountersMap.h.

299  {
300  if (++counter == MinorKeyRange) next_block();
301  return *this;
302  }
CounterIndex_t counter
index of the counter in the block
Definition: CountersMap.h:277
static constexpr Key_t MinorKeyRange
Number of values of the minor key.
Definition: CountersMap.h:346
CounterKey_t & next_block()
Skips to the beginning of the next block.
Definition: CountersMap.h:339
template<typename KEY, typename COUNTER, size_t SIZE, typename ALLOC = typename details::CountersMapTraits<KEY, COUNTER, SIZE>::DefaultAllocator_t, unsigned int SUBCOUNTERS = 1>
CounterKey_t& lar::CountersMap< KEY, COUNTER, SIZE, ALLOC, SUBCOUNTERS >::CounterKey_t::operator++ ( int  )
inline

Definition at line 311 of file CountersMap.h.

312  {
313  CounterKey_t old(*this);
314  this->operator++();
315  return old;
316  }
template<typename KEY, typename COUNTER, size_t SIZE, typename ALLOC = typename details::CountersMapTraits<KEY, COUNTER, SIZE>::DefaultAllocator_t, unsigned int SUBCOUNTERS = 1>
CounterKey_t& lar::CountersMap< KEY, COUNTER, SIZE, ALLOC, SUBCOUNTERS >::CounterKey_t::operator-- ( )
inline

Definition at line 303 of file CountersMap.h.

304  {
305  if (counter-- == 0) {
306  prev_block();
307  counter = MinorKeyRange - 1;
308  }
309  return *this;
310  } // operator--()
CounterIndex_t counter
index of the counter in the block
Definition: CountersMap.h:277
static constexpr Key_t MinorKeyRange
Number of values of the minor key.
Definition: CountersMap.h:346
CounterKey_t & prev_block()
Skips to the beginning of the previous block.
Definition: CountersMap.h:332
template<typename KEY, typename COUNTER, size_t SIZE, typename ALLOC = typename details::CountersMapTraits<KEY, COUNTER, SIZE>::DefaultAllocator_t, unsigned int SUBCOUNTERS = 1>
CounterKey_t& lar::CountersMap< KEY, COUNTER, SIZE, ALLOC, SUBCOUNTERS >::CounterKey_t::operator-- ( int  )
inline

Definition at line 317 of file CountersMap.h.

318  {
319  CounterKey_t old(*this);
320  this->operator--();
321  return old;
322  }
template<typename KEY, typename COUNTER, size_t SIZE, typename ALLOC = typename details::CountersMapTraits<KEY, COUNTER, SIZE>::DefaultAllocator_t, unsigned int SUBCOUNTERS = 1>
CounterKey_t& lar::CountersMap< KEY, COUNTER, SIZE, ALLOC, SUBCOUNTERS >::CounterKey_t::prev_block ( )
inline

Skips to the beginning of the previous block.

Definition at line 332 of file CountersMap.h.

333  {
334  block -= MinorKeyRange;
335  return start_block();
336  }
static constexpr Key_t MinorKeyRange
Number of values of the minor key.
Definition: CountersMap.h:346
BlockKey_t block
key of the counter block
Definition: CountersMap.h:276
CounterKey_t & start_block()
Skips to the beginning of this block.
Definition: CountersMap.h:325
template<typename KEY, typename COUNTER, size_t SIZE, typename ALLOC = typename details::CountersMapTraits<KEY, COUNTER, SIZE>::DefaultAllocator_t, unsigned int SUBCOUNTERS = 1>
CounterKey_t& lar::CountersMap< KEY, COUNTER, SIZE, ALLOC, SUBCOUNTERS >::CounterKey_t::start_block ( )
inline

Skips to the beginning of this block.

Definition at line 325 of file CountersMap.h.

326  {
327  counter = 0;
328  return *this;
329  }
CounterIndex_t counter
index of the counter in the block
Definition: CountersMap.h:277

Member Data Documentation

template<typename KEY, typename COUNTER, size_t SIZE, typename ALLOC = typename details::CountersMapTraits<KEY, COUNTER, SIZE>::DefaultAllocator_t, unsigned int SUBCOUNTERS = 1>
BlockKey_t lar::CountersMap< KEY, COUNTER, SIZE, ALLOC, SUBCOUNTERS >::CounterKey_t::block
template<typename KEY, typename COUNTER, size_t SIZE, typename ALLOC = typename details::CountersMapTraits<KEY, COUNTER, SIZE>::DefaultAllocator_t, unsigned int SUBCOUNTERS = 1>
CounterIndex_t lar::CountersMap< KEY, COUNTER, SIZE, ALLOC, SUBCOUNTERS >::CounterKey_t::counter
template<typename KEY, typename COUNTER, size_t SIZE, typename ALLOC = typename details::CountersMapTraits<KEY, COUNTER, SIZE>::DefaultAllocator_t, unsigned int SUBCOUNTERS = 1>
constexpr Key_t lar::CountersMap< KEY, COUNTER, SIZE, ALLOC, SUBCOUNTERS >::CounterKey_t::MinorKeyBits = LowestSetBit(MinorKeyRange)
static

Number of bits for the minor key.

Definition at line 349 of file CountersMap.h.

template<typename KEY, typename COUNTER, size_t SIZE, typename ALLOC = typename details::CountersMapTraits<KEY, COUNTER, SIZE>::DefaultAllocator_t, unsigned int SUBCOUNTERS = 1>
constexpr Key_t lar::CountersMap< KEY, COUNTER, SIZE, ALLOC, SUBCOUNTERS >::CounterKey_t::MinorKeyMask = MinorKeyRange - 1
static

Bit mask for the minor key.

Definition at line 352 of file CountersMap.h.

template<typename KEY, typename COUNTER, size_t SIZE, typename ALLOC = typename details::CountersMapTraits<KEY, COUNTER, SIZE>::DefaultAllocator_t, unsigned int SUBCOUNTERS = 1>
constexpr Key_t lar::CountersMap< KEY, COUNTER, SIZE, ALLOC, SUBCOUNTERS >::CounterKey_t::MinorKeyRange = NSubcounters
static

Number of values of the minor key.

Definition at line 346 of file CountersMap.h.


The documentation for this struct was generated from the following file: