tudocomp
– The TU Dortmund Compression Framework
|
A data structure for counting occurences of values of a given type T. More...
#include <Counter.hpp>
Public Types | |
typedef std::unordered_map< T, size_t > | ranking_t |
Public Member Functions | |
void | increase (const T &item) |
Increase the counter for the passed value by one, setting it to 1 if it was not yet seen. More... | |
void | setCount (const T &item, size_t count) |
Set the count of an item to a specific value. More... | |
size_t | getCount (const T &item) |
Get the count associated with a value. More... | |
size_t | getNumItems () |
Return how many differnt values have been seen so far. More... | |
std::vector< std::pair< T, size_t > > | getSorted () |
Return a list of value-count pairs, sorted with the most-seen first. More... | |
ranking_t | createRanking (size_t num=SIZE_MAX) |
Return a map of the num -most common values, keyed by their common-ness, with map[0] being hte most common one. More... | |
A data structure for counting occurences of values of a given type T.
Definition at line 15 of file Counter.hpp.
typedef std::unordered_map<T, size_t> tdc::Counter< T >::ranking_t |
Definition at line 20 of file Counter.hpp.
|
inline |
Return a map of the num
-most common values, keyed by their common-ness, with map[0]
being hte most common one.
This uses the same order as getSorted().
Definition at line 75 of file Counter.hpp.
|
inline |
Get the count associated with a value.
Definition at line 37 of file Counter.hpp.
|
inline |
Return how many differnt values have been seen so far.
Definition at line 42 of file Counter.hpp.
|
inline |
Return a list of value-count pairs, sorted with the most-seen first.
Definition at line 47 of file Counter.hpp.
|
inline |
Increase the counter for the passed value by one, setting it to 1 if it was not yet seen.
Definition at line 24 of file Counter.hpp.
|
inline |
Set the count of an item to a specific value.
Definition at line 32 of file Counter.hpp.