Base for singly-linked lists. More...
Classes | |
class | const_iterator |
A primitive const node iterator. More... | |
class | iterator |
A primitive non-const node iterator. More... | |
struct | link |
The structure for a singly-linked storage node. More... | |
Public Member Functions | |
SLListBase ()=default | |
Default construct. More... | |
SLListBase (const SLListBase &)=delete | |
No copy construct. More... | |
void | operator= (const SLListBase &)=delete |
No copy assignment. More... | |
~SLListBase ()=default | |
Destructor. More... | |
bool | empty () const noexcept |
True if the list is empty. More... | |
label | size () const noexcept |
The number of elements in list. More... | |
link * | front () |
Return first entry. More... | |
const link * | front () const |
Return const access to first entry. More... | |
link * | back () |
Return last entry. More... | |
const link * | back () const |
Return const access to last entry. More... | |
void | push_front (link *item) |
Add at front of list. More... | |
void | push_back (link *item) |
Add at back of list. More... | |
link * | removeHead () |
Remove and return first entry. More... | |
link * | remove (link *item) |
link * | remove (iterator &iter) |
void | clear () |
Clear the list. More... | |
void | swap (SLListBase &lst) |
Swap the contents of list. More... | |
void | transfer (SLListBase &lst) |
Transfer the contents of the argument into this list and annul the argument list. 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... | |
const_iterator | crbegin () const =delete |
No reverse iteration. More... | |
const iterator & | end () |
End of list for iterators. More... | |
const const_iterator & | cend () const |
End of list for iterators. More... | |
const const_iterator & | crend () const =delete |
No reverse iteration. More... | |
link * | first () |
Return first entry. More... | |
const link * | first () const |
Return const access to first entry. More... | |
link * | last () |
Return last entry. More... | |
const link * | last () const |
Return const access to last entry. More... | |
void | prepend (link *item) |
Add at front of list. More... | |
void | append (link *item) |
Add at back of list. More... | |
Protected Member Functions | |
template<class IteratorType > | |
IteratorType | iterator_first () const |
Return iterator to first item or end-iterator if list is empty. More... | |
template<class IteratorType > | |
IteratorType | iterator_last () const |
Return iterator to last item or end-iterator if list is empty. More... | |
Static Protected Member Functions | |
template<class IteratorType > | |
static const IteratorType & | iterator_end () |
Factory method to return an iterator end. More... | |
template<class IteratorType > | |
static const IteratorType & | iterator_rend ()=delete |
Factory method to return an iterator rend. More... | |
Friends | |
class | iterator |
class | const_iterator |
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).
Definition at line 57 of file SLListBase.H.
|
default |
Default construct.
|
delete |
No copy construct.
|
default |
Destructor.
|
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.
|
staticprotecteddelete |
Factory method to return an iterator rend.
Deleted for SLListBase
|
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.
|
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.
|
delete |
No copy assignment.
|
inlinenoexcept |
True if the list is empty.
Definition at line 175 of file SLListBase.H.
|
inlinenoexcept |
The number of elements in list.
Definition at line 180 of file SLListBase.H.
|
inline |
Return first entry.
Definition at line 67 of file SLListBaseI.H.
References Foam::abort(), Foam::FatalError, and FatalErrorInFunction.
Referenced by SLListBase::first().
|
inline |
Return const access to first entry.
Definition at line 80 of file SLListBaseI.H.
References Foam::abort(), Foam::FatalError, and FatalErrorInFunction.
|
inline |
Return last entry.
Definition at line 93 of file SLListBaseI.H.
References Foam::abort(), Foam::FatalError, and FatalErrorInFunction.
Referenced by SLListBase::last().
|
inline |
Return const access to last entry.
Definition at line 106 of file SLListBaseI.H.
References Foam::abort(), Foam::FatalError, and FatalErrorInFunction.
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 SLListBase::prepend().
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 SLListBase::append().
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_.
Foam::SLListBase::link * remove | ( | SLListBase::link * | item | ) |
Definition at line 99 of file SLListBase.C.
References stdFoam::begin(), SLListBase::link::deregister(), stdFoam::end(), SLListBase::iterator::get_node(), SLListBase::iterator::next(), SLListBase::link::next_, and p.
|
inline |
Definition at line 152 of file SLListBaseI.H.
|
inline |
Clear the list.
Definition at line 118 of file SLListBaseI.H.
Referenced by SLListBase::transfer().
|
inline |
Swap the contents of list.
Definition at line 125 of file SLListBaseI.H.
|
inline |
Transfer the contents of the argument into this list and annul the argument list.
Definition at line 137 of file SLListBaseI.H.
References SLListBase::clear().
|
inline |
Iterator to first item in list with non-const access.
Definition at line 230 of file SLListBaseI.H.
References stdFoam::end().
|
inline |
Iterator to first item in list with const access.
Definition at line 326 of file SLListBaseI.H.
References stdFoam::cend().
|
delete |
No reverse iteration.
|
inline |
End of list for iterators.
Definition at line 242 of file SLListBaseI.H.
|
inline |
End of list for iterators.
Definition at line 249 of file SLListBaseI.H.
|
delete |
No reverse iteration.
|
inline |
Return first entry.
FOAM_DEPRECATED_FOR(2022-10, "front()")
Definition at line 420 of file SLListBase.H.
References SLListBase::front().
|
inline |
Return const access to first entry.
FOAM_DEPRECATED_FOR(2022-10, "front()")
Definition at line 427 of file SLListBase.H.
References SLListBase::front().
|
inline |
Return last entry.
FOAM_DEPRECATED_FOR(2022-10, "back()")
Definition at line 434 of file SLListBase.H.
References SLListBase::back().
|
inline |
Return const access to last entry.
FOAM_DEPRECATED_FOR(2022-10, "back()")
Definition at line 441 of file SLListBase.H.
References SLListBase::back().
|
inline |
Add at front of list.
FOAM_DEPRECATED_FOR(2022-10, "push_front()")
Definition at line 448 of file SLListBase.H.
References SLListBase::push_front().
|
inline |
Add at back of list.
FOAM_DEPRECATED_FOR(2022-10, "push_back()")
Definition at line 455 of file SLListBase.H.
References SLListBase::push_back().
|
friend |
Definition at line 140 of file SLListBase.H.
|
friend |
Definition at line 143 of file SLListBase.H.