Z3
Public Member Functions | Friends
constructors Class Reference

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 3390 of file z3++.h.

Constructor & Destructor Documentation

◆ constructors()

constructors ( context ctx)
inline

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

3396 : ctx(ctx) {}

Referenced by Datatype::__deepcopy__(), Datatype::__repr__(), and Datatype::declare_core().

◆ ~constructors()

~constructors ( )
inline

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

3398  {
3399  for (auto con : cons)
3400  Z3_del_constructor(ctx, con);
3401  }
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 3403 of file z3++.h.

3403  {
3404  array<unsigned> sort_refs(n);
3405  array<Z3_sort> sorts(n);
3406  array<Z3_symbol> _names(n);
3407  for (unsigned i = 0; i < n; ++i) sorts[i] = fields[i], _names[i] = names[i];
3408  cons.push_back(Z3_mk_constructor(ctx, name, rec, n, _names.ptr(), sorts.ptr(), sort_refs.ptr()));
3409  num_fields.push_back(n);
3410  }
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_opt const sorts[], unsigned sort_refs[])
Create a constructor.

Referenced by Solver::__iadd__(), Fixedpoint::__iadd__(), and Optimize::__iadd__().

◆ operator[]()

Z3_constructor operator[] ( unsigned  i) const
inline

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

3412 { return cons[i]; }

◆ query()

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

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

3416  {
3417  Z3_func_decl _constructor;
3418  Z3_func_decl _test;
3419  array<Z3_func_decl> accessors(num_fields[i]);
3420  accs.resize(0);
3422  cons[i],
3423  num_fields[i],
3424  &_constructor,
3425  &_test,
3426  accessors.ptr());
3427  constructor = func_decl(ctx, _constructor);
3428 
3429  test = func_decl(ctx, _test);
3430  for (unsigned j = 0; j < num_fields[i]; ++j)
3431  accs.push_back(func_decl(ctx, accessors[j]));
3432  }
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.
System.IntPtr Z3_func_decl

◆ size()

unsigned size ( ) const
inline

Friends And Related Function Documentation

◆ constructor_list

friend class constructor_list
friend

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