TSDuck v3.40-3963
MPEG Transport Stream Toolkit
|
Generic map of integers, indexed by integer. More...
#include <tsIntegerMap.h>
Public Types | |
using | SuperClass = std::map< KEY, VALUE > |
Identification of the superclass. | |
Public Member Functions | |
IntegerMap () | |
Default constructor. | |
void | accumulate (const IntegerMap &val) |
Accumulate all values from another map. | |
void | addKeys (json::Value &parent, const UString &path, bool ignore_empty) const |
Add a list of all keys as a JSON array. | |
void | addNormalizedKeys (std::ostream &stm, const UChar *type, bool ignore_empty) const |
Display a normalized representation of all keys in the map. | |
UString | toNormalizedKeys () const |
Build a string of all keys for "normalized" output in TSDuck. | |
UString | toStringKeys (VALUE total=0) const |
Format a string for all keys in the map. | |
Static Public Attributes | |
static const UString & | KEY_NAMES_SECTION |
Name of the section which define names for the keys in the map. | |
Generic map of integers, indexed by integer.
void ts::IntegerMap< KEY, VALUE, KEYNAMESECTION, NAMESFILE, N >::accumulate | ( | const IntegerMap< KEY, VALUE, KEYNAMESECTION, NAMESFILE, > & | val | ) |
Accumulate all values from another map.
Non-existent entries in this object are implicitely created.
[in] | val | Value map to add. |
ts::UString ts::IntegerMap< KEY, VALUE, KEYNAMESECTION, NAMESFILE, N >::toStringKeys | ( | VALUE | total = 0 | ) | const |
Format a string for all keys in the map.
Include percentages of values and key name.
[in] | total | Total sum of values. Can be larger than the sum of values in the map. If zero, the total is computed from the map. |
ts::UString ts::IntegerMap< KEY, VALUE, KEYNAMESECTION, NAMESFILE, N >::toNormalizedKeys | ( | ) | const |
Build a string of all keys for "normalized" output in TSDuck.
void ts::IntegerMap< KEY, VALUE, KEYNAMESECTION, NAMESFILE, N >::addNormalizedKeys | ( | std::ostream & | stm, |
const UChar * | type, | ||
bool | ignore_empty | ||
) | const |
Display a normalized representation of all keys in the map.
When the value is displayed, it is followed by a column.
[in,out] | stm | Output stream on which the map is displayed. |
[in] | type | Type of the entry, as in "type=1,2,7:" |
[in] | ignore_empty | If true and the map is empty, display nothing. |
void ts::IntegerMap< KEY, VALUE, KEYNAMESECTION, NAMESFILE, N >::addKeys | ( | json::Value & | parent, |
const UString & | path, | ||
bool | ignore_empty | ||
) | const |
Add a list of all keys as a JSON array.
[in,out] | parent | Existing JSON parent. |
[in] | path | Path to access or create under parent. The created node is a JSON array. |
[in] | ignore_empty | If true and the map is empty, do nothing. |