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_mapoperator= (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
 
contextctx () const
 
Z3_error_code check_error () const
 

Additional Inherited Members

- Protected Attributes inherited from object
contextm_ctx
 

Detailed Description

A map from ASTs to ASTs.

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

Constructor & Destructor Documentation

◆ ast_map() [1/3]

ast_map ( context c)
inline

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

750: object(c) { init(Z3_mk_ast_map(c)); }
object(context &c)
Definition z3++.h:558
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 751 of file z3++.h.

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

◆ ast_map() [3/3]

ast_map ( ast_map const s)
inline

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

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

◆ ~ast_map()

~ast_map ( )
inlineoverride

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

753{ Z3_ast_map_dec_ref(ctx(), m_map); }
context & ctx() const
Definition z3++.h:560
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 762 of file z3++.h.

762 {
763 check_context(*this, k);
764 bool r = Z3_ast_map_contains(ctx(), m_map, k);
765 check_error();
766 return r;
767 }
Z3_error_code check_error() const
Definition z3++.h:561
friend void check_context(object const &a, object const &b)
Definition z3++.h:564
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 779 of file z3++.h.

779 {
780 check_context(*this, k);
781 Z3_ast_map_erase(ctx(), m_map, k);
782 check_error();
783 }
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 768 of file z3++.h.

768 {
769 check_context(*this, k);
770 Z3_ast r = Z3_ast_map_find(ctx(), m_map, k);
771 check_error();
772 return ast(ctx(), r);
773 }
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 774 of file z3++.h.

774 {
775 check_context(*this, k); check_context(*this, v);
776 Z3_ast_map_insert(ctx(), m_map, k, v);
777 check_error();
778 }
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 790 of file z3++.h.

790 {
791 Z3_ast_vector r = Z3_ast_map_keys(ctx(), m_map);
792 check_error();
793 return ast_vector(ctx(), r);
794 }
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 754 of file z3++.h.

754{ return m_map; }

◆ operator=()

ast_map & operator= ( ast_map const s)
inline

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

755 {
756 Z3_ast_map_inc_ref(s.ctx(), s.m_map);
757 Z3_ast_map_dec_ref(ctx(), m_map);
758 object::operator=(s);
759 m_map = s.m_map;
760 return *this;
761 }
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 784 of file z3++.h.

784{ 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 785 of file z3++.h.

785 {
786 unsigned r = Z3_ast_map_size(ctx(), m_map);
787 check_error();
788 return r;
789 }
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().