Base for doubly-linked lists. More...
Classes | |
class | const_iterator |
A primitive const node iterator (bidirectional). More... | |
class | iterator |
A primitive non-const node iterator. More... | |
struct | link |
The structure for a doubly-linked storage node. More... | |
Public Member Functions | |
DLListBase ()=default | |
Default construct. More... | |
DLListBase (const DLListBase &)=delete | |
No copy construct. More... | |
void | operator= (const DLListBase &)=delete |
No copy assignment. More... | |
~DLListBase ()=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... | |
bool | swapUp (link *item) |
Swap this element with the one above unless it is at the top. More... | |
bool | swapDown (link *item) |
Swap this element with the one below unless it is at the bottom. More... | |
link * | removeHead () |
Remove and return first entry. More... | |
link * | remove (link *item) |
Remove and return element. More... | |
link * | remove (iterator &iter) |
Remove and return element specified by iterator. More... | |
link * | replace (link *oldLink, link *newLink) |
Replace oldLink with newLink and return element. More... | |
link * | replace (iterator &oldIter, link *newitem) |
Replace oldIter with newItem and return element. More... | |
void | clear () |
Clear the list. More... | |
void | swap (DLListBase &lst) |
Swap the contents of the list. More... | |
void | transfer (DLListBase &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 |
Iterator to last item in list with const access. 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 |
End of list for reverse iterators. 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 () |
Factory method to return an iterator reverse end. More... | |
Friends | |
class | iterator |
class | const_iterator |
Base for doubly-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 DLListBase.H.
|
default |
Default construct.
|
delete |
No copy construct.
|
default |
Destructor.
|
inlinestaticprotected |
Factory method to return an iterator end.
Simply reinterprets a NullObject as a DLListBase iterator.
Definition at line 28 of file DLListBaseI.H.
References Foam::nullObjectPtr.
|
inlinestaticprotected |
Factory method to return an iterator reverse end.
Simply reinterprets a NullObject as a DLListBase iterator.
Definition at line 35 of file DLListBaseI.H.
References Foam::nullObjectPtr.
|
inlineprotected |
Return iterator to first item or end-iterator if list is empty.
Removes constness which the caller promises to manage.
Definition at line 42 of file DLListBaseI.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 57 of file DLListBaseI.H.
|
delete |
No copy assignment.
|
inlinenoexcept |
True if the list is empty.
Definition at line 189 of file DLListBase.H.
|
inlinenoexcept |
The number of elements in list.
Definition at line 194 of file DLListBase.H.
|
inline |
Return first entry.
Definition at line 96 of file DLListBaseI.H.
References Foam::abort(), Foam::FatalError, and FatalErrorInFunction.
Referenced by DLListBase::first().
|
inline |
Return const access to first entry.
Definition at line 109 of file DLListBaseI.H.
References Foam::abort(), Foam::FatalError, and FatalErrorInFunction.
|
inline |
Return last entry.
Definition at line 122 of file DLListBaseI.H.
References Foam::abort(), Foam::FatalError, and FatalErrorInFunction.
Referenced by DLListBase::last().
|
inline |
Return const access to last entry.
Definition at line 135 of file DLListBaseI.H.
References Foam::abort(), Foam::FatalError, and FatalErrorInFunction.
void push_front | ( | DLListBase::link * | item | ) |
Add at front of list.
Definition at line 27 of file DLListBase.C.
References DLListBase::link::next_, and DLListBase::link::prev_.
Referenced by DLListBase::prepend().
void push_back | ( | DLListBase::link * | item | ) |
Add at back of list.
Definition at line 52 of file DLListBase.C.
References DLListBase::link::next_, and DLListBase::link::prev_.
Referenced by DLListBase::append().
bool swapUp | ( | DLListBase::link * | a | ) |
Swap this element with the one above unless it is at the top.
Definition at line 77 of file DLListBase.C.
References DLListBase::link::next_, and DLListBase::link::prev_.
bool swapDown | ( | DLListBase::link * | a | ) |
Swap this element with the one below unless it is at the bottom.
Definition at line 116 of file DLListBase.C.
References DLListBase::link::next_, and DLListBase::link::prev_.
Foam::DLListBase::link * removeHead | ( | ) |
Remove and return first entry.
Definition at line 155 of file DLListBase.C.
References Foam::abort(), DLListBase::link::deregister(), Foam::FatalError, FatalErrorInFunction, and DLListBase::link::next_.
Foam::DLListBase::link * remove | ( | DLListBase::link * | item | ) |
Remove and return element.
Definition at line 181 of file DLListBase.C.
References DLListBase::link::deregister(), DLListBase::link::next_, and DLListBase::link::prev_.
|
inline |
Remove and return element specified by iterator.
Definition at line 185 of file DLListBaseI.H.
Foam::DLListBase::link * replace | ( | DLListBase::link * | oldLink, |
DLListBase::link * | newLink | ||
) |
Replace oldLink with newLink and return element.
Definition at line 214 of file DLListBase.C.
References DLListBase::link::deregister(), DLListBase::link::next_, and DLListBase::link::prev_.
|
inline |
Replace oldIter with newItem and return element.
Definition at line 195 of file DLListBaseI.H.
|
inline |
Clear the list.
Definition at line 147 of file DLListBaseI.H.
Referenced by DLListBase::transfer().
|
inline |
Swap the contents of the list.
Definition at line 155 of file DLListBaseI.H.
|
inline |
Transfer the contents of the argument into this list and annul the argument list.
Definition at line 168 of file DLListBaseI.H.
References DLListBase::clear().
|
inline |
Iterator to first item in list with non-const access.
Definition at line 295 of file DLListBaseI.H.
References stdFoam::end().
|
inline |
Iterator to first item in list with const access.
Definition at line 393 of file DLListBaseI.H.
References stdFoam::cend().
|
inline |
Iterator to last item in list with const access.
Note that this is not a const_reverse_iterator, this is the responsibility of any derived classes.
Definition at line 405 of file DLListBaseI.H.
References stdFoam::crend().
|
inline |
End of list for iterators.
Definition at line 73 of file DLListBaseI.H.
|
inline |
End of list for iterators.
Definition at line 80 of file DLListBaseI.H.
|
inline |
End of list for reverse iterators.
Definition at line 87 of file DLListBaseI.H.
|
inline |
Return first entry.
FOAM_DEPRECATED_FOR(2022-10, "front()")
Definition at line 460 of file DLListBase.H.
References DLListBase::front().
|
inline |
Return const access to first entry.
FOAM_DEPRECATED_FOR(2022-10, "front()")
Definition at line 467 of file DLListBase.H.
References DLListBase::front().
|
inline |
Return last entry.
FOAM_DEPRECATED_FOR(2022-10, "back()")
Definition at line 474 of file DLListBase.H.
References DLListBase::back().
|
inline |
Return const access to last entry.
FOAM_DEPRECATED_FOR(2022-10, "back()")
Definition at line 481 of file DLListBase.H.
References DLListBase::back().
|
inline |
Add at front of list.
FOAM_DEPRECATED_FOR(2022-10, "push_front()")
Definition at line 488 of file DLListBase.H.
References DLListBase::push_front().
|
inline |
Add at back of list.
FOAM_DEPRECATED_FOR(2022-10, "push_back()")
Definition at line 495 of file DLListBase.H.
References DLListBase::push_back().
|
friend |
Definition at line 154 of file DLListBase.H.
|
friend |
Definition at line 157 of file DLListBase.H.
Copyright © 2011-2018 OpenFOAM | OPENFOAM® is a registered trademark of OpenCFD Ltd.