Clingo
|
Class modeling an immutable view on a statistics entry. More...
#include <stats.hh>
Public Member Functions | |
ConstStats (clingo_stats_t const *stats, uint64_t key) | |
Construct a statistics entry from a pointer to the C API and a key. | |
auto | type () const -> StatsType |
Get the type of the statistics entry. | |
auto | array () const -> ConstStatsArray |
Get a view on the array of statistics entries if the entry is an array. | |
auto | at (size_t index) const -> ConstStats |
Get a statistics entry at the given index if the entry is an array. | |
auto | operator[] (size_t index) const -> ConstStats |
Get a statistics entry at the given index if the entry is an array. | |
auto | map () const -> ConstStatsMap |
Get a view on the map of statistics entries if the entry is a map. | |
auto | get (std::string_view name) const -> ConstStats |
Get a statistics entry with the given name if the entry is a map. | |
auto | operator[] (std::string_view name) const -> ConstStats |
Get a statistics entry with the given name if the entry is a map. | |
auto | value () const -> double |
Get the value of the statistics entry if it is a value. | |
auto | operator* () const -> double |
Get the value of the statistics entry if it is a value. | |
auto | to_string () const -> std::string |
Get a string representation of the statistics entry. | |
Friends | |
class | Stats |
auto | c_cast (ConstStats const &stats) -> clingo_stats_t const * |
Cast to the underlying C API type. | |
Class modeling an immutable view on a statistics entry.
Get the value of the statistics entry if it is a value.
|
inline |
Get a statistics entry at the given index if the entry is an array.
index | the index of the statistics entry to get |
|
inline |
Get a statistics entry with the given name if the entry is a map.
name | the name of the statistics entry to get |
|
inline |
Get a string representation of the statistics entry.
The represention is YAML-like and can be used for debugging purposes.
Get the type of the statistics entry.
Get the value of the statistics entry if it is a value.
|
friend |
Cast to the underlying C API type.
stats | the statistics entry to cast |