Z3
Data Structures | Public Member Functions | Friends
ast_vector_tpl< T > Class Template Reference
+ Inheritance diagram for ast_vector_tpl< T >:

Data Structures

class  iterator
 

Public Member Functions

 ast_vector_tpl (context &c)
 
 ast_vector_tpl (context &c, Z3_ast_vector v)
 
 ast_vector_tpl (ast_vector_tpl const &s)
 
 ast_vector_tpl (context &c, ast_vector_tpl const &src)
 
 ~ast_vector_tpl ()
 
 operator Z3_ast_vector () const
 
unsigned size () const
 
operator[] (int i) const
 
void push_back (T const &e)
 
void resize (unsigned sz)
 
back () const
 
void pop_back ()
 
bool empty () const
 
ast_vector_tploperator= (ast_vector_tpl const &s)
 
ast_vector_tplset (unsigned idx, ast &a)
 
iterator begin () const noexcept
 
iterator end () const
 
std::string to_string () const
 
- Public Member Functions inherited from object
 object (context &c)
 
contextctx () const
 
Z3_error_code check_error () const
 

Friends

std::ostream & operator<< (std::ostream &out, ast_vector_tpl const &v)
 

Additional Inherited Members

- Protected Attributes inherited from object
contextm_ctx
 

Detailed Description

template<typename T>
class z3::ast_vector_tpl< T >

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

Constructor & Destructor Documentation

ast_vector_tpl ( context c)
inline

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

544 :object(c) { init(Z3_mk_ast_vector(c)); }
Z3_ast_vector Z3_API Z3_mk_ast_vector(Z3_context c)
Return an empty AST vector.
object(context &c)
Definition: z3++.h:427
ast_vector_tpl ( context c,
Z3_ast_vector  v 
)
inline

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

545 :object(c) { init(v); }
object(context &c)
Definition: z3++.h:427
ast_vector_tpl ( ast_vector_tpl< T > const &  s)
inline

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

546 :object(s), m_vector(s.m_vector) { Z3_ast_vector_inc_ref(ctx(), m_vector); }
void Z3_API Z3_ast_vector_inc_ref(Z3_context c, Z3_ast_vector v)
Increment the reference counter of the given AST vector.
context & ctx() const
Definition: z3++.h:428
object(context &c)
Definition: z3++.h:427
ast_vector_tpl ( context c,
ast_vector_tpl< T > const &  src 
)
inline

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

547 : object(c) { init(Z3_ast_vector_translate(src.ctx(), src, c)); }
object(context &c)
Definition: z3++.h:427
Z3_ast_vector Z3_API Z3_ast_vector_translate(Z3_context s, Z3_ast_vector v, Z3_context t)
Translate the AST vector v from context s into an AST vector in context t.
~ast_vector_tpl ( )
inline

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

549 { Z3_ast_vector_dec_ref(ctx(), m_vector); }
void Z3_API Z3_ast_vector_dec_ref(Z3_context c, Z3_ast_vector v)
Decrement the reference counter of the given AST vector.
context & ctx() const
Definition: z3++.h:428

Member Function Documentation

T back ( ) const
inline

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

555 { return operator[](size() - 1); }
unsigned size() const
Definition: z3++.h:551
T operator[](int i) const
Definition: z3++.h:552
iterator begin ( ) const
inlinenoexcept

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

Referenced by optimize::add().

600 { return iterator(this, 0); }
bool empty ( ) const
inline

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

Referenced by z3::mk_xor().

557 { return size() == 0; }
unsigned size() const
Definition: z3++.h:551
iterator end ( ) const
inline

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

Referenced by optimize::add().

601 { return iterator(this, size()); }
unsigned size() const
Definition: z3++.h:551
operator Z3_ast_vector ( ) const
inline

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

550 { return m_vector; }
ast_vector_tpl& operator= ( ast_vector_tpl< T > const &  s)
inline

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

558  {
559  Z3_ast_vector_inc_ref(s.ctx(), s.m_vector);
560  Z3_ast_vector_dec_ref(ctx(), m_vector);
561  object::operator=(s);
562  m_vector = s.m_vector;
563  return *this;
564  }
void Z3_API Z3_ast_vector_inc_ref(Z3_context c, Z3_ast_vector v)
Increment the reference counter of the given AST vector.
void Z3_API Z3_ast_vector_dec_ref(Z3_context c, Z3_ast_vector v)
Decrement the reference counter of the given AST vector.
context & ctx() const
Definition: z3++.h:428
T operator[] ( int  i) const
inline

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

Referenced by ast_vector_tpl< expr >::back().

552 { assert(0 <= i); Z3_ast r = Z3_ast_vector_get(ctx(), m_vector, i); check_error(); return cast_ast<T>()(ctx(), r); }
Z3_ast Z3_API Z3_ast_vector_get(Z3_context c, Z3_ast_vector v, unsigned i)
Return the AST at position i in the AST vector v.
Z3_error_code check_error() const
Definition: z3++.h:429
context & ctx() const
Definition: z3++.h:428
void pop_back ( )
inline

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

556 { assert(size() > 0); resize(size() - 1); }
void resize(unsigned sz)
Definition: z3++.h:554
unsigned size() const
Definition: z3++.h:551
void push_back ( T const &  e)
inline

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

Referenced by context::enumeration_sort(), and context::tuple_sort().

553 { Z3_ast_vector_push(ctx(), m_vector, e); check_error(); }
Z3_error_code check_error() const
Definition: z3++.h:429
context & ctx() const
Definition: z3++.h:428
void Z3_API Z3_ast_vector_push(Z3_context c, Z3_ast_vector v, Z3_ast a)
Add the AST a in the end of the AST vector v. The size of v is increased by one.
void resize ( unsigned  sz)
inline

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

Referenced by ast_vector_tpl< expr >::pop_back().

554 { Z3_ast_vector_resize(ctx(), m_vector, sz); check_error(); }
void Z3_API Z3_ast_vector_resize(Z3_context c, Z3_ast_vector v, unsigned n)
Resize the AST vector v.
Z3_error_code check_error() const
Definition: z3++.h:429
context & ctx() const
Definition: z3++.h:428
ast_vector_tpl& set ( unsigned  idx,
ast a 
)
inline

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

565  {
566  Z3_ast_vector_set(ctx(), m_vector, idx, a);
567  return *this;
568  }
context & ctx() const
Definition: z3++.h:428
void Z3_API Z3_ast_vector_set(Z3_context c, Z3_ast_vector v, unsigned i, Z3_ast a)
Update position i of the AST vector v with the AST a.
unsigned size ( ) const
inline
std::string to_string ( ) const
inline

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

603 { return std::string(Z3_ast_vector_to_string(ctx(), m_vector)); }
Z3_string Z3_API Z3_ast_vector_to_string(Z3_context c, Z3_ast_vector v)
Convert AST vector into a string.
context & ctx() const
Definition: z3++.h:428

Friends And Related Function Documentation

std::ostream& operator<< ( std::ostream &  out,
ast_vector_tpl< T > const &  v 
)
friend

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

602 { out << Z3_ast_vector_to_string(v.ctx(), v); return out; }
Z3_string Z3_API Z3_ast_vector_to_string(Z3_context c, Z3_ast_vector v)
Convert AST vector into a string.