Clingo
Loading...
Searching...
No Matches
CppClingo::Input::RewriteContext Class Reference

Helper to pass arguments to rewrite functions. More...

#include <rewrite_context.hh>

Classes

struct  pop_
 Helper to pop auxiliary variable assignments. More...
 

Public Types

using Guard = std::unique_ptr< RewriteContext, pop_ >
 Helper to pop auxiliary variable assignments.
 

Public Member Functions

 RewriteContext (Logger &log, SymbolStore &store, RewriteOptions const &opts, TheoryAtomParser const &parser, ParamMap const &param_map, ConstMap const &const_map)
 Construct a rewrite context.
 
 RewriteContext (RewriteContext &&) noexcept=delete
 Delete move/copy constructor.
 
void init (StringSet names, char const *prefix)
 Initialize/reset the name generator.
 
auto logger () const -> Logger &
 Get the logger.
 
auto options () const -> RewriteOptions const &
 Get the logger.
 
auto parser () const -> TheoryAtomParser const &
 Get the parser.
 
auto store () const -> SymbolStore &
 Get the symbol store.
 
auto gen () -> NameGen &
 Get the name generator.
 
auto is_param (String name) const -> std::optional< size_t >
 Check if the given identifier is a parameter defined by a program directive.
 
auto is_const (String name) const -> std::optional< Symbol >
 Check if the given identifier is a parameter defined by a constant.
 
auto has_params () const -> bool
 Check if there is at least one parameter (from a program or const statement).
 
auto aux () -> AuxTermVec &
 Get the variable term map.
 
void pop ()
 Pop the last variable term map pushed.
 
auto push () -> Guard
 Push a fresh variable term map.
 
void set_error ()
 Mark that there was an error during rewriting.
 
auto has_error () const -> bool
 Check if there has been an error during rewriting.
 

Detailed Description

Helper to pass arguments to rewrite functions.

Member Function Documentation

◆ is_const()

auto CppClingo::Input::RewriteContext::is_const ( String  name) const -> std::optional<Symbol>
inline

Check if the given identifier is a parameter defined by a constant.

If it is a parameter, return its value.

◆ is_param()

auto CppClingo::Input::RewriteContext::is_param ( String  name) const -> std::optional<size_t>
inline

Check if the given identifier is a parameter defined by a program directive.

If it is a parameter, return its index.

◆ set_error()

void CppClingo::Input::RewriteContext::set_error ( )
inline

Mark that there was an error during rewriting.

The idea is that processing can continue despite this error to produce more than one error indicator to the user.


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