Defines the Simulation run-time metrics container data type.
More...
#include <runtime_metric.h>
|
using | IteratorType = std::unordered_map< std::string, double >::iterator |
| Metric iterator. More...
|
|
using | ConstIteratorType = std::unordered_map< std::string, double >::const_iterator |
| Read-only metric iterator. More...
|
|
|
std::size_t | size () const noexcept |
| Gets the number of metrics in the container. More...
|
|
double & | operator[] (const std::string metric_key) |
| Gets a reference to a metric value by identifier, no bounds checking. More...
|
|
double & | at (const std::string metric_key) |
| Gets a reference to a metric value by identifier with bounds checking. More...
|
|
const double & | at (const std::string metric_key) const |
| Gets a read-only reference to a metric value by identifier with bounds checking. More...
|
|
bool | contains (const std::string metric_key) const noexcept |
| Checks if the container contains a metric with specific identifier. More...
|
|
bool | emplace (const std::string metric_key, const double value) |
| Inserts a new metric into the container constructed in-place with arguments. More...
|
|
bool | erase (const std::string metric_key) |
| Removes a specified metric from the container. More...
|
|
void | clear () noexcept |
| Erases all metrics from the container. More...
|
|
void | reset () noexcept |
| Resets the values of all metrics in the container to zero. More...
|
|
bool | empty () const noexcept |
| Checks if the container has no metrics. More...
|
|
IteratorType | begin () noexcept |
| Gets an iterator to the beginning of the metrics. More...
|
|
IteratorType | end () noexcept |
| Gets an iterator to the element following the last metric. More...
|
|
ConstIteratorType | begin () const noexcept |
| Gets a read-only iterator to the beginning of the metrics. More...
|
|
ConstIteratorType | end () const noexcept |
| Gets a read-only iterator to the element following the last metric. More...
|
|
ConstIteratorType | cbegin () const noexcept |
| Gets a read-only iterator to the beginning of the metrics. More...
|
|
ConstIteratorType | cend () const noexcept |
| Gets a read-only iterator to the element following the last metric. More...
|
|
Defines the Simulation run-time metrics container data type.
Dynamic runtime metrics can be consistent collected throughout the simulation algorithm, these metrics are included in the simulation results for analysis.
◆ ConstIteratorType
Read-only metric iterator.
◆ IteratorType
◆ at() [1/2]
double & hgps::RuntimeMetric::at |
( |
const std::string |
metric_key | ) |
|
Gets a reference to a metric value by identifier with bounds checking.
- Parameters
-
metric_key | Metric identifier. |
- Returns
- Reference to metric value.
- Exceptions
-
std::out_of_range | if the container does not have a metric with the specified identifier. |
◆ at() [2/2]
const double & hgps::RuntimeMetric::at |
( |
const std::string |
metric_key | ) |
const |
Gets a read-only reference to a metric value by identifier with bounds checking.
- Parameters
-
metric_key | Metric identifier. |
- Returns
- Reference to metric value.
- Exceptions
-
std::out_of_range | if the container does not have a metric with the specified identifier. |
◆ begin() [1/2]
Gets a read-only iterator to the beginning of the metrics.
- Returns
- Iterator to the first metric
◆ begin() [2/2]
Gets an iterator to the beginning of the metrics.
- Returns
- Iterator to the first metric
◆ cbegin()
Gets a read-only iterator to the beginning of the metrics.
- Returns
- Iterator to the first metric
◆ cend()
Gets a read-only iterator to the element following the last metric.
- Returns
- Iterator to the element following the last metric.
◆ clear()
void hgps::RuntimeMetric::clear |
( |
| ) |
|
|
noexcept |
Erases all metrics from the container.
◆ contains()
bool hgps::RuntimeMetric::contains |
( |
const std::string |
metric_key | ) |
const |
|
noexcept |
Checks if the container contains a metric with specific identifier.
- Parameters
-
metric_key | Metric identifier. |
- Returns
- true if there is such a metric; otherwise, false.
◆ emplace()
bool hgps::RuntimeMetric::emplace |
( |
const std::string |
metric_key, |
|
|
const double |
value |
|
) |
| |
Inserts a new metric into the container constructed in-place with arguments.
- Parameters
-
metric_key | Metric identifier. |
value | Metric value. |
- Returns
- true if insertion happened; otherwise, false.
◆ empty()
bool hgps::RuntimeMetric::empty |
( |
| ) |
const |
|
noexcept |
Checks if the container has no metrics.
- Returns
- true if the container is empty; otherwise, false.
◆ end() [1/2]
Gets a read-only iterator to the element following the last metric.
- Returns
- Iterator to the element following the last metric.
◆ end() [2/2]
Gets an iterator to the element following the last metric.
- Returns
- Iterator to the element following the last metric.
◆ erase()
bool hgps::RuntimeMetric::erase |
( |
const std::string |
metric_key | ) |
|
Removes a specified metric from the container.
- Parameters
-
metric_key | Metric identifier. |
- Returns
- true if deletion happened; otherwise, false.
◆ operator[]()
double & hgps::RuntimeMetric::operator[] |
( |
const std::string |
metric_key | ) |
|
Gets a reference to a metric value by identifier, no bounds checking.
- Parameters
-
metric_key | Metric identifier. |
- Returns
- Reference to metric value.
◆ reset()
void hgps::RuntimeMetric::reset |
( |
| ) |
|
|
noexcept |
Resets the values of all metrics in the container to zero.
◆ size()
std::size_t hgps::RuntimeMetric::size |
( |
| ) |
const |
|
noexcept |
Gets the number of metrics in the container.
- Returns
- The number of metrics.
The documentation for this class was generated from the following files: