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

Class to providing a view on the const directives in a logic program. More...

#include <control.hh>

Public Types

using key_type = std::string_view
 The key type.
 
using mapped_type = Symbol
 The mapped type.
 
using value_type = std::pair< key_type, mapped_type >
 The value type.
 
using size_type = std::size_t
 The size type.
 
using difference_type = std::ptrdiff_t
 The difference type.
 
using reference = value_type
 The reference type.
 
using pointer = Detail::ArrowProxy< value_type >
 The pointer type.
 
using iterator = Detail::RandomAccessIterator< ConstMap >
 The iterator type.
 

Public Member Functions

 ConstMap (clingo_const_map_t const *map)
 Construct from the underlying C representation.
 
auto contains (key_type name) const -> bool
 Check if the map contains the given key.
 
auto operator[] (key_type name) const -> mapped_type
 Get the value of for the given key.
 
auto at (size_t index) const -> value_type
 Get the key value pair at the given index.
 
auto size () const -> size_type
 Get the size of the map.
 
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.
 

Detailed Description

Class to providing a view on the const directives in a logic program.

The class models a map from parameter names to their values.

Constructor & Destructor Documentation

◆ ConstMap()

Clingo::ConstMap::ConstMap ( clingo_const_map_t const map)
inlineexplicit

Construct from the underlying C representation.

For internal use.

Member Function Documentation

◆ at()

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

Get the key value pair at the given index.

Parameters
indexthe index of the element
Returns
the key value pair at the index

◆ begin()

auto Clingo::ConstMap::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::ConstMap::contains ( key_type  name) const -> bool
inline

Check if the map contains the given key.

Parameters
namethe key to check
Returns
whether the key is contained in the map

◆ end()

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

Get an iterator to the end of the map.

Returns
an iterator to the end of the map

◆ operator[]()

auto Clingo::ConstMap::operator[] ( key_type  name) const -> mapped_type
inline

Get the value of for the given key.

Parameters
namethe key to look up
Returns
the value for the key

◆ size()

auto Clingo::ConstMap::size ( ) const -> size_type
inline

Get the size of the map.

Returns
the size of the map

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