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

#include <z3++.h>

Public Member Functions

 constructors (context &ctx)
 ~constructors ()
void add (symbol const &name, symbol const &rec, unsigned n, symbol const *names, sort const *fields)
Z3_constructor operator[] (unsigned i) const
unsigned size () const
void query (unsigned i, func_decl &constructor, func_decl &test, func_decl_vector &accs)

Friends

class constructor_list

Detailed Description

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

Constructor & Destructor Documentation

◆ constructors()

constructors ( context & ctx)
inline

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

3771: ctx(ctx) {}

◆ ~constructors()

~constructors ( )
inline

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

3773 {
3774 for (auto con : cons)
3775 Z3_del_constructor(ctx, con);
3776 }
void Z3_API Z3_del_constructor(Z3_context c, Z3_constructor constr)
Reclaim memory allocated to constructor.

Member Function Documentation

◆ add()

void add ( symbol const & name,
symbol const & rec,
unsigned n,
symbol const * names,
sort const * fields )
inline

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

3778 {
3779 array<unsigned> sort_refs(n);
3780 array<Z3_sort> sorts(n);
3781 array<Z3_symbol> _names(n);
3782 for (unsigned i = 0; i < n; ++i) sorts[i] = fields[i], _names[i] = names[i];
3783 cons.push_back(Z3_mk_constructor(ctx, name, rec, n, _names.ptr(), sorts.ptr(), sort_refs.ptr()));
3784 num_fields.push_back(n);
3785 }
Z3_constructor Z3_API Z3_mk_constructor(Z3_context c, Z3_symbol name, Z3_symbol recognizer, unsigned num_fields, Z3_symbol const field_names[], Z3_sort const sorts[], unsigned sort_refs[])
Create a constructor.

◆ operator[]()

Z3_constructor operator[] ( unsigned i) const
inline

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

3787{ return cons[i]; }

◆ query()

void query ( unsigned i,
func_decl & constructor,
func_decl & test,
func_decl_vector & accs )
inline

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

3791 {
3792 Z3_func_decl _constructor;
3793 Z3_func_decl _test;
3794 array<Z3_func_decl> accessors(num_fields[i]);
3795 accs.resize(0);
3797 cons[i],
3798 num_fields[i],
3799 &_constructor,
3800 &_test,
3801 accessors.ptr());
3802 constructor = func_decl(ctx, _constructor);
3803
3804 test = func_decl(ctx, _test);
3805 for (unsigned j = 0; j < num_fields[i]; ++j)
3806 accs.push_back(func_decl(ctx, accessors[j]));
3807 }
void Z3_API Z3_query_constructor(Z3_context c, Z3_constructor constr, unsigned num_fields, Z3_func_decl *constructor, Z3_func_decl *tester, Z3_func_decl accessors[])
Query constructor for declared functions.

◆ size()

unsigned size ( ) const
inline

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

3789{ return (unsigned)cons.size(); }

Referenced by constructor_list::constructor_list(), context::datatype(), and context::datatype().

◆ constructor_list

friend class constructor_list
friend

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

Referenced by constructor_list.