Classes | Public Types | Public Member Functions | Friends | List of all members
LList< LListBase, T > Class Template Reference

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

Inheritance diagram for LList< LListBase, T >:
Inheritance graph
[legend]
Collaboration diagram for LList< LListBase, T >:
Collaboration graph
[legend]

Classes

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

Public Types

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

Public Member Functions

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

Friends

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

Detailed Description

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

Template class for non-intrusive linked lists.

Source files

Definition at line 50 of file LList.H.

Member Typedef Documentation

◆ value_type

typedef T value_type

Type of values stored.

Definition at line 83 of file LList.H.

◆ pointer

typedef T* pointer

Pointer for value_type.

Definition at line 88 of file LList.H.

◆ const_pointer

typedef const T* const_pointer

Const pointer for value_type.

Definition at line 93 of file LList.H.

◆ reference

typedef T& reference

Reference for value_type.

Definition at line 98 of file LList.H.

◆ const_reference

typedef const T& const_reference

Const reference for value_type.

Definition at line 103 of file LList.H.

◆ size_type

typedef label size_type

The type that can represent the container size.

Definition at line 108 of file LList.H.

◆ difference_type

typedef label difference_type

The difference between iterators.

Definition at line 113 of file LList.H.

◆ base_iterator

using base_iterator = typename LListBase::iterator

Definition at line 121 of file LList.H.

◆ const_base_iterator

using const_base_iterator = typename LListBase::const_iterator

Definition at line 122 of file LList.H.

Constructor & Destructor Documentation

◆ LList() [1/7]

LList ( )
default

Default construct.

◆ LList() [2/7]

LList ( const T elem)
inlineexplicit

Construct and copy add initial item.

Definition at line 209 of file LList.H.

◆ LList() [3/7]

LList ( T &&  elem)
inlineexplicit

Construct and move add initial item.

Definition at line 217 of file LList.H.

◆ LList() [4/7]

LList ( Istream is)
explicit

Construct from Istream.

Definition at line 29 of file LListIO.C.

◆ LList() [5/7]

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

Copy construct.

Definition at line 27 of file LList.C.

◆ LList() [6/7]

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

Move construct.

Definition at line 39 of file LList.C.

◆ LList() [7/7]

LList ( std::initializer_list< T lst)

Copy construct from an initializer list.

Definition at line 48 of file LList.C.

◆ ~LList()

~LList ( )

Destructor. Calls clear()

Definition at line 62 of file LList.C.

Member Function Documentation

◆ front() [1/2]

reference front ( )
inline

The first entry in the list.

Definition at line 254 of file LList.H.

Referenced by FIFOStack< writeData *>::bottom(), LList< Foam::chemPointISAT< CompType, ThermoType > *>::first(), and LIFOStack< T >::top().

Here is the caller graph for this function:

◆ front() [2/2]

const_reference front ( ) const
inline

The first entry in the list (const access)

Definition at line 262 of file LList.H.

◆ back() [1/2]

reference back ( )
inline

The last entry in the list.

Definition at line 270 of file LList.H.

Referenced by LIFOStack< T >::bottom(), LList< Foam::chemPointISAT< CompType, ThermoType > *>::last(), and FIFOStack< writeData *>::top().

Here is the caller graph for this function:

◆ back() [2/2]

const_reference back ( ) const
inline

The last entry in the list (const access)

Definition at line 278 of file LList.H.

◆ push_front() [1/2]

void push_front ( const T elem)
inline

◆ push_front() [2/2]

void push_front ( T &&  elem)
inline

Move construct at front of list.

Definition at line 295 of file LList.H.

◆ push_back() [1/2]

void push_back ( const T elem)
inline

Add copy at back of list.

Definition at line 303 of file LList.H.

Referenced by LList< Foam::chemPointISAT< CompType, ThermoType > *>::append(), FIFOStack< writeData *>::push(), and LList< Foam::chemPointISAT< CompType, ThermoType > *>::readList().

Here is the caller graph for this function:

◆ push_back() [2/2]

void push_back ( T &&  elem)
inline

Move construct at back of list.

Definition at line 311 of file LList.H.

◆ clear()

void clear ( )

Delete contents of list.

Definition at line 88 of file LList.C.

Referenced by LList< Foam::chemPointISAT< CompType, ThermoType > *>::readList().

Here is the caller graph for this function:

◆ pop_front()

void pop_front ( label  n = 1)

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

Definition at line 71 of file LList.C.

◆ removeHead()

T removeHead ( )
inline

Remove and return first entry.

Definition at line 329 of file LList.H.

Referenced by FIFOStack< writeData *>::pop(), LIFOStack< T >::pop(), CircularBuffer< T >::readList(), and UList< Foam::vector >::readList().

Here is the caller graph for this function:

◆ remove() [1/2]

T remove ( link item)
inline

Remove and return element.

Definition at line 337 of file LList.H.

◆ remove() [2/2]

T remove ( iterator iter)
inline

Remove and return element specified by iterator.

Definition at line 345 of file LList.H.

◆ transfer()

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.

◆ operator=() [1/3]

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

Copy assignment.

Definition at line 106 of file LList.C.

◆ operator=() [2/3]

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

Move assignment.

Definition at line 118 of file LList.C.

◆ operator=() [3/3]

void operator= ( std::initializer_list< T lst)

Copy assignment from an initializer list.

Definition at line 127 of file LList.C.

◆ readList()

Foam::Istream & readList ( Istream is)

Read list from Istream.

Definition at line 38 of file LListIO.C.

◆ writeList()

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 118 of file LListIO.C.

◆ begin() [1/2]

iterator begin ( )
inline

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

Definition at line 604 of file LList.H.

Referenced by FixedList< point, 2 >::FixedList(), and FixedList< point, 2 >::operator=().

Here is the caller graph for this function:

◆ cbegin()

const_iterator cbegin ( ) const
inline

Iterator to first item in list with const access.

Definition at line 612 of file LList.H.

Referenced by valueAverageBase::calc().

Here is the caller graph for this function:

◆ rbegin() [1/2]

reverse_iterator rbegin ( )
inline

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

Definition at line 620 of file LList.H.

◆ crbegin()

const_reverse_iterator crbegin ( ) const
inline

Iterator to last item in list with const access.

Definition at line 628 of file LList.H.

Referenced by LList< Foam::chemPointISAT< CompType, ThermoType > *>::rbegin().

Here is the caller graph for this function:

◆ begin() [2/2]

const_iterator begin ( ) const
inline

Iterator to first item in list with const access.

Definition at line 636 of file LList.H.

◆ rbegin() [2/2]

const_reverse_iterator rbegin ( ) const
inline

Iterator to last item in list with const access.

Definition at line 644 of file LList.H.

◆ end() [1/2]

const iterator& end ( )
inline

End of list for forward iterators.

Definition at line 653 of file LList.H.

Referenced by namesList< solutionEntry >::find().

Here is the caller graph for this function:

◆ cend()

const const_iterator& cend ( ) const
inline

End of list for forward iterators.

Definition at line 661 of file LList.H.

Referenced by LList< Foam::chemPointISAT< CompType, ThermoType > *>::end().

Here is the caller graph for this function:

◆ rend() [1/2]

const reverse_iterator& rend ( )
inline

End of list for reverse iterators.

Definition at line 669 of file LList.H.

◆ crend()

const const_reverse_iterator& crend ( ) const
inline

End of list for reverse iterators.

Definition at line 677 of file LList.H.

Referenced by LList< Foam::chemPointISAT< CompType, ThermoType > *>::rend().

Here is the caller graph for this function:

◆ end() [2/2]

const const_iterator& end ( ) const
inline

End of list for forward iterators.

Definition at line 685 of file LList.H.

◆ rend() [2/2]

const const_reverse_iterator& rend ( ) const
inline

End of list for reverse iterators.

Definition at line 693 of file LList.H.

◆ first() [1/2]

reference first ( )
inline

The first entry in the list.

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

Definition at line 706 of file LList.H.

◆ first() [2/2]

const_reference first ( ) const
inline

The first entry in the list (const access)

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

Definition at line 713 of file LList.H.

◆ last() [1/2]

reference last ( )
inline

The last entry in the list.

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

Definition at line 720 of file LList.H.

◆ last() [2/2]

const_reference last ( ) const
inline

The last entry in the list (const access)

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

Definition at line 727 of file LList.H.

◆ prepend() [1/2]

void prepend ( const T elem)
inline

Add copy at front of list.

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

Definition at line 734 of file LList.H.

◆ prepend() [2/2]

void prepend ( T &&  elem)
inline

Move construct at front of list.

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

Definition at line 741 of file LList.H.

◆ append() [1/2]

void append ( const T elem)
inline

Add copy at back of list.

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

Definition at line 748 of file LList.H.

Referenced by Foam::blockMeshTools::read().

Here is the caller graph for this function:

◆ append() [2/2]

void append ( T &&  elem)
inline

Move construct at back of list.

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

Definition at line 755 of file LList.H.

◆ insert() [1/2]

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 762 of file LList.H.

◆ insert() [2/2]

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 769 of file LList.H.

Friends And Related Function Documentation

◆ operator>>

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

Read list from Istream.

◆ operator

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: