Loading...
Searching...
No Matches
SLListBase Class Reference

Base for singly-linked lists. More...

#include <SLListBase.H>

Inheritance diagram for SLListBase:

Classes

 The structure for a singly-linked storage node. More...
class  iterator
 A primitive non-const node iterator. More...
class  const_iterator
 A primitive const node iterator. More...

Public Member Functions

 SLListBase ()=default
 Default construct.
 SLListBase (const SLListBase &)=delete
 No copy construct.
void operator= (const SLListBase &)=delete
 No copy assignment.
 ~SLListBase ()=default
 Destructor.
bool empty () const noexcept
 True if the list is empty.
label size () const noexcept
 The number of elements in list.
linkfront ()
 Return first entry.
const linkfront () const
 Return const access to first entry.
linkback ()
 Return last entry.
const linkback () const
 Return const access to last entry.
void push_front (link *item)
 Add at front of list.
void push_back (link *item)
 Add at back of list.
linkremoveHead ()
 Remove and return first entry.
linkremove (link *item)
linkremove (iterator &iter)
void clear ()
 Clear the list.
void swap (SLListBase &lst)
 Swap the contents of list.
void transfer (SLListBase &lst)
 Transfer the contents of the argument into this list and annul the argument list.
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.
const_iterator crbegin () const =delete
 No reverse iteration.
const iteratorend ()
 End of list for iterators.
const const_iteratorcend () const
 End of list for iterators.
const const_iteratorcrend () const =delete
 No reverse iteration.
linkfirst ()
 Return first entry.
const linkfirst () const
 Return const access to first entry.
linklast ()
 Return last entry.
const linklast () const
 Return const access to last entry.
void prepend (link *item)
 Add at front of list.
void append (link *item)
 Add at back of list.

Protected Member Functions

template<class IteratorType>
IteratorType iterator_first () const
 Return iterator to first item or end-iterator if list is empty.
template<class IteratorType>
IteratorType iterator_last () const
 Return iterator to last item or end-iterator if list is empty.

Static Protected Member Functions

template<class IteratorType>
static const IteratorType & iterator_end ()
 Factory method to return an iterator end.
template<class IteratorType>
static const IteratorType & iterator_rend ()=delete
 Factory method to return an iterator rend.

Friends

class iterator
class const_iterator

Detailed Description

Base for singly-linked lists.

The iterators associated with the list only have a core functionality for navigation, with additional functionality to be added by inheriting classes. The node iterators always have a node-pointer as the first member data, which allows reinterpret_cast from anything else with a nullptr as its first data member. The nullObject is such an item (with a nullptr data member).

Source files

Definition at line 57 of file SLListBase.H.

Constructor & Destructor Documentation

◆ SLListBase() [1/2]

SLListBase ( )
default

◆ SLListBase() [2/2]

SLListBase ( const SLListBase & )
delete

No copy construct.

References SLListBase().

Here is the call graph for this function:

◆ ~SLListBase()

~SLListBase ( )
default

Destructor.

Member Function Documentation

◆ iterator_end()

template<class IteratorType>
const IteratorType & iterator_end ( )
inlinestaticprotected

Factory method to return an iterator end.

Simply reinterprets a NullObject as a SLListBase iterator.

Definition at line 28 of file SLListBaseI.H.

References Foam::nullObjectPtr.

Referenced by cend(), and end().

Here is the caller graph for this function:

◆ iterator_rend()

template<class IteratorType>
const IteratorType & iterator_rend ( )
staticprotecteddelete

Factory method to return an iterator rend.

Deleted for SLListBase

◆ iterator_first()

template<class IteratorType>
IteratorType iterator_first ( ) const
inlineprotected

Return iterator to first item or end-iterator if list is empty.

Removes constness which the caller promises to manage.

Definition at line 35 of file SLListBaseI.H.

References size(), and SLListBase().

Referenced by begin(), and cbegin().

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

◆ iterator_last()

template<class IteratorType>
IteratorType iterator_last ( ) const
inlineprotected

Return iterator to last item or end-iterator if list is empty.

Removes constness which the caller promises to manage.

Definition at line 50 of file SLListBaseI.H.

References size(), and SLListBase().

Here is the call graph for this function:

◆ operator=()

void operator= ( const SLListBase & )
delete

No copy assignment.

References SLListBase().

Here is the call graph for this function:

◆ empty()

bool empty ( ) const
inlinenoexcept

◆ size()

label size ( ) const
inlinenoexcept

The number of elements in list.

Definition at line 180 of file SLListBase.H.

References Foam::noexcept.

Referenced by begin(), valueAverageBase::calc(), cbegin(), namesList< solutionEntry >::findNames(), iterator_first(), and iterator_last().

Here is the caller graph for this function:

◆ front() [1/2]

Foam::SLListBase::link * front ( )
inline

Return first entry.

Definition at line 67 of file SLListBaseI.H.

References Foam::abort(), Foam::FatalError, FatalErrorInFunction, and SLListBase::link::next_.

Referenced by first(), and first().

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

◆ front() [2/2]

const Foam::SLListBase::link * front ( ) const
inline

Return const access to first entry.

Definition at line 80 of file SLListBaseI.H.

References Foam::abort(), Foam::FatalError, FatalErrorInFunction, and SLListBase::link::next_.

Here is the call graph for this function:

◆ back() [1/2]

Foam::SLListBase::link * back ( )
inline

Return last entry.

Definition at line 93 of file SLListBaseI.H.

References Foam::abort(), Foam::FatalError, and FatalErrorInFunction.

Referenced by last(), and last().

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

◆ back() [2/2]

const Foam::SLListBase::link * back ( ) const
inline

Return const access to last entry.

Definition at line 106 of file SLListBaseI.H.

References Foam::abort(), Foam::FatalError, and FatalErrorInFunction.

Here is the call graph for this function:

◆ push_front()

void push_front ( SLListBase::link * item)

Add at front of list.

Definition at line 27 of file SLListBase.C.

References SLListBase::link::next_.

Referenced by prepend().

Here is the caller graph for this function:

◆ push_back()

void push_back ( SLListBase::link * item)

Add at back of list.

Definition at line 49 of file SLListBase.C.

References SLListBase::link::next_.

Referenced by append().

Here is the caller graph for this function:

◆ removeHead()

Foam::SLListBase::link * removeHead ( )

Remove and return first entry.

Definition at line 70 of file SLListBase.C.

References Foam::abort(), SLListBase::link::deregister(), Foam::FatalError, FatalErrorInFunction, and SLListBase::link::next_.

Referenced by remove().

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

◆ remove() [1/2]

Definition at line 99 of file SLListBase.C.

References begin(), SLListBase::link::deregister(), end(), SLListBase::iterator::get_node(), SLListBase::iterator::next(), SLListBase::link::next_, p, and removeHead().

Referenced by remove().

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

◆ remove() [2/2]

Foam::SLListBase::link * remove ( SLListBase::iterator & iter)
inline

Definition at line 151 of file SLListBaseI.H.

References remove().

Here is the call graph for this function:

◆ clear()

void clear ( )
inline

Clear the list.

Definition at line 118 of file SLListBaseI.H.

Referenced by transfer().

Here is the caller graph for this function:

◆ swap()

void swap ( SLListBase & lst)
inline

Swap the contents of list.

Definition at line 125 of file SLListBaseI.H.

References SLListBase().

Here is the call graph for this function:

◆ transfer()

void transfer ( SLListBase & lst)
inline

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

Definition at line 137 of file SLListBaseI.H.

References clear(), and SLListBase().

Here is the call graph for this function:

◆ begin()

Foam::SLListBase::iterator begin ( )
inline

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

Definition at line 230 of file SLListBaseI.H.

References end(), iterator_first(), and size().

Referenced by SLListBase::const_iterator::operator=(), and remove().

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

◆ cbegin()

Foam::SLListBase::const_iterator cbegin ( ) const
inline

Iterator to first item in list with const access.

Definition at line 326 of file SLListBaseI.H.

References cend(), iterator_first(), and size().

Referenced by SLListBase::const_iterator::operator=().

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

◆ crbegin()

const_iterator crbegin ( ) const
delete

No reverse iteration.

References cend(), crbegin(), and end().

Referenced by crbegin().

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

◆ end()

const Foam::SLListBase::iterator & end ( )
inline

End of list for iterators.

Definition at line 242 of file SLListBaseI.H.

References iterator_end().

Referenced by begin(), crbegin(), and remove().

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

◆ cend()

const Foam::SLListBase::const_iterator & cend ( ) const
inline

End of list for iterators.

Definition at line 249 of file SLListBaseI.H.

References iterator_end().

Referenced by cbegin(), and crbegin().

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

◆ crend()

const const_iterator & crend ( ) const
delete

No reverse iteration.

References crend().

Referenced by crend().

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

◆ first() [1/2]

link * first ( )
inline

Return first entry.

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

Definition at line 420 of file SLListBase.H.

References first(), and front().

Referenced by first().

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

◆ first() [2/2]

const link * first ( ) const
inline

Return const access to first entry.

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

Definition at line 427 of file SLListBase.H.

References front().

Here is the call graph for this function:

◆ last() [1/2]

link * last ( )
inline

Return last entry.

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

Definition at line 434 of file SLListBase.H.

References back().

Here is the call graph for this function:

◆ last() [2/2]

const link * last ( ) const
inline

Return const access to last entry.

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

Definition at line 441 of file SLListBase.H.

References back().

Here is the call graph for this function:

◆ prepend()

void prepend ( link * item)
inline

Add at front of list.

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

Definition at line 448 of file SLListBase.H.

References push_front().

Here is the call graph for this function:

◆ append()

void append ( link * item)
inline

Add at back of list.

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

Definition at line 455 of file SLListBase.H.

References push_back().

Here is the call graph for this function:

◆ iterator

friend class iterator
friend

Definition at line 141 of file SLListBase.H.

◆ const_iterator

friend class const_iterator
friend

Definition at line 144 of file SLListBase.H.


The documentation for this class was generated from the following files:
  • src/OpenFOAM/containers/LinkedLists/linkTypes/SLListBase/SLListBase.H
  • src/OpenFOAM/containers/LinkedLists/linkTypes/SLListBase/SLListBase.C
  • src/OpenFOAM/containers/LinkedLists/linkTypes/SLListBase/SLListBaseI.H