Public Types | Public Member Functions | Protected Types | Private Member Functions | List of all members
cluster::HoughTransformCounters< KEY, COUNTER, SIZE, ALLOC, SUBCOUNTERS > Class Template Reference

CountersMap with access optimized for Hough Transform algorithm. More...

#include <HoughBaseAlg.h>

Inheritance diagram for cluster::HoughTransformCounters< KEY, COUNTER, SIZE, ALLOC, SUBCOUNTERS >:
lar::CountersMap< KEY, COUNTER, SIZE, ALLOC, SUBCOUNTERS >

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...
 
- Public Types inherited from lar::CountersMap< KEY, COUNTER, SIZE, ALLOC, SUBCOUNTERS >
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...
 
- Public Member Functions inherited from lar::CountersMap< KEY, COUNTER, SIZE, ALLOC, SUBCOUNTERS >
 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
 
- Protected Types inherited from lar::CountersMap< KEY, COUNTER, SIZE, ALLOC, SUBCOUNTERS >
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 Public Attributes inherited from lar::CountersMap< KEY, COUNTER, SIZE, ALLOC, SUBCOUNTERS >
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...
 
- Protected Member Functions inherited from lar::CountersMap< KEY, COUNTER, SIZE, ALLOC, SUBCOUNTERS >
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_tGetOrCreateCounter (CounterKey_t key)
 Returns the counter at the specified split key. More...
 
- Static Protected Member Functions inherited from lar::CountersMap< KEY, COUNTER, SIZE, ALLOC, SUBCOUNTERS >
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...
 
- Protected Attributes inherited from lar::CountersMap< KEY, COUNTER, SIZE, ALLOC, SUBCOUNTERS >
BaseMap_t counter_map
 the actual data structure for counters More...
 

Detailed Description

template<typename KEY, typename COUNTER, size_t SIZE, typename ALLOC = std::allocator<std::pair<KEY, std::array<COUNTER, SIZE>>>, unsigned int SUBCOUNTERS = 1>
class cluster::HoughTransformCounters< KEY, COUNTER, SIZE, ALLOC, SUBCOUNTERS >

CountersMap with access optimized for Hough Transform algorithm.

Parameters
KEYthe type of the key of the counters map
COUNTERthe type of a basic counter (can be signed or unsigned)
BLOCKSIZEthe number of counters in a cluster
ALLOCallocator for the underlying STL map
SUBCOUNTERSsplit each counter in subcounters (not implemented yet)
See also
CountersMap

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.

Member Typedef Documentation

template<typename KEY , typename COUNTER , size_t SIZE, typename ALLOC = std::allocator<std::pair<KEY, std::array<COUNTER, SIZE>>>, unsigned int SUBCOUNTERS = 1>
using cluster::HoughTransformCounters< KEY, COUNTER, SIZE, ALLOC, SUBCOUNTERS >::Allocator_t = typename Base_t::Allocator_t

Definition at line 286 of file HoughBaseAlg.h.

template<typename KEY , typename COUNTER , size_t SIZE, typename ALLOC = std::allocator<std::pair<KEY, std::array<COUNTER, SIZE>>>, unsigned int SUBCOUNTERS = 1>
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.

template<typename KEY , typename COUNTER , size_t SIZE, typename ALLOC = std::allocator<std::pair<KEY, std::array<COUNTER, SIZE>>>, unsigned int SUBCOUNTERS = 1>
using cluster::HoughTransformCounters< KEY, COUNTER, SIZE, ALLOC, SUBCOUNTERS >::BaseMap_t = typename Base_t::BaseMap_t

Definition at line 285 of file HoughBaseAlg.h.

template<typename KEY , typename COUNTER , size_t SIZE, typename ALLOC = std::allocator<std::pair<KEY, std::array<COUNTER, SIZE>>>, unsigned int SUBCOUNTERS = 1>
using cluster::HoughTransformCounters< KEY, COUNTER, SIZE, ALLOC, SUBCOUNTERS >::const_iterator = typename Base_t::const_iterator

Definition at line 290 of file HoughBaseAlg.h.

template<typename KEY , typename COUNTER , size_t SIZE, typename ALLOC = std::allocator<std::pair<KEY, std::array<COUNTER, SIZE>>>, unsigned int SUBCOUNTERS = 1>
using cluster::HoughTransformCounters< KEY, COUNTER, SIZE, ALLOC, SUBCOUNTERS >::CounterBlock_t = typename Base_t::CounterBlock_t

Definition at line 289 of file HoughBaseAlg.h.

template<typename KEY , typename COUNTER , size_t SIZE, typename ALLOC = std::allocator<std::pair<KEY, std::array<COUNTER, SIZE>>>, unsigned int SUBCOUNTERS = 1>
using cluster::HoughTransformCounters< KEY, COUNTER, SIZE, ALLOC, SUBCOUNTERS >::CounterKey_t = typename Base_t::CounterKey_t
protected

Definition at line 446 of file HoughBaseAlg.h.

template<typename KEY , typename COUNTER , size_t SIZE, typename ALLOC = std::allocator<std::pair<KEY, std::array<COUNTER, SIZE>>>, unsigned int SUBCOUNTERS = 1>
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.

template<typename KEY , typename COUNTER , size_t SIZE, typename ALLOC = std::allocator<std::pair<KEY, std::array<COUNTER, SIZE>>>, unsigned int SUBCOUNTERS = 1>
using cluster::HoughTransformCounters< KEY, COUNTER, SIZE, ALLOC, SUBCOUNTERS >::Key_t = typename Base_t::Key_t

Definition at line 287 of file HoughBaseAlg.h.

template<typename KEY , typename COUNTER , size_t SIZE, typename ALLOC = std::allocator<std::pair<KEY, std::array<COUNTER, SIZE>>>, unsigned int SUBCOUNTERS = 1>
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.

template<typename KEY , typename COUNTER , size_t SIZE, typename ALLOC = std::allocator<std::pair<KEY, std::array<COUNTER, SIZE>>>, unsigned int SUBCOUNTERS = 1>
using cluster::HoughTransformCounters< KEY, COUNTER, SIZE, ALLOC, SUBCOUNTERS >::SubCounter_t = typename Base_t::SubCounter_t

Definition at line 288 of file HoughBaseAlg.h.

Constructor & Destructor Documentation

template<typename KEY , typename COUNTER , size_t SIZE, typename ALLOC = std::allocator<std::pair<KEY, std::array<COUNTER, SIZE>>>, unsigned int SUBCOUNTERS = 1>
cluster::HoughTransformCounters< KEY, COUNTER, SIZE, ALLOC, SUBCOUNTERS >::HoughTransformCounters ( )
inline

Default constructor (empty map)

Definition at line 296 of file HoughBaseAlg.h.

296 : Base_t() {}
lar::CountersMap< KEY, COUNTER, SIZE, ALLOC, SUBCOUNTERS > Base_t
Base class.
Definition: HoughBaseAlg.h:282
template<typename KEY , typename COUNTER , size_t SIZE, typename ALLOC = std::allocator<std::pair<KEY, std::array<COUNTER, SIZE>>>, unsigned int SUBCOUNTERS = 1>
cluster::HoughTransformCounters< KEY, COUNTER, SIZE, ALLOC, SUBCOUNTERS >::HoughTransformCounters ( Allocator_t  alloc)
inline

Constructor, specifies an allocator.

Definition at line 299 of file HoughBaseAlg.h.

299 : Base_t(alloc) {}
lar::CountersMap< KEY, COUNTER, SIZE, ALLOC, SUBCOUNTERS > Base_t
Base class.
Definition: HoughBaseAlg.h:282

Member Function Documentation

template<typename KEY , typename COUNTER , size_t SIZE, typename ALLOC = std::allocator<std::pair<KEY, std::array<COUNTER, SIZE>>>, unsigned int SUBCOUNTERS = 1>
SubCounter_t cluster::HoughTransformCounters< KEY, COUNTER, SIZE, ALLOC, SUBCOUNTERS >::decrement ( Key_t  key)
inline

Decrements by 1 the specified counter.

Parameters
keykey of the counter to be decreased
Returns
new value of the counter

Definition at line 330 of file HoughBaseAlg.h.

331  {
332  return Base_t::decrement(key);
333  }
def key(type, name=None)
Definition: graph.py:13
template<typename K , typename C , size_t S, typename A , unsigned int SC>
void cluster::HoughTransformCounters< K, C, S, A, SC >::decrement ( Key_t  key_begin,
Key_t  key_end 
)
inline

Decrements by 1 the specified range of counters.

Parameters
key_beginkey of the first counter to be increased
key_endkey of the first counter not to be increased
See also
increment()

Definition at line 143 of file HoughBaseAlg.cxx.

144 {
146 } // cluster::HoughTransformCounters<>::decrement(begin, end)
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())
static int max(int a, int b)
template<typename K , typename C , size_t S, typename A , unsigned int SC>
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.

Parameters
current_maxonly counters larger than this will be considered
Returns
pair with an iterator to the largest counter and its value
See also
get_max(), increment_and_get_max(Key_t, Key_t)

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.

151 {
152  PairValue_t max{Base_t::make_const_iterator(Base_t::counter_map.end(), 0), current_max};
153 
154  typename BaseMap_t::const_iterator iCBlock = Base_t::counter_map.begin(),
155  cend = Base_t::counter_map.end();
156  while (iCBlock != cend) {
157  const CounterBlock_t& block = iCBlock->second;
158  for (size_t index = 0; index < block.size(); ++index) {
159  if (block[index] > max.second)
160  max = {Base_t::make_const_iterator(iCBlock, index), block[index]};
161  ++iCBlock;
162  } // for elements in this block
163  } // while blocks
164  return max;
165 } // cluster::HoughTransformCounters<>::get_max(SubCounter_t)
const_iterator end() const
Returns an iterator past-the-end of the counters.
Definition: CountersMap.h:516
decltype(auto) constexpr cend(T &&obj)
ADL-aware version of std::cend.
Definition: StdUtils.h:87
intermediate_table::const_iterator const_iterator
std::pair< const_iterator, SubCounter_t > PairValue_t
Pair identifying a counter and its current value.
Definition: HoughBaseAlg.h:293
static int max(int a, int b)
typename Base_t::CounterBlock_t CounterBlock_t
Definition: HoughBaseAlg.h:289
template<typename K , typename C , size_t S, typename A , unsigned int SC>
cluster::HoughTransformCounters< K, C, S, A, SC >::PairValue_t cluster::HoughTransformCounters< K, C, S, A, SC >::get_max ( ) const
inline

Increments by 1 the specified counters and returns the maximum.

Parameters
current_maxonly counters larger than this will be considered
Returns
pair with an iterator to the largest counter and its value
See also
get_max(SubCounter_t), increment_and_get_max(Key_t, Key_t)

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.

170 {
172 }
static int max(int a, int b)
PairValue_t get_max() const
Increments by 1 the specified counters and returns the maximum.
template<typename KEY , typename COUNTER , size_t SIZE, typename ALLOC = std::allocator<std::pair<KEY, std::array<COUNTER, SIZE>>>, unsigned int SUBCOUNTERS = 1>
SubCounter_t cluster::HoughTransformCounters< KEY, COUNTER, SIZE, ALLOC, SUBCOUNTERS >::increment ( Key_t  key)
inline

Increments by 1 the specified counter.

Parameters
keykey of the counter to be increased
Returns
new value of the counter

Definition at line 319 of file HoughBaseAlg.h.

320  {
321  return Base_t::increment(key);
322  }
def key(type, name=None)
Definition: graph.py:13
template<typename K , typename C , size_t S, typename A , unsigned int SC>
void cluster::HoughTransformCounters< K, C, S, A, SC >::increment ( Key_t  key_begin,
Key_t  key_end 
)
inline

Increments by 1 the specified range of counters.

Parameters
key_beginkey of the first counter to be increased
key_endkey of the first counter not to be increased
See also
decrement(), increment_and_get_max()

Definition at line 136 of file HoughBaseAlg.cxx.

137 {
139 } // cluster::HoughTransformCounters<>::increment(begin, end)
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())
static int max(int a, int b)
template<typename KEY , typename COUNTER , size_t SIZE, typename ALLOC = std::allocator<std::pair<KEY, std::array<COUNTER, SIZE>>>, unsigned int SUBCOUNTERS = 1>
PairValue_t cluster::HoughTransformCounters< KEY, COUNTER, SIZE, ALLOC, SUBCOUNTERS >::increment_and_get_max ( Key_t  key_begin,
Key_t  key_end 
)
inline

Increments by 1 the specified counters and returns the maximum.

Parameters
key_beginkey of the first counter to be increased
key_endkey of the first counter not to be increased
Returns
pair with an iterator to the largest counter and its value
See also
increment(Key_t, Key_t)

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.

379  {
380  return unchecked_add_range_max(key_begin, key_end, +1);
381  }
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())
template<typename KEY , typename COUNTER , size_t SIZE, typename ALLOC = std::allocator<std::pair<KEY, std::array<COUNTER, SIZE>>>, unsigned int SUBCOUNTERS = 1>
PairValue_t cluster::HoughTransformCounters< KEY, COUNTER, SIZE, ALLOC, SUBCOUNTERS >::increment_and_get_max ( Key_t  key_begin,
Key_t  key_end,
SubCounter_t  current_max 
)
inline

Increments by 1 the specified counters and returns the maximum.

Parameters
key_beginkey of the first counter to be increased
key_endkey of the first counter not to be increased
current_maxonly counters larger than this will be considered
Returns
pair with an iterator to the largest counter and its value
See also
increment(Key_t, Key_t), increment_and_get_max(Key_t, Key_t)

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.

399  {
400  return unchecked_add_range_max(key_begin, key_end, +1, current_max);
401  }
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())
template<typename KEY , typename COUNTER , size_t SIZE, typename ALLOC = std::allocator<std::pair<KEY, std::array<COUNTER, SIZE>>>, unsigned int SUBCOUNTERS = 1>
SubCounter_t cluster::HoughTransformCounters< KEY, COUNTER, SIZE, ALLOC, SUBCOUNTERS >::set ( Key_t  key,
SubCounter_t  value 
)
inline

Sets the specified counter to a count value.

Parameters
keykey of the counter to be set
valuethe count value
Returns
new value of the counter

Definition at line 308 of file HoughBaseAlg.h.

309  {
310  return Base_t::set(key, value);
311  }
def key(type, name=None)
Definition: graph.py:13
template<typename KEY , typename COUNTER , size_t SIZE, typename ALLOC = std::allocator<std::pair<KEY, std::array<COUNTER, SIZE>>>, unsigned int SUBCOUNTERS = 1>
SubCounter_t cluster::HoughTransformCounters< KEY, COUNTER, SIZE, ALLOC, SUBCOUNTERS >::set ( Key_t  key_begin,
Key_t  key_end,
SubCounter_t  value 
)
inline

Sets the specified range of counters to a count value.

Parameters
key_beginkey of the first counter to be set
key_endkey of the first counter not to be set
valuethe count value
Returns
new value of all the counters
See also
increment(), decrement(), increment_and_get_max()

Definition at line 344 of file HoughBaseAlg.h.

345  {
346  return unchecked_set_range(key_begin, key_end, value);
347  }
SubCounter_t unchecked_set_range(Key_t key_begin, Key_t key_end, SubCounter_t value, typename BaseMap_t::iterator start)
template<typename K , typename C , size_t S, typename A , unsigned int SC>
cluster::HoughTransformCounters< K, C, S, A, SC >::PairValue_t cluster::HoughTransformCounters< K, C, S, A, SC >::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() 
)
private

Definition at line 212 of file HoughBaseAlg.cxx.

219 {
220  PairValue_t max{Base_t::make_const_iterator(Base_t::counter_map.end(), 0), min_max};
221  if (key_begin > key_end) return max;
222  CounterKey_t key(key_begin);
223  size_t left = key_end - key_begin;
224  while (true) {
225  if ((iIP == Base_t::counter_map.end()) || (iIP->first != key.block)) {
226  // we don't have that block yet
227  iIP = Base_t::counter_map.insert(iIP, {key.block, {}});
228  } // if need to add a block
229  CounterBlock_t& block = iIP->second;
230  size_t n = std::min(left, Base_t::NCounters - key.counter);
231  left -= n;
232  while (n--) {
233  SubCounter_t value = (block[key.counter] += delta);
234  if (value > max.second) { max = {Base_t::make_const_iterator(iIP, key.counter), value}; }
235  ++(key.counter);
236  } // for key.counter
237  if (left <= 0) break;
238  key.next_block();
239  ++iIP;
240  } // while
241  return max;
242 } // cluster::HoughTransformCounters<>::unchecked_add_range_max()
typename Base_t::SubCounter_t SubCounter_t
Definition: HoughBaseAlg.h:288
const_iterator end() const
Returns an iterator past-the-end of the counters.
Definition: CountersMap.h:516
typename Base_t::CounterKey_t CounterKey_t
Definition: HoughBaseAlg.h:446
std::pair< const_iterator, SubCounter_t > PairValue_t
Pair identifying a counter and its current value.
Definition: HoughBaseAlg.h:293
def key(type, name=None)
Definition: graph.py:13
std::void_t< T > n
static int max(int a, int b)
typename Base_t::CounterBlock_t CounterBlock_t
Definition: HoughBaseAlg.h:289
T min(sqlite3 *const db, std::string const &table_name, std::string const &column_name)
Definition: statistics.h:55
template<typename K , typename C , size_t S, typename A , unsigned int SC>
cluster::HoughTransformCounters< K, C, S, A, SC >::PairValue_t cluster::HoughTransformCounters< K, C, S, A, SC >::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() 
)
inlineprivate

Definition at line 246 of file HoughBaseAlg.cxx.

252 {
253  return unchecked_add_range_max(key_begin,
254  key_end,
255  delta,
256  Base_t::counter_map.lower_bound(CounterKey_t(key_begin).block),
257  min_max);
258 } // cluster::HoughTransformCounters<>::unchecked_add_range_max(no hint)
typename Base_t::CounterKey_t CounterKey_t
Definition: HoughBaseAlg.h:446
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())
template<typename K , typename C , size_t S, typename A , unsigned int SC>
cluster::HoughTransformCounters< K, C, S, A, SC >::SubCounter_t cluster::HoughTransformCounters< K, C, S, A, SC >::unchecked_set_range ( Key_t  key_begin,
Key_t  key_end,
SubCounter_t  value,
typename BaseMap_t::iterator  start 
)
private

Definition at line 176 of file HoughBaseAlg.cxx.

181 {
182  if (key_begin > key_end) return value;
183  CounterKey_t key(key_begin);
184  size_t left = key_end - key_begin;
185  while (true) {
186  if ((iIP == Base_t::counter_map.end()) || (iIP->first != key.block)) {
187  // we don't have that block yet
188  iIP = Base_t::counter_map.insert(iIP, {key.block, {}});
189  } // if need to add a block
190  CounterBlock_t& block = iIP->second;
191  size_t n = std::min(left, Base_t::NCounters - key.counter);
192  block.fill(key.counter, n, value);
193  if (left -= n <= 0) break;
194  key.next_block();
195  ++iIP;
196  } // while
197  return value;
198 } // cluster::HoughTransformCounters<>::unchecked_set_range()
const_iterator end() const
Returns an iterator past-the-end of the counters.
Definition: CountersMap.h:516
typename Base_t::CounterKey_t CounterKey_t
Definition: HoughBaseAlg.h:446
def key(type, name=None)
Definition: graph.py:13
std::void_t< T > n
typename Base_t::CounterBlock_t CounterBlock_t
Definition: HoughBaseAlg.h:289
T min(sqlite3 *const db, std::string const &table_name, std::string const &column_name)
Definition: statistics.h:55
template<typename K , typename C , size_t S, typename A , unsigned int SC>
cluster::HoughTransformCounters< K, C, S, A, SC >::SubCounter_t cluster::HoughTransformCounters< K, C, S, A, SC >::unchecked_set_range ( Key_t  key_begin,
Key_t  key_end,
SubCounter_t  value 
)
inlineprivate

Definition at line 202 of file HoughBaseAlg.cxx.

205 {
206  return unchecked_set_range(
207  key_begin, key_end, value, Base_t::counter_map.lower_bound(CounterKey_t(key_begin).block));
208 } // cluster::HoughTransformCounters<>::unchecked_set_range(no hint)
typename Base_t::CounterKey_t CounterKey_t
Definition: HoughBaseAlg.h:446
SubCounter_t unchecked_set_range(Key_t key_begin, Key_t key_end, SubCounter_t value, typename BaseMap_t::iterator start)

The documentation for this class was generated from the following files: