Z3
 
Loading...
Searching...
No Matches
Public Member Functions
ast_map Class Reference

A map from ASTs to ASTs. More...

#include <z3++.h>

+ Inheritance diagram for ast_map:

Public Member Functions

 ast_map (context &c)
 
 ast_map (context &c, Z3_ast_map m)
 
 ast_map (ast_map const &s)
 
 ~ast_map () override
 
 operator Z3_ast_map () const
 
ast_map & operator= (ast_map const &s)
 
bool contains (ast const &k) const
 
ast find (ast const &k) const
 
void insert (ast const &k, ast const &v)
 
void erase (ast const &k)
 
void reset ()
 
unsigned size () const
 
ast_vector keys () const
 
- Public Member Functions inherited from object
 object (context &c)
 
virtual ~object ()=default
 
context & ctx () const
 
Z3_error_code check_error () const
 

Additional Inherited Members

- Protected Attributes inherited from object
context * m_ctx
 

Detailed Description

A map from ASTs to ASTs.

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

Constructor & Destructor Documentation

◆ ast_map() [1/3]

ast_map ( context &  c)
inline

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

757: object(c) { init(Z3_mk_ast_map(c)); }
object(context &c)
Definition z3++.h:565
Z3_ast_map Z3_API Z3_mk_ast_map(Z3_context c)
Return an empty mapping from AST to AST.

◆ ast_map() [2/3]

ast_map ( context &  c,
Z3_ast_map  m 
)
inline

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

758: object(c) { init(m); }

◆ ast_map() [3/3]

ast_map ( ast_map const &  s)
inline

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

759: object(s) { init(s.m_map); }

◆ ~ast_map()

~ast_map ( )
inlineoverride

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

760{ Z3_ast_map_dec_ref(ctx(), m_map); }
context & ctx() const
Definition z3++.h:567
void Z3_API Z3_ast_map_dec_ref(Z3_context c, Z3_ast_map m)
Decrement the reference counter of the given AST map.

Member Function Documentation

◆ contains()

bool contains ( ast const &  k) const
inline

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

769 {
770 check_context(*this, k);
771 bool r = Z3_ast_map_contains(ctx(), m_map, k);
772 check_error();
773 return r;
774 }
Z3_error_code check_error() const
Definition z3++.h:568
friend void check_context(object const &a, object const &b)
Definition z3++.h:571
bool Z3_API Z3_ast_map_contains(Z3_context c, Z3_ast_map m, Z3_ast k)
Return true if the map m contains the AST key k.

◆ erase()

void erase ( ast const &  k)
inline

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

786 {
787 check_context(*this, k);
788 Z3_ast_map_erase(ctx(), m_map, k);
789 check_error();
790 }
void Z3_API Z3_ast_map_erase(Z3_context c, Z3_ast_map m, Z3_ast k)
Erase a key from the map.

◆ find()

ast find ( ast const &  k) const
inline

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

775 {
776 check_context(*this, k);
777 Z3_ast r = Z3_ast_map_find(ctx(), m_map, k);
778 check_error();
779 return ast(ctx(), r);
780 }
Z3_ast Z3_API Z3_ast_map_find(Z3_context c, Z3_ast_map m, Z3_ast k)
Return the value associated with the key k.
System.IntPtr Z3_ast

◆ insert()

void insert ( ast const &  k,
ast const &  v 
)
inline

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

781 {
782 check_context(*this, k); check_context(*this, v);
783 Z3_ast_map_insert(ctx(), m_map, k, v);
784 check_error();
785 }
void Z3_API Z3_ast_map_insert(Z3_context c, Z3_ast_map m, Z3_ast k, Z3_ast v)
Store/Replace a new key, value pair in the given map.

◆ keys()

ast_vector keys ( ) const
inline

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

797 {
798 Z3_ast_vector r = Z3_ast_map_keys(ctx(), m_map);
799 check_error();
800 return ast_vector(ctx(), r);
801 }
Z3_ast_vector Z3_API Z3_ast_map_keys(Z3_context c, Z3_ast_map m)
Return the keys stored in the given map.
System.IntPtr Z3_ast_vector
ast_vector_tpl< ast > ast_vector
Definition z3++.h:76

◆ operator Z3_ast_map()

operator Z3_ast_map ( ) const
inline

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

761{ return m_map; }

◆ operator=()

ast_map & operator= ( ast_map const &  s)
inline

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

762 {
763 Z3_ast_map_inc_ref(s.ctx(), s.m_map);
764 Z3_ast_map_dec_ref(ctx(), m_map);
765 object::operator=(s);
766 m_map = s.m_map;
767 return *this;
768 }
void Z3_API Z3_ast_map_inc_ref(Z3_context c, Z3_ast_map m)
Increment the reference counter of the given AST map.

◆ reset()

void reset ( )
inline

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

791{ Z3_ast_map_reset(ctx(), m_map); check_error(); }
void Z3_API Z3_ast_map_reset(Z3_context c, Z3_ast_map m)
Remove all keys from the given map.

◆ size()

unsigned size ( ) const
inline

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

792 {
793 unsigned r = Z3_ast_map_size(ctx(), m_map);
794 check_error();
795 return r;
796 }
unsigned Z3_API Z3_ast_map_size(Z3_context c, Z3_ast_map m)
Return the size of the given map.

Referenced by ParamDescrsRef::__len__(), Goal::__len__(), BitVecNumRef::as_signed_long(), and BitVecSortRef::subsort().