DiSMEC++
|
A tag container combines a name with a shared pointer, which points to the tag value. More...
#include <stats_base.h>
Public Member Functions | |
const std::string & | get_name () const |
returns the name of the associated tag More... | |
int | get_value () const |
Returns the current value of the tag. Requires the container to not be empty. More... | |
bool | is_empty () const |
void | set_value (int value) |
Updates the value of the tag. Requires the container to not be empty. More... | |
Static Public Member Functions | |
static TagContainer | create_empty_container (std::string name) |
static TagContainer | create_full_container (std::string name) |
Private Member Functions | |
TagContainer (std::string name, std::shared_ptr< int > val) | |
Private Attributes | |
std::string | m_Name |
std::shared_ptr< int > | m_Value |
A tag container combines a name with a shared pointer, which points to the tag value.
This is a lightweight wrapper around a shared pointer, which is used to manage tags. It can be in an empty and a full state. In the empty state, it has only a name, but not associated value (i.e. m_Value is nullptr), and in the full state it has both. Because updating and reading the value are expected to happen in performance-critical parts of the code, there is no check for empty state in release mode.
Any statistics the needs a tag should create empty tags with the corresponding name during its creation phase, and then fill in the full tag from the given StatisticsCollection
during the setup()
call.
For now, only integer values are accepted as tag value.
Definition at line 30 of file stats_base.h.
|
inlineexplicitprivate |
Definition at line 58 of file stats_base.h.
Referenced by create_empty_container(), and create_full_container().
|
inlinestatic |
Definition at line 50 of file stats_base.h.
References TagContainer().
|
inlinestatic |
Definition at line 53 of file stats_base.h.
References TagContainer().
Referenced by dismec::stats::StatisticsCollection::declare_tag().
|
inline |
returns the name of the associated tag
Definition at line 33 of file stats_base.h.
References m_Name.
Referenced by dismec::stats::TaggedStat::clone(), dismec::stats::TaggedStat::setup(), and TEST_CASE().
|
inline |
Returns the current value of the tag. Requires the container to not be empty.
Definition at line 36 of file stats_base.h.
References is_empty(), and m_Value.
Referenced by dismec::stats::TaggedStat::record_real(), and TEST_CASE().
|
inline |
Definition at line 42 of file stats_base.h.
References m_Value.
Referenced by get_value(), and set_value().
|
inline |
Updates the value of the tag. Requires the container to not be empty.
Definition at line 45 of file stats_base.h.
References is_empty(), and m_Value.
|
private |
Definition at line 60 of file stats_base.h.
Referenced by get_name().
|
private |
Definition at line 61 of file stats_base.h.
Referenced by get_value(), is_empty(), and set_value().