Loading...
Searching...
No Matches
LList< LListBase, T > Class Template Reference

Template class for non-intrusive linked lists. More...

#include <LList.H>

Inheritance diagram for LList< LListBase, T >:
Collaboration diagram for LList< LListBase, T >:

Classes

 The storage of T with linked nodes. More...
class  iterator
 An STL-conforming iterator. More...
class  const_iterator
 An STL-conforming const_iterator. More...
class  reverse_iterator
 A reverse_iterator, for LListBase classes that support reverse iteration. More...
class  const_reverse_iterator
 A const_reverse_iterator, for LListBase classes that support reverse iteration. More...

Public Types

typedef T value_type
 Type of values stored.
typedef Tpointer
 Pointer for value_type.
typedef const Tconst_pointer
 Const pointer for value_type.
typedef Treference
 Reference for value_type.
typedef const Tconst_reference
 Const reference for value_type.
typedef label size_type
 The type that can represent the container size.
typedef label difference_type
 The difference between iterators.
using base_iterator = typename LListBase::iterator
using const_base_iterator = typename LListBase::const_iterator

Public Member Functions

 LList ()=default
 Default construct.
 LList (const T &elem)
 Construct and copy add initial item.
 LList (T &&elem)
 Construct and move add initial item.
 LList (Istream &is)
 Construct from Istream.
 LList (const LList< LListBase, T > &lst)
 Copy construct.
 LList (LList< LListBase, T > &&lst)
 Move construct.
 LList (std::initializer_list< T > lst)
 Copy construct from an initializer list.
 ~LList ()
 Destructor. Calls clear().
reference front ()
 The first entry in the list.
const_reference front () const
 The first entry in the list (const access).
reference back ()
 The last entry in the list.
const_reference back () const
 The last entry in the list (const access).
void push_front (const T &elem)
 Add copy at front of list.
void push_front (T &&elem)
 Move construct at front of list.
void push_back (const T &elem)
 Add copy at back of list.
void push_back (T &&elem)
 Move construct at back of list.
void clear ()
 Delete contents of list.
void pop_front (label n=1)
 Remove first element(s) from the list (deletes pointers).
T removeHead ()
 Remove and return first entry.
T remove (link *item)
 Remove and return element.
T remove (iterator &iter)
 Remove and return element specified by iterator.
void transfer (LList< LListBase, T > &lst)
 Transfer the contents of the argument into this List and annul the argument list.
void operator= (const LList< LListBase, T > &lst)
 Copy assignment.
void operator= (LList< LListBase, T > &&lst)
 Move assignment.
void operator= (std::initializer_list< T > lst)
 Copy assignment from an initializer list.
IstreamreadList (Istream &is)
 Read list from Istream.
OstreamwriteList (Ostream &os, const label shortLen=0) const
 Write LList with line-breaks when length exceeds shortLen.
iterator begin ()
 Iterator to first item in list with non-const access.
const_iterator cbegin () const
 Iterator to first item in list with const access.
reverse_iterator rbegin ()
 Iterator to last item in list with non-const access.
const_reverse_iterator crbegin () const
 Iterator to last item in list with const access.
const_iterator begin () const
 Iterator to first item in list with const access.
const_reverse_iterator rbegin () const
 Iterator to last item in list with const access.
const iteratorend ()
 End of list for forward iterators.
const const_iteratorcend () const
 End of list for forward iterators.
const reverse_iteratorrend ()
 End of list for reverse iterators.
const const_reverse_iteratorcrend () const
 End of list for reverse iterators.
const const_iteratorend () const
 End of list for forward iterators.
const const_reverse_iteratorrend () const
 End of list for reverse iterators.
reference first ()
 The first entry in the list.
const_reference first () const
 The first entry in the list (const access).
reference last ()
 The last entry in the list.
const_reference last () const
 The last entry in the list (const access).
void prepend (const T &elem)
 Add copy at front of list.
void prepend (T &&elem)
 Move construct at front of list.
void append (const T &elem)
 Add copy at back of list.
void append (T &&elem)
 Move construct at back of list.
void insert (const T &elem)
 Add copy at front of list. Same as push_front().
void insert (T &&elem)
 Move construct at front of list. Same as push_front().

Friends

Istreamoperator>> (Istream &is, LList< LListBase, T > &lst)
 Read list from Istream.
Ostreamoperator (Ostream &os, const LList< LListBase, T > &lst)
 Write LList to Ostream with line breaks, as per writeList with shortLen=-1.

Detailed Description

template<class LListBase, class T>
class Foam::LList< LListBase, T >

Template class for non-intrusive linked lists.

Source files

Definition at line 68 of file LList.H.

Member Typedef Documentation

◆ value_type

template<class LListBase, class T>
typedef T value_type

Type of values stored.

Definition at line 79 of file LList.H.

◆ pointer

template<class LListBase, class T>
typedef T* pointer

Pointer for value_type.

Definition at line 84 of file LList.H.

◆ const_pointer

template<class LListBase, class T>
typedef const T* const_pointer

Const pointer for value_type.

Definition at line 89 of file LList.H.

◆ reference

template<class LListBase, class T>
typedef T& reference

Reference for value_type.

Definition at line 94 of file LList.H.

◆ const_reference

template<class LListBase, class T>
typedef const T& const_reference

Const reference for value_type.

Definition at line 99 of file LList.H.

◆ size_type

template<class LListBase, class T>
typedef label size_type

The type that can represent the container size.

Definition at line 104 of file LList.H.

◆ difference_type

template<class LListBase, class T>
typedef label difference_type

The difference between iterators.

Definition at line 109 of file LList.H.

◆ base_iterator

template<class LListBase, class T>
using base_iterator = typename LListBase::iterator

Definition at line 117 of file LList.H.

◆ const_base_iterator

template<class LListBase, class T>
using const_base_iterator = typename LListBase::const_iterator

Definition at line 118 of file LList.H.

Constructor & Destructor Documentation

◆ LList() [1/7]

template<class LListBase, class T>
LList ( )
default

Default construct.

Referenced by LList(), LList(), operator=(), operator=(), readList(), and transfer().

Here is the caller graph for this function:

◆ LList() [2/7]

template<class LListBase, class T>
LList ( const T & elem)
inlineexplicit

Construct and copy add initial item.

Definition at line 205 of file LList.H.

◆ LList() [3/7]

template<class LListBase, class T>
LList ( T && elem)
inlineexplicit

Construct and move add initial item.

Definition at line 213 of file LList.H.

◆ LList() [4/7]

template<class LListBase, class T>
LList ( Istream & is)
explicit

Construct from Istream.

Definition at line 29 of file LListIO.C.

References operator>>.

Here is the call graph for this function:

◆ LList() [5/7]

template<class LListBase, class T>
LList ( const LList< LListBase, T > & lst)

Copy construct.

Definition at line 27 of file LList.C.

References LList(), push_back(), and Foam::T().

Here is the call graph for this function:

◆ LList() [6/7]

template<class LListBase, class T>
LList ( LList< LListBase, T > && lst)

Move construct.

Definition at line 39 of file LList.C.

References LList().

Here is the call graph for this function:

◆ LList() [7/7]

template<class LListBase, class T>
LList ( std::initializer_list< T > lst)

Copy construct from an initializer list.

Definition at line 48 of file LList.C.

References push_back(), and Foam::T().

Here is the call graph for this function:

◆ ~LList()

template<class LListBase, class T>
~LList ( )

Destructor. Calls clear().

Definition at line 62 of file LList.C.

References clear().

Here is the call graph for this function:

Member Function Documentation

◆ front() [1/2]

template<class LListBase, class T>
reference front ( )
inline

The first entry in the list.

Definition at line 250 of file LList.H.

Referenced by LList< LListBase, T * >::first(), and LList< LListBase, T * >::first().

Here is the caller graph for this function:

◆ front() [2/2]

template<class LListBase, class T>
const_reference front ( ) const
inline

The first entry in the list (const access).

Definition at line 258 of file LList.H.

◆ back() [1/2]

template<class LListBase, class T>
reference back ( )
inline

The last entry in the list.

Definition at line 266 of file LList.H.

Referenced by LList< LListBase, T * >::last(), and LList< LListBase, T * >::last().

Here is the caller graph for this function:

◆ back() [2/2]

template<class LListBase, class T>
const_reference back ( ) const
inline

The last entry in the list (const access).

Definition at line 274 of file LList.H.

◆ push_front() [1/2]

template<class LListBase, class T>
void push_front ( const T & elem)
inline

◆ push_front() [2/2]

template<class LListBase, class T>
void push_front ( T && elem)
inline

Move construct at front of list.

Definition at line 291 of file LList.H.

◆ push_back() [1/2]

template<class LListBase, class T>
void push_back ( const T & elem)
inline

Add copy at back of list.

Definition at line 299 of file LList.H.

Referenced by LList< LListBase, T * >::append(), LList< LListBase, T * >::append(), LList(), LList(), operator=(), operator=(), and readList().

Here is the caller graph for this function:

◆ push_back() [2/2]

template<class LListBase, class T>
void push_back ( T && elem)
inline

Move construct at back of list.

Definition at line 307 of file LList.H.

◆ clear()

template<class LListBase, class T>
void clear ( )

Delete contents of list.

Definition at line 88 of file LList.C.

References pop_front().

Referenced by LPtrList< LListBase, T >::clear(), and readList().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ pop_front()

template<class LListBase, class T>
void pop_front ( label n = 1)

Remove first element(s) from the list (deletes pointers).

Definition at line 71 of file LList.C.

References n, and p.

Referenced by clear().

Here is the caller graph for this function:

◆ removeHead()

template<class LListBase, class T>
T removeHead ( )
inline

Remove and return first entry.

Definition at line 325 of file LList.H.

◆ remove() [1/2]

template<class LListBase, class T>
T remove ( link * item)
inline

Remove and return element.

Definition at line 333 of file LList.H.

◆ remove() [2/2]

template<class LListBase, class T>
T remove ( iterator & iter)
inline

Remove and return element specified by iterator.

Definition at line 341 of file LList.H.

◆ transfer()

template<class LListBase, class T>
void transfer ( LList< LListBase, T > & lst)

Transfer the contents of the argument into this List and annul the argument list.

Definition at line 96 of file LList.C.

References clear(), and LList().

Referenced by LPtrList< LListBase, T >::transfer().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ operator=() [1/3]

template<class LListBase, class T>
void operator= ( const LList< LListBase, T > & lst)

Copy assignment.

Definition at line 106 of file LList.C.

References clear(), LList(), push_back(), and Foam::T().

Here is the call graph for this function:

◆ operator=() [2/3]

template<class LListBase, class T>
void operator= ( LList< LListBase, T > && lst)

Move assignment.

Definition at line 118 of file LList.C.

References clear(), and LList().

Here is the call graph for this function:

◆ operator=() [3/3]

template<class LListBase, class T>
void operator= ( std::initializer_list< T > lst)

Copy assignment from an initializer list.

Definition at line 127 of file LList.C.

References clear(), push_back(), and Foam::T().

Here is the call graph for this function:

◆ readList()

◆ writeList()

template<class LListBase, class T>
Foam::Ostream & writeList ( Ostream & os,
const label shortLen = 0 ) const

Write LList with line-breaks when length exceeds shortLen.

Using '0' suppresses line-breaks entirely.

Definition at line 117 of file LListIO.C.

References token::BEGIN_LIST, token::END_LIST, FUNCTION_NAME, Foam::nl, os(), token::SPACE, and Foam::T().

Here is the call graph for this function:

◆ begin() [1/2]

template<class LListBase, class T>
iterator begin ( )
inline

Iterator to first item in list with non-const access.

Definition at line 600 of file LList.H.

◆ cbegin()

template<class LListBase, class T>
const_iterator cbegin ( ) const
inline

Iterator to first item in list with const access.

Definition at line 608 of file LList.H.

Referenced by valueAverageBase::calc().

Here is the caller graph for this function:

◆ rbegin() [1/2]

template<class LListBase, class T>
reverse_iterator rbegin ( )
inline

Iterator to last item in list with non-const access.

Definition at line 616 of file LList.H.

◆ crbegin()

template<class LListBase, class T>
const_reverse_iterator crbegin ( ) const
inline

Iterator to last item in list with const access.

Definition at line 624 of file LList.H.

Referenced by LList< LListBase, T * >::rbegin().

Here is the caller graph for this function:

◆ begin() [2/2]

template<class LListBase, class T>
const_iterator begin ( ) const
inline

Iterator to first item in list with const access.

Definition at line 632 of file LList.H.

◆ rbegin() [2/2]

template<class LListBase, class T>
const_reverse_iterator rbegin ( ) const
inline

Iterator to last item in list with const access.

Definition at line 640 of file LList.H.

◆ end() [1/2]

template<class LListBase, class T>
const iterator & end ( )
inline

End of list for forward iterators.

Definition at line 649 of file LList.H.

◆ cend()

template<class LListBase, class T>
const const_iterator & cend ( ) const
inline

End of list for forward iterators.

Definition at line 657 of file LList.H.

Referenced by LList< LListBase, T * >::end().

Here is the caller graph for this function:

◆ rend() [1/2]

template<class LListBase, class T>
const reverse_iterator & rend ( )
inline

End of list for reverse iterators.

Definition at line 665 of file LList.H.

◆ crend()

template<class LListBase, class T>
const const_reverse_iterator & crend ( ) const
inline

End of list for reverse iterators.

Definition at line 673 of file LList.H.

Referenced by LList< LListBase, T * >::rend().

Here is the caller graph for this function:

◆ end() [2/2]

template<class LListBase, class T>
const const_iterator & end ( ) const
inline

End of list for forward iterators.

Definition at line 681 of file LList.H.

◆ rend() [2/2]

template<class LListBase, class T>
const const_reverse_iterator & rend ( ) const
inline

End of list for reverse iterators.

Definition at line 689 of file LList.H.

◆ first() [1/2]

template<class LListBase, class T>
reference first ( )
inline

The first entry in the list.

FOAM_DEPRECATED_FOR(2022-10, "front()")

Definition at line 702 of file LList.H.

Referenced by valueAverageBase::calc().

Here is the caller graph for this function:

◆ first() [2/2]

template<class LListBase, class T>
const_reference first ( ) const
inline

The first entry in the list (const access).

FOAM_DEPRECATED_FOR(2022-10, "front()")

Definition at line 709 of file LList.H.

◆ last() [1/2]

template<class LListBase, class T>
reference last ( )
inline

The last entry in the list.

FOAM_DEPRECATED_FOR(2022-10, "back()")

Definition at line 716 of file LList.H.

◆ last() [2/2]

template<class LListBase, class T>
const_reference last ( ) const
inline

The last entry in the list (const access).

FOAM_DEPRECATED_FOR(2022-10, "back()")

Definition at line 723 of file LList.H.

◆ prepend() [1/2]

template<class LListBase, class T>
void prepend ( const T & elem)
inline

Add copy at front of list.

FOAM_DEPRECATED_FOR(2022-10, "push_front()")

Definition at line 730 of file LList.H.

◆ prepend() [2/2]

template<class LListBase, class T>
void prepend ( T && elem)
inline

Move construct at front of list.

FOAM_DEPRECATED_FOR(2022-10, "push_front()")

Definition at line 737 of file LList.H.

◆ append() [1/2]

template<class LListBase, class T>
void append ( const T & elem)
inline

Add copy at back of list.

FOAM_DEPRECATED_FOR(2022-10, "push_back()")

Definition at line 744 of file LList.H.

◆ append() [2/2]

template<class LListBase, class T>
void append ( T && elem)
inline

Move construct at back of list.

FOAM_DEPRECATED_FOR(2022-10, "push_back()")

Definition at line 751 of file LList.H.

◆ insert() [1/2]

template<class LListBase, class T>
void insert ( const T & elem)
inline

Add copy at front of list. Same as push_front().

FOAM_DEPRECATED_FOR(2022-01, "push_front()")

Definition at line 758 of file LList.H.

◆ insert() [2/2]

template<class LListBase, class T>
void insert ( T && elem)
inline

Move construct at front of list. Same as push_front().

FOAM_DEPRECATED_FOR(2022-01, "push_front()")

Definition at line 765 of file LList.H.

◆ operator>>

template<class LListBase, class T>
Istream & operator>> ( Istream & is,
LList< LListBase, T > & lst )
friend

Read list from Istream.

Referenced by LList().

◆ operator

template<class LListBase, class T>
Ostream & operator ( Ostream & os,
const LList< LListBase, T > & lst )
friend

Write LList to Ostream with line breaks, as per writeList with shortLen=-1.


The documentation for this class was generated from the following files:
  • src/OpenFOAM/containers/LinkedLists/accessTypes/LList/LList.H
  • src/OpenFOAM/containers/LinkedLists/accessTypes/LList/LList.C
  • src/OpenFOAM/containers/LinkedLists/accessTypes/LList/LListIO.C