CountersMap with access optimized for Hough Transform algorithm. More...
#include <HoughBaseAlg.h>
Public Types | |
using | CounterMap_t = HoughTransformCounters< KEY, COUNTER, SIZE, ALLOC, SUBCOUNTERS > |
This class. More... | |
using | Base_t = lar::CountersMap< KEY, COUNTER, SIZE, ALLOC, SUBCOUNTERS > |
Base class. More... | |
using | BaseMap_t = typename Base_t::BaseMap_t |
using | Allocator_t = typename Base_t::Allocator_t |
using | Key_t = typename Base_t::Key_t |
using | SubCounter_t = typename Base_t::SubCounter_t |
using | CounterBlock_t = typename Base_t::CounterBlock_t |
using | const_iterator = typename Base_t::const_iterator |
using | PairValue_t = std::pair< const_iterator, SubCounter_t > |
Pair identifying a counter and its current value. More... | |
![]() | |
using | Key_t = KEY |
type of counter key in the map More... | |
using | Counter_t = COUNTER |
type of the single counter More... | |
using | Allocator_t = ALLOC |
type of the single counter More... | |
using | CounterMap_t = CountersMap< KEY, COUNTER, SIZE, ALLOC, SUBCOUNTERS > |
This class. More... | |
using | SubCounter_t = Counter_t |
Type of the subcounter (that is, the actual counter) More... | |
using | CounterBlock_t = typename Traits_t::CounterBlock_t |
using | BaseMap_t = typename Traits_t::template BaseMap_t< typename std::allocator_traits< Allocator_t >::template rebind_alloc< typename Traits_t::MapValue_t > > |
Type of the map used in the implementation. More... | |
using | value_type = std::pair< const Key_t, SubCounter_t > |
using | mapped_type = SubCounter_t |
using | allocator_type = Allocator_t |
type of the single counter More... | |
Public Member Functions | |
HoughTransformCounters () | |
Default constructor (empty map) More... | |
HoughTransformCounters (Allocator_t alloc) | |
Constructor, specifies an allocator. More... | |
SubCounter_t | set (Key_t key, SubCounter_t value) |
Sets the specified counter to a count value. More... | |
SubCounter_t | increment (Key_t key) |
Increments by 1 the specified counter. More... | |
SubCounter_t | decrement (Key_t key) |
Decrements by 1 the specified counter. More... | |
SubCounter_t | set (Key_t key_begin, Key_t key_end, SubCounter_t value) |
Sets the specified range of counters to a count value. More... | |
void | increment (Key_t key_begin, Key_t key_end) |
Increments by 1 the specified range of counters. More... | |
PairValue_t | increment_and_get_max (Key_t key_begin, Key_t key_end) |
Increments by 1 the specified counters and returns the maximum. More... | |
PairValue_t | increment_and_get_max (Key_t key_begin, Key_t key_end, SubCounter_t current_max) |
Increments by 1 the specified counters and returns the maximum. More... | |
void | decrement (Key_t key_begin, Key_t key_end) |
Decrements by 1 the specified range of counters. More... | |
PairValue_t | get_max (SubCounter_t current_max) const |
Returns the largest counter. More... | |
PairValue_t | get_max () const |
Increments by 1 the specified counters and returns the maximum. More... | |
![]() | |
CountersMap () | |
Default constructor (empty map) More... | |
CountersMap (Allocator_t alloc) | |
Constructor, specifies an allocator. More... | |
SubCounter_t | operator[] (Key_t key) const |
Read-only access to an element; returns 0 if no counter is present. More... | |
SubCounter_t | set (Key_t key, SubCounter_t value) |
Sets the specified counter to a count. More... | |
SubCounter_t | increment (Key_t key) |
Increments by 1 the specified counter. More... | |
SubCounter_t | decrement (Key_t key) |
Decrements by 1 the specified counter. More... | |
bool | empty () const |
Returns whether the map has no counters. More... | |
std::make_unsigned< Key_t >::type | n_counters () const |
Returns the number of allocated counters. More... | |
template<typename OALLOC > | |
bool | is_equal (const std::map< Key_t, SubCounter_t, std::less< Key_t >, OALLOC > &to, Key_t &first_difference) const |
Returns whether the counters in this map are equivalent to another. More... | |
template<typename OALLOC > | |
bool | is_equal (const std::map< Key_t, SubCounter_t, std::less< Key_t >, OALLOC > &to) const |
Returns whether the counters in this map are equivalent to another. More... | |
const_iterator | begin () const |
Returns an iterator to the begin of the counters. More... | |
const_iterator | end () const |
Returns an iterator past-the-end of the counters. More... | |
Protected Types | |
using | CounterKey_t = typename Base_t::CounterKey_t |
![]() | |
using | BlockKey_t = Key_t |
type of block key More... | |
using | CounterIndex_t = typename std::make_unsigned< Key_t >::type |
type of index in the block More... | |
Private Member Functions | |
SubCounter_t | unchecked_set_range (Key_t key_begin, Key_t key_end, SubCounter_t value, typename BaseMap_t::iterator start) |
SubCounter_t | unchecked_set_range (Key_t key_begin, Key_t key_end, SubCounter_t value) |
PairValue_t | unchecked_add_range_max (Key_t key_begin, Key_t key_end, SubCounter_t delta, typename BaseMap_t::iterator start, SubCounter_t min_max=std::numeric_limits< SubCounter_t >::min()) |
PairValue_t | unchecked_add_range_max (Key_t key_begin, Key_t key_end, SubCounter_t delta, SubCounter_t min_max=std::numeric_limits< SubCounter_t >::min()) |
Additional Inherited Members | |
![]() | |
static constexpr size_t | NCounters = Traits_t::NCounters |
Number of counters in one counter block. More... | |
static constexpr size_t | NSubcounters = NCounters * SUBCOUNTERS |
Number of subcounters in one counter block. More... | |
![]() | |
Counter_t | GetCounter (CounterKey_t key) const |
Returns the value of the counter at the specified split key. More... | |
SubCounter_t | GetSubCounter (CounterKey_t key) const |
Returns the value of the subcounter at the specified split key. More... | |
Counter_t & | GetOrCreateCounter (CounterKey_t key) |
Returns the counter at the specified split key. More... | |
![]() | |
static CounterKey_t | SplitKey (Key_t key) |
Returns a split key corresponding to the specified key. More... | |
static const_iterator | make_const_iterator (typename BaseMap_t::const_iterator it, size_t ix) |
Creates a const_iterator (useful in derived classes) More... | |
![]() | |
BaseMap_t | counter_map |
the actual data structure for counters More... | |
CountersMap with access optimized for Hough Transform algorithm.
KEY | the type of the key of the counters map |
COUNTER | the type of a basic counter (can be signed or unsigned) |
BLOCKSIZE | the number of counters in a cluster |
ALLOC | allocator for the underlying STL map |
SUBCOUNTERS | split each counter in subcounters (not implemented yet) |
In addition to the standard CountersMap interface, a special range increment, increment with max detection and decrement methods are provided.
Definition at line 277 of file HoughBaseAlg.h.
using cluster::HoughTransformCounters< KEY, COUNTER, SIZE, ALLOC, SUBCOUNTERS >::Allocator_t = typename Base_t::Allocator_t |
Definition at line 286 of file HoughBaseAlg.h.
using cluster::HoughTransformCounters< KEY, COUNTER, SIZE, ALLOC, SUBCOUNTERS >::Base_t = lar::CountersMap<KEY, COUNTER, SIZE, ALLOC, SUBCOUNTERS> |
Base class.
Definition at line 282 of file HoughBaseAlg.h.
using cluster::HoughTransformCounters< KEY, COUNTER, SIZE, ALLOC, SUBCOUNTERS >::BaseMap_t = typename Base_t::BaseMap_t |
Definition at line 285 of file HoughBaseAlg.h.
using cluster::HoughTransformCounters< KEY, COUNTER, SIZE, ALLOC, SUBCOUNTERS >::const_iterator = typename Base_t::const_iterator |
Definition at line 290 of file HoughBaseAlg.h.
using cluster::HoughTransformCounters< KEY, COUNTER, SIZE, ALLOC, SUBCOUNTERS >::CounterBlock_t = typename Base_t::CounterBlock_t |
Definition at line 289 of file HoughBaseAlg.h.
|
protected |
Definition at line 446 of file HoughBaseAlg.h.
using cluster::HoughTransformCounters< KEY, COUNTER, SIZE, ALLOC, SUBCOUNTERS >::CounterMap_t = HoughTransformCounters<KEY, COUNTER, SIZE, ALLOC, SUBCOUNTERS> |
This class.
Definition at line 280 of file HoughBaseAlg.h.
using cluster::HoughTransformCounters< KEY, COUNTER, SIZE, ALLOC, SUBCOUNTERS >::Key_t = typename Base_t::Key_t |
Definition at line 287 of file HoughBaseAlg.h.
using cluster::HoughTransformCounters< KEY, COUNTER, SIZE, ALLOC, SUBCOUNTERS >::PairValue_t = std::pair<const_iterator, SubCounter_t> |
Pair identifying a counter and its current value.
Definition at line 293 of file HoughBaseAlg.h.
using cluster::HoughTransformCounters< KEY, COUNTER, SIZE, ALLOC, SUBCOUNTERS >::SubCounter_t = typename Base_t::SubCounter_t |
Definition at line 288 of file HoughBaseAlg.h.
|
inline |
Default constructor (empty map)
Definition at line 296 of file HoughBaseAlg.h.
|
inline |
Constructor, specifies an allocator.
Definition at line 299 of file HoughBaseAlg.h.
|
inline |
Decrements by 1 the specified counter.
key | key of the counter to be decreased |
Definition at line 330 of file HoughBaseAlg.h.
|
inline |
Decrements by 1 the specified range of counters.
key_begin | key of the first counter to be increased |
key_end | key of the first counter not to be increased |
Definition at line 143 of file HoughBaseAlg.cxx.
cluster::HoughTransformCounters< K, C, S, A, SC >::PairValue_t cluster::HoughTransformCounters< K, C, S, A, SC >::get_max | ( | SubCounter_t | current_max | ) | const |
Returns the largest counter.
current_max | only counters larger than this will be considered |
All counters are parsed, and the first one with the largest count is returned. The return value consist of a pair: the second is the largest counter value, the first member is the constant iterator pointing to the first (lowest key) counter with that (get its key with const_iterator::key() method).
This method does not update the maximum if it's not (strictly) larger than current_max. If no such a maximum is found, the maximum in the return value is equal to current_max, while the iterator points to the end of the map (end()).
Definition at line 150 of file HoughBaseAlg.cxx.
|
inline |
Increments by 1 the specified counters and returns the maximum.
current_max | only counters larger than this will be considered |
This method works like get_max() method, except that it does not update the maximum if it's not (strictly) larger than current_max. If no such a maximum is found, the maximum in the return value is equal to current_max, while the iterator points to the end of the map (end()).
Definition at line 169 of file HoughBaseAlg.cxx.
|
inline |
Increments by 1 the specified counter.
key | key of the counter to be increased |
Definition at line 319 of file HoughBaseAlg.h.
|
inline |
Increments by 1 the specified range of counters.
key_begin | key of the first counter to be increased |
key_end | key of the first counter not to be increased |
Definition at line 136 of file HoughBaseAlg.cxx.
|
inline |
Increments by 1 the specified counters and returns the maximum.
key_begin | key of the first counter to be increased |
key_end | key of the first counter not to be increased |
This method works like the corresponding increment() method, and in addition it returns the location of the counter with the largest count (after the increase). The return value consist of a pair: the second is the largest counter value in the range after the increase, the first member is the constant iterator pointing to the first (lowest key) counter with that (get its key with const_iterator::key() method).
If no maximum is found, the maximum in the return value is equal to current_max, while the iterator points to the end of the map (end()). Note that if all the counters are at the minimum possible value, no maximum will be returned.
Definition at line 378 of file HoughBaseAlg.h.
|
inline |
Increments by 1 the specified counters and returns the maximum.
key_begin | key of the first counter to be increased |
key_end | key of the first counter not to be increased |
current_max | only counters larger than this will be considered |
This method works like increment_and_get_max() method, except that it does not update the maximum if it's not (strictly) larger than current_max. If no such a maximum is found, the maximum in the return value is equal to current_max, while the iterator points to the end of the map (end()).
Definition at line 398 of file HoughBaseAlg.h.
|
inline |
Sets the specified counter to a count value.
key | key of the counter to be set |
value | the count value |
Definition at line 308 of file HoughBaseAlg.h.
|
inline |
Sets the specified range of counters to a count value.
key_begin | key of the first counter to be set |
key_end | key of the first counter not to be set |
value | the count value |
Definition at line 344 of file HoughBaseAlg.h.
|
private |
Definition at line 212 of file HoughBaseAlg.cxx.
|
inlineprivate |
Definition at line 246 of file HoughBaseAlg.cxx.
|
private |
Definition at line 176 of file HoughBaseAlg.cxx.
|
inlineprivate |
Definition at line 202 of file HoughBaseAlg.cxx.