Z3
Loading...
Searching...
No Matches
parameter Class Reference

class for auxiliary parameters associated with func_decl The class is initialized with a func_decl or application expression and an index The accessor get_expr, get_sort, ... is available depending on the value of kind(). The caller is responsible to check that the kind of the parameter aligns with the call (get_expr etc). More...

#include <z3++.h>

Public Member Functions

 parameter (func_decl const &d, unsigned idx)
 parameter (expr const &e, unsigned idx)
Z3_parameter_kind kind () const
expr get_expr () const
sort get_sort () const
func_decl get_decl () const
symbol get_symbol () const
std::string get_rational () const
double get_double () const
int get_int () const

Detailed Description

class for auxiliary parameters associated with func_decl The class is initialized with a func_decl or application expression and an index The accessor get_expr, get_sort, ... is available depending on the value of kind(). The caller is responsible to check that the kind of the parameter aligns with the call (get_expr etc).

Parameters are available on some declarations to contain additional information that is not passed as arguments when a function is applied to arguments. For example, bit-vector extraction has two integer parameters. Array map has a function parameter.

Definition at line 3050 of file z3++.h.

Constructor & Destructor Documentation

◆ parameter() [1/2]

parameter ( func_decl const & d,
unsigned idx )
inline

Definition at line 3057 of file z3++.h.

3057 : m_decl(d), m_index(idx) {
3058 if (ctx().enable_exceptions() && idx >= d.num_parameters())
3059 Z3_THROW(exception("parameter index is out of bounds"));
3060 m_kind = Z3_get_decl_parameter_kind(ctx(), d, idx);
3061 }
Z3_parameter_kind Z3_API Z3_get_decl_parameter_kind(Z3_context c, Z3_func_decl d, unsigned idx)
Return the parameter type associated with a declaration.
#define Z3_THROW(x)
Definition z3++.h:134

◆ parameter() [2/2]

parameter ( expr const & e,
unsigned idx )
inline

Definition at line 3062 of file z3++.h.

3062 : m_decl(e.decl()), m_index(idx) {
3063 if (ctx().enable_exceptions() && idx >= m_decl.num_parameters())
3064 Z3_THROW(exception("parameter index is out of bounds"));
3065 m_kind = Z3_get_decl_parameter_kind(ctx(), m_decl, idx);
3066 }

Member Function Documentation

◆ get_decl()

func_decl get_decl ( ) const
inline

Definition at line 3070 of file z3++.h.

3070{ Z3_func_decl f = Z3_get_decl_func_decl_parameter(ctx(), m_decl, m_index); check_error(); return func_decl(ctx(), f); }
Z3_func_decl Z3_API Z3_get_decl_func_decl_parameter(Z3_context c, Z3_func_decl d, unsigned idx)
Return the expression value associated with an expression parameter.

◆ get_double()

double get_double ( ) const
inline

Definition at line 3073 of file z3++.h.

3073{ double d = Z3_get_decl_double_parameter(ctx(), m_decl, m_index); check_error(); return d; }
double Z3_API Z3_get_decl_double_parameter(Z3_context c, Z3_func_decl d, unsigned idx)
Return the double value associated with an double parameter.

◆ get_expr()

expr get_expr ( ) const
inline

Definition at line 3068 of file z3++.h.

3068{ Z3_ast a = Z3_get_decl_ast_parameter(ctx(), m_decl, m_index); check_error(); return expr(ctx(), a); }
Z3_ast Z3_API Z3_get_decl_ast_parameter(Z3_context c, Z3_func_decl d, unsigned idx)
Return the expression value associated with an expression parameter.

◆ get_int()

int get_int ( ) const
inline

Definition at line 3074 of file z3++.h.

3074{ int i = Z3_get_decl_int_parameter(ctx(), m_decl, m_index); check_error(); return i; }
int Z3_API Z3_get_decl_int_parameter(Z3_context c, Z3_func_decl d, unsigned idx)
Return the integer value associated with an integer parameter.

◆ get_rational()

std::string get_rational ( ) const
inline

Definition at line 3072 of file z3++.h.

3072{ Z3_string s = Z3_get_decl_rational_parameter(ctx(), m_decl, m_index); check_error(); return s; }
const char * Z3_string
Z3 string type. It is just an alias for const char *.
Definition z3_api.h:50
Z3_string Z3_API Z3_get_decl_rational_parameter(Z3_context c, Z3_func_decl d, unsigned idx)
Return the rational value, as a string, associated with a rational parameter.

◆ get_sort()

sort get_sort ( ) const
inline

Definition at line 3069 of file z3++.h.

3069{ Z3_sort s = Z3_get_decl_sort_parameter(ctx(), m_decl, m_index); check_error(); return sort(ctx(), s); }
Z3_sort Z3_API Z3_get_decl_sort_parameter(Z3_context c, Z3_func_decl d, unsigned idx)
Return the sort value associated with a sort parameter.

◆ get_symbol()

symbol get_symbol ( ) const
inline

Definition at line 3071 of file z3++.h.

3071{ Z3_symbol s = Z3_get_decl_symbol_parameter(ctx(), m_decl, m_index); check_error(); return symbol(ctx(), s); }
Z3_symbol Z3_API Z3_get_decl_symbol_parameter(Z3_context c, Z3_func_decl d, unsigned idx)
Return the double value associated with an double parameter.

◆ kind()

Z3_parameter_kind kind ( ) const
inline

Definition at line 3067 of file z3++.h.

3067{ return m_kind; }