mCRL2
Loading...
Searching...
No Matches
atermpp::term_balanced_tree< Term > Class Template Reference

Read-only balanced binary tree of terms. More...

#include <aterm_balanced_tree.h>

Inheritance diagram for atermpp::term_balanced_tree< Term >:
atermpp::term_appl< aterm > atermpp::aterm atermpp::unprotected_aterm

Classes

class  iterator
 

Public Types

typedef Term value_type
 The type of object, T stored in the term_balanced_tree.
 
typedef Term * pointer
 Pointer to T.
 
typedef Term & reference
 Reference to T.
 
typedef const Term const_reference
 Const reference to T.
 
typedef std::size_t size_type
 An unsigned integral type.
 
typedef ptrdiff_t difference_type
 A signed integral type.
 
- Public Types inherited from atermpp::term_appl< aterm >
typedef aterm value_type
 The type of object, T stored in the term_appl.
 
typedef atermpointer
 Pointer to T.
 
typedef atermreference
 Reference to T.
 
typedef const aterm const_reference
 Const reference to T.
 
typedef std::size_t size_type
 An unsigned integral type.
 
typedef ptrdiff_t difference_type
 A signed integral type.
 
typedef term_appl_iterator< atermiterator
 Iterator used to iterate through an term_appl.
 
typedef term_appl_iterator< atermconst_iterator
 Const iterator used to iterate through an term_appl.
 

Public Member Functions

 term_balanced_tree ()
 Default constructor. Creates an empty tree.
 
 term_balanced_tree (const term_balanced_tree &) noexcept=default
 Copy constructor.
 
 term_balanced_tree (term_balanced_tree &&) noexcept=default
 Move constructor.
 
term_balanced_treeoperator= (const term_balanced_tree &) noexcept=default
 Assignment operator.
 
term_balanced_treeoperator= (term_balanced_tree &&) noexcept=default
 Move assign operator.
 
 term_balanced_tree (const aterm &tree)
 Construction from aterm.
 
template<typename ForwardTraversalIterator >
 term_balanced_tree (ForwardTraversalIterator first, const std::size_t size)
 Creates an term_balanced_tree with a copy of a range.
 
template<typename ForwardTraversalIterator , typename Transformer >
 term_balanced_tree (ForwardTraversalIterator first, const std::size_t size, Transformer transformer)
 Creates an term_balanced_tree with a copy of a range, where a transformer is applied to each term before adding it to the tree..
 
const atermleft_branch () const
 Get the left branch of the tree.
 
const atermright_branch () const
 Get the left branch of the tree.
 
const Term & operator[] (std::size_t position) const
 Element indexing operator.
 
const Term & element_at (std::size_t position, std::size_t size) const
 Get an element at the indicated position.
 
size_type size () const
 Returns the size of the term_balanced_tree.
 
bool empty () const
 Returns true if tree is empty.
 
bool is_node () const
 Returns true iff the tree is a node with a left and right subtree.
 
iterator begin () const
 Returns an iterator pointing to the beginning of the term_balanced_tree.
 
iterator end () const
 Returns an iterator pointing to the end of the term_balanced_tree.
 
- Public Member Functions inherited from atermpp::term_appl< aterm >
 term_appl ()
 Default constructor.
 
 term_appl (const aterm &t)
 Explicit constructor from an aterm.
 
 term_appl (const term_appl &other) noexcept=default
 This class has user-declared copy constructor so declare default copy and move operators.
 
 term_appl (term_appl &&other) noexcept=default
 
 term_appl (const function_symbol &sym, ForwardIterator begin, ForwardIterator end)
 Constructor that provides an aterm_appl based on a function symbol and forward iterator providing the arguments.
 
 term_appl (const function_symbol &sym, InputIterator begin, InputIterator end)
 Constructor that provides an aterm_appl based on a function symbol and an input iterator providing the arguments.
 
 term_appl (const function_symbol &sym, InputIterator begin, InputIterator end, TermConverter converter)
 
 term_appl (const function_symbol &sym)
 Constructor.
 
 term_appl (const function_symbol &symbol, const Terms &...arguments)
 Constructor for n-arity function application.
 
term_apploperator= (const term_appl &other) noexcept=default
 
term_apploperator= (term_appl &&other) noexcept=default
 
const function_symbolfunction () const
 Returns the function symbol belonging to an aterm_appl.
 
size_type size () const
 Returns the number of arguments of this term.
 
bool empty () const
 Returns true if the term has no arguments.
 
const_iterator begin () const
 Returns an iterator pointing to the first argument.
 
const_iterator end () const
 Returns a const_iterator pointing past the last argument.
 
constexpr size_type max_size () const
 Returns the largest possible number of arguments.
 
const atermoperator[] (const size_type i) const
 Returns the i-th argument.
 
- Public Member Functions inherited from atermpp::aterm
 aterm () noexcept
 Default constructor.
 
 ~aterm () noexcept
 Standard destructor.
 
 aterm (const detail::_aterm *t) noexcept
 Constructor based on an internal term data structure. This is not for public use.
 
 aterm (const aterm &other) noexcept
 Copy constructor.
 
 aterm (aterm &&other) noexcept
 Move constructor.
 
atermoperator= (const aterm &other) noexcept
 Assignment operator.
 
atermassign (const aterm &other, detail::thread_aterm_pool &pool) noexcept
 Assignment operator, to be used if busy and forbidden flags are explicitly available.
 
template<bool CHECK_BUSY_FLAG = true>
atermunprotected_assign (const aterm &other) noexcept
 Assignment operator, to be used when the busy flags do not need to be set.
 
atermoperator= (aterm &&other) noexcept
 Move assignment operator.
 
- Public Member Functions inherited from atermpp::unprotected_aterm
 unprotected_aterm () noexcept
 Default constuctor.
 
 unprotected_aterm (const detail::_aterm *term) noexcept
 Constructor.
 
bool type_is_appl () const noexcept
 Dynamic check whether the term is an aterm_appl.
 
bool type_is_int () const noexcept
 Dynamic check whether the term is an aterm_int.
 
bool type_is_list () const noexcept
 Dynamic check whether the term is an aterm_list.
 
bool operator== (const unprotected_aterm &t) const
 Comparison operator.
 
bool operator!= (const unprotected_aterm &t) const
 Inequality operator on two unprotected aterms.
 
bool operator< (const unprotected_aterm &t) const
 Comparison operator for two unprotected aterms.
 
bool operator> (const unprotected_aterm &t) const
 Comparison operator for two unprotected aterms.
 
bool operator<= (const unprotected_aterm &t) const
 Comparison operator for two unprotected aterms.
 
bool operator>= (const unprotected_aterm &t) const
 Comparison operator for two unprotected aterms.
 
bool defined () const
 Returns true if this term is not equal to the term assigned by the default constructor of aterms, term_appl<T>'s and aterm_int.
 
void swap (unprotected_aterm &t) noexcept
 Swaps this term with its argument.
 
const function_symbolfunction () const
 Yields the function symbol in an aterm.
 

Protected Member Functions

 term_balanced_tree (detail::_term_appl *t)
 
- Protected Member Functions inherited from atermpp::term_appl< aterm >
 term_appl (detail::_term_appl *t)
 Constructor.
 

Static Protected Member Functions

static const function_symboltree_empty_function ()
 
static const function_symboltree_single_node_function ()
 
static const function_symboltree_node_function ()
 
static const aterm_applempty_tree ()
 
template<typename ForwardTraversalIterator , class Transformer >
static void make_tree_helper (aterm &result, ForwardTraversalIterator &p, const std::size_t size, Transformer transformer)
 
template<typename ForwardTraversalIterator , class Transformer >
static void make_tree (aterm &result, ForwardTraversalIterator &p, const std::size_t size, Transformer transformer)
 

Friends

template<class Term1 , class ForwardTraversalIterator , class Transformer >
void make_term_balanced_tree (term_balanced_tree< Term1 > &result, ForwardTraversalIterator p, const std::size_t size, Transformer transformer)
 

Additional Inherited Members

- Protected Attributes inherited from atermpp::unprotected_aterm
const detail::_atermm_term
 

Detailed Description

template<typename Term>
class atermpp::term_balanced_tree< Term >

Read-only balanced binary tree of terms.

Definition at line 44 of file aterm_balanced_tree.h.

Member Typedef Documentation

◆ const_reference

template<typename Term >
typedef const Term atermpp::term_balanced_tree< Term >::const_reference

Const reference to T.

Definition at line 126 of file aterm_balanced_tree.h.

◆ difference_type

template<typename Term >
typedef ptrdiff_t atermpp::term_balanced_tree< Term >::difference_type

A signed integral type.

Definition at line 132 of file aterm_balanced_tree.h.

◆ pointer

template<typename Term >
typedef Term* atermpp::term_balanced_tree< Term >::pointer

Pointer to T.

Definition at line 120 of file aterm_balanced_tree.h.

◆ reference

template<typename Term >
typedef Term& atermpp::term_balanced_tree< Term >::reference

Reference to T.

Definition at line 123 of file aterm_balanced_tree.h.

◆ size_type

template<typename Term >
typedef std::size_t atermpp::term_balanced_tree< Term >::size_type

An unsigned integral type.

Definition at line 129 of file aterm_balanced_tree.h.

◆ value_type

template<typename Term >
typedef Term atermpp::term_balanced_tree< Term >::value_type

The type of object, T stored in the term_balanced_tree.

Definition at line 117 of file aterm_balanced_tree.h.

Constructor & Destructor Documentation

◆ term_balanced_tree() [1/7]

template<typename Term >
atermpp::term_balanced_tree< Term >::term_balanced_tree ( detail::_term_appl t)
inlineexplicitprotected

Definition at line 110 of file aterm_balanced_tree.h.

◆ term_balanced_tree() [2/7]

template<typename Term >
atermpp::term_balanced_tree< Term >::term_balanced_tree ( )
inline

Default constructor. Creates an empty tree.

Definition at line 135 of file aterm_balanced_tree.h.

◆ term_balanced_tree() [3/7]

template<typename Term >
atermpp::term_balanced_tree< Term >::term_balanced_tree ( const term_balanced_tree< Term > &  )
defaultnoexcept

Copy constructor.

◆ term_balanced_tree() [4/7]

template<typename Term >
atermpp::term_balanced_tree< Term >::term_balanced_tree ( term_balanced_tree< Term > &&  )
defaultnoexcept

Move constructor.

◆ term_balanced_tree() [5/7]

template<typename Term >
atermpp::term_balanced_tree< Term >::term_balanced_tree ( const aterm tree)
inlineexplicit

Construction from aterm.

Definition at line 152 of file aterm_balanced_tree.h.

◆ term_balanced_tree() [6/7]

template<typename Term >
template<typename ForwardTraversalIterator >
atermpp::term_balanced_tree< Term >::term_balanced_tree ( ForwardTraversalIterator  first,
const std::size_t  size 
)
inline

Creates an term_balanced_tree with a copy of a range.

Parameters
firstThe start of a range of elements.
sizeThe size of the range of elements.

Definition at line 168 of file aterm_balanced_tree.h.

◆ term_balanced_tree() [7/7]

template<typename Term >
template<typename ForwardTraversalIterator , typename Transformer >
atermpp::term_balanced_tree< Term >::term_balanced_tree ( ForwardTraversalIterator  first,
const std::size_t  size,
Transformer  transformer 
)
inline

Creates an term_balanced_tree with a copy of a range, where a transformer is applied to each term before adding it to the tree..

Parameters
[in]firstThe start of a range of elements.
[in]sizeThe size of the range of elements.
[in]transformerA class with an operator() that is applied to each term before adding it to the tree.

Definition at line 179 of file aterm_balanced_tree.h.

Member Function Documentation

◆ begin()

template<typename Term >
iterator atermpp::term_balanced_tree< Term >::begin ( ) const
inline

Returns an iterator pointing to the beginning of the term_balanced_tree.

Returns
The beginning of the list.

Definition at line 407 of file aterm_balanced_tree.h.

◆ element_at()

template<typename Term >
const Term & atermpp::term_balanced_tree< Term >::element_at ( std::size_t  position,
std::size_t  size 
) const
inline

Get an element at the indicated position.

Parameters
positionThe required position
sizeThe number of elements in the tree. This is required to make the complexity logarithmic.

By providing the size this operation is logarithmic. If a wrong size is provided the outcome is not determined. See also operator [].

Returns
The element at the indicated position.

Definition at line 219 of file aterm_balanced_tree.h.

◆ empty()

template<typename Term >
bool atermpp::term_balanced_tree< Term >::empty ( ) const
inline

Returns true if tree is empty.

Returns
True iff the tree is empty.

Definition at line 275 of file aterm_balanced_tree.h.

◆ empty_tree()

template<typename Term >
static const aterm_appl & atermpp::term_balanced_tree< Term >::empty_tree ( )
inlinestaticprotected

Definition at line 58 of file aterm_balanced_tree.h.

◆ end()

template<typename Term >
iterator atermpp::term_balanced_tree< Term >::end ( ) const
inline

Returns an iterator pointing to the end of the term_balanced_tree.

Returns
The end of the list.

Definition at line 414 of file aterm_balanced_tree.h.

◆ is_node()

template<typename Term >
bool atermpp::term_balanced_tree< Term >::is_node ( ) const
inline

Returns true iff the tree is a node with a left and right subtree.

Returns
True iff the tree is a node with a left and right subtree.

Definition at line 282 of file aterm_balanced_tree.h.

◆ left_branch()

template<typename Term >
const aterm & atermpp::term_balanced_tree< Term >::left_branch ( ) const
inline

Get the left branch of the tree.

It is assumed that the tree is a node with a left branch.

Returns
A reference t the left subtree of the current tree

Definition at line 187 of file aterm_balanced_tree.h.

◆ make_tree()

template<typename Term >
template<typename ForwardTraversalIterator , class Transformer >
static void atermpp::term_balanced_tree< Term >::make_tree ( aterm result,
ForwardTraversalIterator &  p,
const std::size_t  size,
Transformer  transformer 
)
inlinestaticprotected

Definition at line 90 of file aterm_balanced_tree.h.

◆ make_tree_helper()

template<typename Term >
template<typename ForwardTraversalIterator , class Transformer >
static void atermpp::term_balanced_tree< Term >::make_tree_helper ( aterm result,
ForwardTraversalIterator &  p,
const std::size_t  size,
Transformer  transformer 
)
inlinestaticprotected

Definition at line 61 of file aterm_balanced_tree.h.

◆ operator=() [1/2]

template<typename Term >
term_balanced_tree & atermpp::term_balanced_tree< Term >::operator= ( const term_balanced_tree< Term > &  )
defaultnoexcept

Assignment operator.

◆ operator=() [2/2]

template<typename Term >
term_balanced_tree & atermpp::term_balanced_tree< Term >::operator= ( term_balanced_tree< Term > &&  )
defaultnoexcept

Move assign operator.

◆ operator[]()

template<typename Term >
const Term & atermpp::term_balanced_tree< Term >::operator[] ( std::size_t  position) const
inline

Element indexing operator.

Parameters
positionIndex in the tree.

This operation behaves linearly with respect to container size, because it must calculate the size of the container. The operator element_at behaves logarithmically.

Definition at line 207 of file aterm_balanced_tree.h.

◆ right_branch()

template<typename Term >
const aterm & atermpp::term_balanced_tree< Term >::right_branch ( ) const
inline

Get the left branch of the tree.

It is assumed that the tree is a node with a left branch.

Returns
A reference t the left subtree of the current tree

Definition at line 196 of file aterm_balanced_tree.h.

◆ size()

template<typename Term >
size_type atermpp::term_balanced_tree< Term >::size ( ) const
inline

Returns the size of the term_balanced_tree.

This operator is linear in the size of the balanced tree.

Returns
The size of the tree.

Definition at line 261 of file aterm_balanced_tree.h.

◆ tree_empty_function()

template<typename Term >
static const function_symbol & atermpp::term_balanced_tree< Term >::tree_empty_function ( )
inlinestaticprotected

Definition at line 55 of file aterm_balanced_tree.h.

◆ tree_node_function()

template<typename Term >
static const function_symbol & atermpp::term_balanced_tree< Term >::tree_node_function ( )
inlinestaticprotected

Definition at line 57 of file aterm_balanced_tree.h.

◆ tree_single_node_function()

template<typename Term >
static const function_symbol & atermpp::term_balanced_tree< Term >::tree_single_node_function ( )
inlinestaticprotected

Definition at line 56 of file aterm_balanced_tree.h.

Friends And Related Symbol Documentation

◆ make_term_balanced_tree

template<typename Term >
template<class Term1 , class ForwardTraversalIterator , class Transformer >
void make_term_balanced_tree ( term_balanced_tree< Term1 > &  result,
ForwardTraversalIterator  p,
const std::size_t  size,
Transformer  transformer 
)
friend

The documentation for this class was generated from the following file: