wex v24.10.0
|
Offers base statistics. More...
#include <wex/common/statistics.h>
Public Member Functions | |
statistics (const std::vector< std::pair< const std::string, T > > &v={}) | |
Default constructor. | |
virtual | ~statistics ()=default |
Destructor. | |
statistics & | operator+= (const statistics &s) |
Adds other statistics. | |
virtual void | clear () |
Clears the items. | |
const T | dec (const std::string &key, T dec_value=1) |
Decrements key with value. | |
bool | empty () const |
Returns true if items are empty. | |
const std::string | get () const |
Returns all items as a string. | |
const T | get (const std::string &key) const |
Returns value for specified key. | |
const auto & | get_items () const |
Returns the items. | |
const T | inc (const std::string &key, T inc_value=1) |
Increments key with value. | |
virtual const T | set (const std::string &key, T value) |
Sets key to value. | |
Offers base statistics.
All statistics involve a key value pair, where the key is a string, and the value a template. There are some virtual methods you can use in a base class e.g. to show the statistics on a grid, that is automatically updated whenever statistics change.
|
inlineexplicit |
Default constructor.
You can specify a vector of values to initialize the statistics.
|
inlinevirtual |
Clears the items.
If you have shown the statistics the window is updated as well.
Reimplemented in wex::grid_statistics< T >.
|
inline |
Returns all items as a string.
All items are returned as a string, with comma's separating items, and a : separating key and value.
|
inlinevirtual |
Sets key to value.
If you have shown the statistics the window is updated as well.
Reimplemented in wex::grid_statistics< T >.