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

A list of aterm objects. More...

#include <aterm_list.h>

Inheritance diagram for atermpp::term_list< Term >:
atermpp::aterm atermpp::aterm_core atermpp::unprotected_aterm_core

Public Types

using value_type = Term
 The type of object, T stored in the term_list.
 
using pointer = Term *
 Pointer to T.
 
using reference = Term &
 Reference to T.
 
using const_reference = const Term &
 Const reference to T.
 
using size_type = std::size_t
 An unsigned integral type.
 
using difference_type = ptrdiff_t
 A signed integral type.
 
using iterator = term_list_iterator< Term >
 Iterator used to iterate through an term_list.
 
using const_iterator = term_list_iterator< Term >
 Const iterator used to iterate through an term_list.
 
using const_reverse_iterator = reverse_term_list_iterator< Term >
 Const iterator used to iterate through an term_list.
 
- Public Types inherited from atermpp::aterm
using size_type = std::size_t
 An unsigned integral type.
 
using difference_type = ptrdiff_t
 A signed integral type.
 
using iterator = term_appl_iterator< aterm >
 Iterator used to iterate through an term_appl.
 
using const_iterator = term_appl_iterator< aterm >
 Const iterator used to iterate through an term_appl.
 

Public Member Functions

 term_list () noexcept
 Default constructor. Creates an empty list.
 
 term_list (const aterm &t) noexcept
 Constructor from an aterm.
 
 term_list (const term_list< Term > &t) noexcept
 Copy constructor.
 
 term_list (term_list< Term > &&t) noexcept
 Move constructor.
 
term_listoperator= (const term_list &other) noexcept=default
 This class has user-declared copy constructor so declare copy and move assignment.
 
term_listoperator= (term_list &&other) noexcept=default
 
template<class Iter >
requires std::is_base_of_v<std::bidirectional_iterator_tag, typename std::iterator_traits<Iter>::iterator_category>
 term_list (Iter first, Iter last)
 Creates a term_list with the elements from first to last.
 
template<class Iter , class ATermConverter >
requires std::is_base_of_v<std::bidirectional_iterator_tag, typename std::iterator_traits<Iter>::iterator_category>
 term_list (Iter first, Iter last, const ATermConverter &convert_to_aterm)
 Creates a term_list with the elements from first to last converting the elements before inserting.
 
template<class Iter , class ATermConverter , class ATermFilter >
requires std::is_base_of_v<std::bidirectional_iterator_tag, typename std::iterator_traits<Iter>::iterator_category>
 term_list (Iter first, Iter last, const ATermConverter &convert_to_aterm, const ATermFilter &aterm_filter)
 Creates a term_list with the elements from first to last, converting and filtering the list.
 
template<class Iter >
requires (!std::is_base_of_v<std::bidirectional_iterator_tag, typename std::iterator_traits<Iter>::iterator_category>)
 term_list (Iter first, Iter last)
 Creates a term_list from the elements from first to last.
 
template<class Iter , class ATermConverter >
requires (!std::is_base_of_v<std::bidirectional_iterator_tag, typename std::iterator_traits<Iter>::iterator_category>)
 term_list (Iter first, Iter last, const ATermConverter &convert_to_aterm)
 Creates a term_list from the elements from first to last converting the elements before inserting.
 
template<class Iter , class ATermConverter , class ATermFilter >
requires (!std::is_base_of_v<std::bidirectional_iterator_tag, typename std::iterator_traits<Iter>::iterator_category>)
 term_list (Iter first, Iter last, const ATermConverter &convert_to_aterm, const ATermFilter &aterm_filter)
 Creates a term_list from the elements from first to last converting and filtering the elements before inserting.
 
template<std::ranges::range R>
requires std::is_convertible_v<std::ranges::range_value_t<R>, Term>
 term_list (R &&r)
 Creates a term_list from the elements in the range.
 
 term_list (std::initializer_list< Term > init)
 A constructor based on an initializer list.
 
const term_list< Term > & tail () const
 Returns the tail of the list.
 
void pop_front ()
 Removes the first element of the list.
 
const Term & front () const
 Returns the first element of the list.
 
void push_front (const Term &el)
 Inserts a new element at the beginning of the current list.
 
template<typename ... Args>
void emplace_front (Args &&... arguments)
 Construct and insert a new element at the beginning of the current list.
 
size_type size () const
 Returns the size of the term_list.
 
bool empty () const
 Returns true if the list's size is 0.
 
const_iterator begin () const
 Returns a const_iterator pointing to the beginning of the term_list.
 
const_iterator end () const
 Returns a const_iterator pointing to the end of the term_list.
 
const_reverse_iterator rbegin () const
 Returns a const_reverse_iterator pointing to the end of the term_list.
 
const_reverse_iterator rend () const
 Returns a const_iterator pointing to the end of the term_list.
 
size_type max_size () const
 Returns the largest possible size of the term_list.
 
- Public Member Functions inherited from atermpp::aterm
 aterm ()
 Default constructor.
 
 aterm (const aterm &other) noexcept=default
 This class has user-declared copy constructor so declare default copy and move operators.
 
atermoperator= (const aterm &other) noexcept=default
 
 aterm (aterm &&other) noexcept=default
 
atermoperator= (aterm &&other) noexcept=default
 
template<class ForwardIterator >
requires (mcrl2::utilities::is_iterator<ForwardIterator>::value && !std::is_same_v<typename ForwardIterator::iterator_category, std::input_iterator_tag> && !std::is_same_v<typename ForwardIterator::iterator_category, std::output_iterator_tag>)
 aterm (const function_symbol &sym, ForwardIterator begin, ForwardIterator end)
 Constructor that provides an aterm based on a function symbol and forward iterator providing the arguments.
 
template<class InputIterator >
requires mcrl2::utilities::is_iterator<InputIterator>
 aterm (const function_symbol &sym, InputIterator begin, InputIterator end)
 Constructor that provides an aterm based on a function symbol and an input iterator providing the arguments.
 
template<class InputIterator , class TermConverter >
requires mcrl2::utilities::is_iterator<InputIterator>
 aterm (const function_symbol &sym, InputIterator begin, InputIterator end, TermConverter converter)
 Constructor.
 
template<typename... Terms>
 aterm (const function_symbol &symbol, const Terms &... arguments)
 Constructor for n-arity function application.
 
const function_symbolfunction () const
 Returns the function symbol belonging to an aterm.
 
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_core
 aterm_core () noexcept
 Default constructor.
 
 ~aterm_core () noexcept
 Standard destructor.
 
 aterm_core (const detail::_aterm *t) noexcept
 Constructor based on an internal term data structure. This is not for public use.
 
 aterm_core (const aterm_core &other) noexcept
 Copy constructor.
 
 aterm_core (aterm_core &&other) noexcept
 Move constructor.
 
aterm_coreoperator= (const aterm_core &other) noexcept
 Assignment operator.
 
aterm_coreassign (const aterm_core &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>
aterm_coreunprotected_assign (const aterm_core &other) noexcept
 Assignment operator, to be used when the busy flags do not need to be set.
 
aterm_coreoperator= (aterm_core &&other) noexcept
 Move assignment operator.
 
- Public Member Functions inherited from atermpp::unprotected_aterm_core
 unprotected_aterm_core () noexcept
 Default constuctor.
 
 unprotected_aterm_core (const detail::_aterm *term) noexcept
 Constructor.
 
bool type_is_appl () const noexcept
 Dynamic check whether the term is an aterm.
 
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_core &t) const
 Comparison operator.
 
std::weak_ordering operator<=> (const unprotected_aterm_core &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, aterm_appls and aterm_int.
 
void swap (unprotected_aterm_core &t) noexcept
 Swaps this term with its argument.
 
const function_symbolfunction () const
 Yields the function symbol in an aterm.
 

Protected Member Functions

 term_list (detail::_aterm_appl<> *t) noexcept
 Constructor for term lists from internally constructed terms delivered as reference.
 
- Protected Member Functions inherited from atermpp::aterm
 aterm (detail::_term_appl *t)
 Constructor.
 

Additional Inherited Members

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

Detailed Description

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

A list of aterm objects.

Definition at line 25 of file aterm_list.h.

Member Typedef Documentation

◆ const_iterator

template<typename Term >
using atermpp::term_list< Term >::const_iterator = term_list_iterator<Term>

Const iterator used to iterate through an term_list.

Definition at line 57 of file aterm_list.h.

◆ const_reference

template<typename Term >
using atermpp::term_list< Term >::const_reference = const Term&

Const reference to T.

Definition at line 45 of file aterm_list.h.

◆ const_reverse_iterator

template<typename Term >
using atermpp::term_list< Term >::const_reverse_iterator = reverse_term_list_iterator<Term>

Const iterator used to iterate through an term_list.

Definition at line 60 of file aterm_list.h.

◆ difference_type

template<typename Term >
using atermpp::term_list< Term >::difference_type = ptrdiff_t

A signed integral type.

Definition at line 51 of file aterm_list.h.

◆ iterator

template<typename Term >
using atermpp::term_list< Term >::iterator = term_list_iterator<Term>

Iterator used to iterate through an term_list.

Definition at line 54 of file aterm_list.h.

◆ pointer

template<typename Term >
using atermpp::term_list< Term >::pointer = Term*

Pointer to T.

Definition at line 39 of file aterm_list.h.

◆ reference

template<typename Term >
using atermpp::term_list< Term >::reference = Term&

Reference to T.

Definition at line 42 of file aterm_list.h.

◆ size_type

template<typename Term >
using atermpp::term_list< Term >::size_type = std::size_t

An unsigned integral type.

Definition at line 48 of file aterm_list.h.

◆ value_type

template<typename Term >
using atermpp::term_list< Term >::value_type = Term

The type of object, T stored in the term_list.

Definition at line 36 of file aterm_list.h.

Constructor & Destructor Documentation

◆ term_list() [1/13]

template<typename Term >
atermpp::term_list< Term >::term_list ( detail::_aterm_appl<> *  t)
inlineexplicitprotectednoexcept

Constructor for term lists from internally constructed terms delivered as reference.

Definition at line 29 of file aterm_list.h.

◆ term_list() [2/13]

template<typename Term >
atermpp::term_list< Term >::term_list ( )
inlinenoexcept

Default constructor. Creates an empty list.

Definition at line 63 of file aterm_list.h.

◆ term_list() [3/13]

template<typename Term >
atermpp::term_list< Term >::term_list ( const aterm t)
inlineexplicitnoexcept

Constructor from an aterm.

Parameters
tA list.

Definition at line 69 of file aterm_list.h.

◆ term_list() [4/13]

template<typename Term >
atermpp::term_list< Term >::term_list ( const term_list< Term > &  t)
inlinenoexcept

Copy constructor.

Parameters
tA list.

Definition at line 77 of file aterm_list.h.

◆ term_list() [5/13]

template<typename Term >
atermpp::term_list< Term >::term_list ( term_list< Term > &&  t)
inlinenoexcept

Move constructor.

Parameters
tA list.

Definition at line 85 of file aterm_list.h.

◆ term_list() [6/13]

template<typename Term >
template<class Iter >
requires std::is_base_of_v<std::bidirectional_iterator_tag, typename std::iterator_traits<Iter>::iterator_category>
atermpp::term_list< Term >::term_list ( Iter  first,
Iter  last 
)
inlineexplicit

Creates a term_list with the elements from first to last.

It is assumed that the range can be traversed from last to first.

Parameters
firstThe start of a range of elements.
lastThe end of a range of elements.

Definition at line 102 of file aterm_list.h.

◆ term_list() [7/13]

template<typename Term >
template<class Iter , class ATermConverter >
requires std::is_base_of_v<std::bidirectional_iterator_tag, typename std::iterator_traits<Iter>::iterator_category>
atermpp::term_list< Term >::term_list ( Iter  first,
Iter  last,
const ATermConverter &  convert_to_aterm 
)
inlineexplicit

Creates a term_list with the elements from first to last converting the elements before inserting.

It is assumed that the range can be traversed from last to first. The operator () in the class ATermConverter is applied to each element before inserting it in the list.

Parameters
firstThe start of a range of elements.
lastThe end of a range of elements.
convert_to_atermA class with a () operation, which is applied to each element before it is put into the list.

Definition at line 121 of file aterm_list.h.

◆ term_list() [8/13]

template<typename Term >
template<class Iter , class ATermConverter , class ATermFilter >
requires std::is_base_of_v<std::bidirectional_iterator_tag, typename std::iterator_traits<Iter>::iterator_category>
atermpp::term_list< Term >::term_list ( Iter  first,
Iter  last,
const ATermConverter &  convert_to_aterm,
const ATermFilter &  aterm_filter 
)
inlineexplicit

Creates a term_list with the elements from first to last, converting and filtering the list.

It is assumed that the range can be traversed from last to first. The operator () in the class ATermConverter is applied to each element before inserting it in the list. Elements are only inserted if the operator () of the class ATermFilter yields true when applied to such an element.

Parameters
firstThe start of a range of elements.
lastThe end of a range of elements.
convert_to_atermA class with a () operation, which is applied to each element before it is put into the list.
aterm_filterA class with an operator () that yields a bool, and if true the elements is inserted in the list. Otherwise, it is ignored.

Definition at line 142 of file aterm_list.h.

◆ term_list() [9/13]

template<typename Term >
template<class Iter >
requires (!std::is_base_of_v<std::bidirectional_iterator_tag, typename std::iterator_traits<Iter>::iterator_category>)
atermpp::term_list< Term >::term_list ( Iter  first,
Iter  last 
)
inlineexplicit

Creates a term_list from the elements from first to last.

The range is traversed from first to last. This requires to copy the elements internally, which is less efficient than this function with random access iterators as arguments.

Parameters
firstThe start of a range of elements.
lastThe end of a range of elements.

Definition at line 163 of file aterm_list.h.

◆ term_list() [10/13]

template<typename Term >
template<class Iter , class ATermConverter >
requires (!std::is_base_of_v<std::bidirectional_iterator_tag, typename std::iterator_traits<Iter>::iterator_category>)
atermpp::term_list< Term >::term_list ( Iter  first,
Iter  last,
const ATermConverter &  convert_to_aterm 
)
inlineexplicit

Creates a term_list from the elements from first to last converting the elements before inserting.

The range is traversed from first to last. This requires to copy the elements internally, which is less efficient than this function with random access iterators as arguments. The operator () in the class ATermConverter is applied to each element before inserting it in the list.

Parameters
firstThe start of a range of elements.
lastThe end of a range of elements.
convert_to_atermA class with a () operation, whic is applied to each element before it is put into the list.

Definition at line 185 of file aterm_list.h.

◆ term_list() [11/13]

template<typename Term >
template<class Iter , class ATermConverter , class ATermFilter >
requires (!std::is_base_of_v<std::bidirectional_iterator_tag, typename std::iterator_traits<Iter>::iterator_category>)
atermpp::term_list< Term >::term_list ( Iter  first,
Iter  last,
const ATermConverter &  convert_to_aterm,
const ATermFilter &  aterm_filter 
)
inlineexplicit

Creates a term_list from the elements from first to last converting and filtering the elements before inserting.

The range is traversed from first to last. This requires to copy the elements internally, which is less efficient than this function with random access iterators as arguments. The operator () in the class ATermConverter is applied to each element before inserting it in the list. Elements are only inserted if the operator () of the class ATermFilter yields true when applied to such an element.

Parameters
firstThe start of a range of elements.
lastThe end of a range of elements.
convert_to_atermA class with a () operation, whic is applied to each element before it is put into the list.
aterm_filterA class with an operator () yielding a bool that if true allows the element to be added to the list. Otherwise, the element is not added.

Definition at line 209 of file aterm_list.h.

◆ term_list() [12/13]

template<typename Term >
template<std::ranges::range R>
requires std::is_convertible_v<std::ranges::range_value_t<R>, Term>
atermpp::term_list< Term >::term_list ( R &&  r)
inlineexplicit

Creates a term_list from the elements in the range.

Definition at line 222 of file aterm_list.h.

◆ term_list() [13/13]

template<typename Term >
atermpp::term_list< Term >::term_list ( std::initializer_list< Term >  init)
inline

A constructor based on an initializer list.

This constructor is not made explicit to conform to initializer lists in standard containers.

Parameters
initThe initialiser list.

Definition at line 232 of file aterm_list.h.

Member Function Documentation

◆ begin()

template<typename Term >
const_iterator atermpp::term_list< Term >::begin ( ) const
inline

Returns a const_iterator pointing to the beginning of the term_list.

Returns
The beginning of the list.

Definition at line 293 of file aterm_list.h.

◆ emplace_front()

template<class Term >
template<typename ... Args>
void atermpp::term_list< Term >::emplace_front ( Args &&...  arguments)

Construct and insert a new element at the beginning of the current list.

Parameters
elThe term that is added.

Definition at line 36 of file aterm_list_implementation.h.

◆ empty()

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

Returns true if the list's size is 0.

Returns
True iff the list is empty.

Definition at line 286 of file aterm_list.h.

◆ end()

template<typename Term >
const_iterator atermpp::term_list< Term >::end ( ) const
inline

Returns a const_iterator pointing to the end of the term_list.

Returns
The end of the list.

Definition at line 300 of file aterm_list.h.

◆ front()

template<typename Term >
const Term & atermpp::term_list< Term >::front ( ) const
inline

Returns the first element of the list.

Returns
The term at the head of the list.

Definition at line 257 of file aterm_list.h.

◆ max_size()

template<typename Term >
size_type atermpp::term_list< Term >::max_size ( ) const
inline

Returns the largest possible size of the term_list.

Returns
The largest possible size of the list.

Definition at line 322 of file aterm_list.h.

◆ operator=() [1/2]

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

This class has user-declared copy constructor so declare copy and move assignment.

◆ operator=() [2/2]

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

◆ pop_front()

template<typename Term >
void atermpp::term_list< Term >::pop_front ( )
inline

Removes the first element of the list.

Definition at line 250 of file aterm_list.h.

◆ push_front()

template<class Term >
void atermpp::term_list< Term >::push_front ( const Term &  el)

Inserts a new element at the beginning of the current list.

The length of a short list. If lists are short the stack can be used for temporary data. Otherwise the heap must be used to avoid stack overflow. The chosen value is rather arbitrary.

Parameters
elThe term that is added.

Definition at line 29 of file aterm_list_implementation.h.

◆ rbegin()

template<typename Term >
const_reverse_iterator atermpp::term_list< Term >::rbegin ( ) const
inline

Returns a const_reverse_iterator pointing to the end of the term_list.

This operator requires linear time and memory in the size of the list to yield the iterator.

Returns
The end of the list.

Definition at line 308 of file aterm_list.h.

◆ rend()

template<typename Term >
const_reverse_iterator atermpp::term_list< Term >::rend ( ) const
inline

Returns a const_iterator pointing to the end of the term_list.

Returns
The end of the list.

Definition at line 315 of file aterm_list.h.

◆ size()

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

Returns the size of the term_list.

The complexity of this function is linear in the size of the list.

Returns
The size of the list.

Definition at line 274 of file aterm_list.h.

◆ tail()

template<typename Term >
const term_list< Term > & atermpp::term_list< Term >::tail ( ) const
inline

Returns the tail of the list.

Returns
The tail of the list.

Definition at line 243 of file aterm_list.h.


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