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 ()
 
 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
 
iterator end () const
 
- Public Member Functions inherited from object
 object (context &c)
 
 object (object const &s)
 
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 69 of file z3++.h.

Constructor & Destructor Documentation

◆ ast_vector_tpl() [1/3]

ast_vector_tpl ( context c)
inline

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

1800 :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:404

◆ ast_vector_tpl() [2/3]

ast_vector_tpl ( context c,
Z3_ast_vector  v 
)
inline

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

1801 :object(c) { init(v); }
object(context &c)
Definition: z3++.h:404

◆ ast_vector_tpl() [3/3]

ast_vector_tpl ( ast_vector_tpl< T > const &  s)
inline

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

1802 :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:406
object(context &c)
Definition: z3++.h:404

◆ ~ast_vector_tpl()

~ast_vector_tpl ( )
inline

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

1803 { 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:406

Member Function Documentation

◆ back()

T back ( ) const
inline

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

1809 { return operator[](size() - 1); }
T operator[](int i) const
Definition: z3++.h:1806
unsigned size() const
Definition: z3++.h:1805

◆ begin()

iterator begin ( ) const
inline

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

1856 { return iterator(this, 0); }

◆ empty()

bool empty ( ) const
inline

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

1811 { return size() == 0; }
unsigned size() const
Definition: z3++.h:1805

◆ end()

iterator end ( ) const
inline

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

1857 { return iterator(this, size()); }
unsigned size() const
Definition: z3++.h:1805

◆ operator Z3_ast_vector()

operator Z3_ast_vector ( ) const
inline

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

1804 { return m_vector; }

◆ operator=()

ast_vector_tpl& operator= ( ast_vector_tpl< T > const &  s)
inline

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

1812  {
1813  Z3_ast_vector_inc_ref(s.ctx(), s.m_vector);
1814  Z3_ast_vector_dec_ref(ctx(), m_vector);
1815  m_ctx = s.m_ctx;
1816  m_vector = s.m_vector;
1817  return *this;
1818  }
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:406
context * m_ctx
Definition: z3++.h:402

◆ operator[]()

T operator[] ( int  i) const
inline

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

1806 { assert(0 <= i); Z3_ast r = Z3_ast_vector_get(ctx(), m_vector, i); check_error(); return cast_ast<T>()(ctx(), r); }
Z3_error_code check_error() const
Definition: z3++.h:407
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.
context & ctx() const
Definition: z3++.h:406

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

◆ pop_back()

void pop_back ( )
inline

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

1810 { assert(size() > 0); resize(size() - 1); }
void resize(unsigned sz)
Definition: z3++.h:1808
unsigned size() const
Definition: z3++.h:1805

◆ push_back()

void push_back ( T const &  e)
inline

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

1807 { Z3_ast_vector_push(ctx(), m_vector, e); check_error(); }
Z3_error_code check_error() const
Definition: z3++.h:407
context & ctx() const
Definition: z3++.h:406
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.

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

◆ resize()

void resize ( unsigned  sz)
inline

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

1808 { Z3_ast_vector_resize(ctx(), m_vector, sz); check_error(); }
Z3_error_code check_error() const
Definition: z3++.h:407
void Z3_API Z3_ast_vector_resize(Z3_context c, Z3_ast_vector v, unsigned n)
Resize the AST vector v.
context & ctx() const
Definition: z3++.h:406

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

◆ set()

ast_vector_tpl& set ( unsigned  idx,
ast a 
)
inline

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

1819  {
1820  Z3_ast_vector_set(ctx(), m_vector, idx, a);
1821  return *this;
1822  }
context & ctx() const
Definition: z3++.h:406
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.

◆ size()

unsigned size ( ) const
inline

Friends And Related Function Documentation

◆ operator<<

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

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

1858 { 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.