Clingo
Loading...
Searching...
No Matches
Clingo::ConstStatsMap Class Reference

Class modeling an immutable view on a map of statistics entries. More...

#include <stats.hh>

Inheritance diagram for Clingo::ConstStatsMap:
Clingo::StatsMap

Public Types

using key_type = std::string_view
 The key type of the map, which is a string view.
 
using mapped_type = ConstStats
 The mapped type of the map, which is an immutable stats entry.
 
using value_type = std::pair< key_type, mapped_type >
 The value type of the map, which is a pair of key and mapped type.
 
using size_type = std::size_t
 The size type of the map.
 
using difference_type = std::ptrdiff_t
 The difference type of the map.
 
using reference = value_type
 The reference type of the map, which is a pair of key and mapped type.
 
using pointer = Detail::ArrowProxy< value_type >
 The pointer type of the map, which is a proxy to the value type.
 
using iterator = Detail::RandomAccessIterator< ConstStatsMap >
 The iterator type, which is a random access iterator over value types.
 

Public Member Functions

 ConstStatsMap (clingo_stats_t const *stats, uint64_t key)
 Construct a statistics map from a pointer to the C API and a key.
 
auto size () const -> size_t
 Get the size of the map.
 
auto at (size_t index) const -> value_type
 Get the name entry pair at the given index.
 
auto operator[] (std::string_view name) const -> ConstStats
 Get a statistics entry with the given name 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 contains (std::string_view name) const -> bool
 Check if the map contains a subkey with the given name.
 
auto begin () const -> iterator
 Get an iterator to the beginning of the map.
 
auto end () const -> iterator
 Get an iterator to the end of the map.
 

Friends

class StatsMap
 

Detailed Description

Class modeling an immutable view on a map of statistics entries.

Constructor & Destructor Documentation

◆ ConstStatsMap()

Clingo::ConstStatsMap::ConstStatsMap ( clingo_stats_t const stats,
uint64_t  key 
)
inlineexplicit

Construct a statistics map from a pointer to the C API and a key.

Parameters
statsthe statistics entry to construct the map from
keythe key of the statistics entry

Member Function Documentation

◆ at()

auto Clingo::ConstStatsMap::at ( size_t  index) const -> value_type
inline

Get the name entry pair at the given index.

Parameters
indexthe index of the entry to get
Returns
the name entry pair at the given index

◆ begin()

auto Clingo::ConstStatsMap::begin ( ) const -> iterator
inline

Get an iterator to the beginning of the map.

Returns
an iterator to the beginning of the map

◆ contains()

auto Clingo::ConstStatsMap::contains ( std::string_view  name) const -> bool
inline

Check if the map contains a subkey with the given name.

Parameters
namethe name of the subkey to check
Returns
whether the map contains a subkey with the given name

◆ end()

auto Clingo::ConstStatsMap::end ( ) const -> iterator
inline

Get an iterator to the end of the map.

Returns
an iterator to the end of the map

◆ get()

auto Clingo::ConstStatsMap::get ( std::string_view  name) const -> ConstStats
inline

Get a statistics entry with the given name if the entry is a map.

Parameters
namethe name of the statistics entry to get
Returns
a statistics entry with the given name

◆ operator[]()

auto Clingo::ConstStatsMap::operator[] ( std::string_view  name) const -> ConstStats
inline

Get a statistics entry with the given name if the entry is a map.

Parameters
namethe name of the statistics entry to get
Returns
a statistics entry with the given name

◆ size()

auto Clingo::ConstStatsMap::size ( ) const -> size_t
inline

Get the size of the map.

Returns
the size of the map

The documentation for this class was generated from the following file: