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

Class modeling a mutable view on an array of statistics entries. More...

#include <stats.hh>

Inheritance diagram for Clingo::StatsArray:
Clingo::ConstStatsArray

Public Types

using value_type = Stats
 The value type of the array, which are stats entries.
 
using size_type = std::size_t
 The size type of the array.
 
using difference_type = std::ptrdiff_t
 The difference type of the array.
 
using reference = value_type
 The reference type of the array, which are stats entries.
 
using pointer = Detail::ArrowProxy< value_type >
 The pointer type of the array, which is a proxy to stats entries.
 
using iterator = Detail::RandomAccessIterator< StatsArray >
 The iterator type, which is a random access iterator over stats entries.
 
- Public Types inherited from Clingo::ConstStatsArray
using value_type = ConstStats
 The value type of the array, which are stats entries.
 
using size_type = std::size_t
 The size type of the array.
 
using difference_type = std::ptrdiff_t
 The difference type of the array.
 
using reference = value_type
 The reference type of the array, which are stats entries.
 
using pointer = Detail::ArrowProxy< value_type >
 The pointer type of the array, which is a proxy to stats entries.
 
using iterator = Detail::RandomAccessIterator< ConstStatsArray >
 The iterator type, which is a random access iterator over stats entries.
 

Public Member Functions

 StatsArray (clingo_stats_t *stats, uint64_t key)
 Construct a statistics array from a pointer to the C API and a key.
 
auto at (size_t index) const -> Stats
 Get a statistics entry at the given index if the entry is an array.
 
auto operator[] (size_t index) const -> Stats
 Get a statistics entry at the given index if the entry is an array.
 
auto push (StatsType type) const -> Stats
 Append a new statistics entry of the given type to the array.
 
auto ensure (size_t index, StatsType type) const -> Stats
 Ensure that the array has an entry at the given index.
 
auto begin () const -> iterator
 Get an iterator to the beginning of the array.
 
auto end () const -> iterator
 Get an iterator to the end of the array.
 
- Public Member Functions inherited from Clingo::ConstStatsArray
 ConstStatsArray (clingo_stats_t const *stats, uint64_t key)
 Construct a statistics array from a pointer to the C API and a key.
 
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 size () const -> size_t
 Get the size of the array.
 
auto begin () const -> iterator
 Get an iterator to the beginning of the array.
 
auto end () const -> iterator
 Get an iterator to the end of the array.
 

Detailed Description

Class modeling a mutable view on an array of statistics entries.

Constructor & Destructor Documentation

◆ StatsArray()

Clingo::StatsArray::StatsArray ( clingo_stats_t stats,
uint64_t  key 
)
inlineexplicit

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

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

Member Function Documentation

◆ at()

auto Clingo::StatsArray::at ( size_t  index) const -> Stats
inline

Get a statistics entry at the given index if the entry is an array.

Parameters
indexthe index of the statistics entry to get
Returns
a statistics entry at the given index

◆ begin()

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

Get an iterator to the beginning of the array.

Returns
an iterator to the beginning of the array

◆ end()

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

Get an iterator to the end of the array.

Returns
an iterator to the end of the array

◆ ensure()

auto Clingo::StatsArray::ensure ( size_t  index,
StatsType  type 
) const -> Stats
inline

Ensure that the array has an entry at the given index.

Parameters
indexthe index of the statistics entry to ensure
typethe type of the statistics entry to ensure
Returns
a statistics entry at the given index

◆ operator[]()

auto Clingo::StatsArray::operator[] ( size_t  index) const -> Stats
inline

Get a statistics entry at the given index if the entry is an array.

Parameters
indexthe index of the statistics entry to get
Returns
a statistics entry at the given index

◆ push()

auto Clingo::StatsArray::push ( StatsType  type) const -> Stats
inline

Append a new statistics entry of the given type to the array.

Appended entries have their default values; empty for arrays and lists, zero for numbers.

Parameters
typethe type of the new statistics entry
Returns
a statistics entry at the end of the array

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