semf
semf::LinkedList< T >::Node Class Reference

Implements the previous() and next() functionality for every element in a list. More...

#include <linkedlist.h>

Inheritance diagram for semf::LinkedList< T >::Node:
Inheritance graph
Collaboration diagram for semf::LinkedList< T >::Node:
Collaboration graph

Public Member Functions

virtual ~Node ()=default
 
T * next () const
 Returns a pointer to the next element in a list. More...
 
void setNext (T *next)
 Sets a pointer to the next element in a list. More...
 
T * previous () const
 Returns a pointer to the previous element in a list. More...
 
void setPrevious (T *previous)
 Sets a pointer to the previous element in a list. More...
 
bool isInAList ()
 Returns if a node is part of a LinkedList. More...
 

Detailed Description

template<class T>
class semf::LinkedList< T >::Node

Implements the previous() and next() functionality for every element in a list.

A class type using LinkedList has to inherit from this class.

Definition at line 51 of file linkedlist.h.

Constructor & Destructor Documentation

◆ ~Node()

template<class T >
virtual semf::LinkedList< T >::Node::~Node ( )
virtualdefault

Member Function Documentation

◆ isInAList()

template<class T >
bool semf::LinkedList< T >::Node::isInAList ( )
inline

Returns if a node is part of a LinkedList.

Note
This is done by checking if the pointer to the previous and next element is nullptr.
Returns
false for is not in a LinkedList, otherwise true.

Definition at line 97 of file linkedlist.h.

◆ next()

template<class T >
T * semf::LinkedList< T >::Node::next ( ) const
inline

Returns a pointer to the next element in a list.

Attention
The last element in a list will return nullptr.
Returns
The next element in a list.

Definition at line 61 of file linkedlist.h.

Here is the caller graph for this function:

◆ previous()

template<class T >
T * semf::LinkedList< T >::Node::previous ( ) const
inline

Returns a pointer to the previous element in a list.

Attention
The first element in a list will return nullptr.
Returns
The previous element in a list.

Definition at line 79 of file linkedlist.h.

Here is the caller graph for this function:

◆ setNext()

template<class T >
void semf::LinkedList< T >::Node::setNext ( T *  next)
inline

Sets a pointer to the next element in a list.

Attention
Do not use outside LinkedList. That leads to undefined behavior.
Parameters
nextThe next element in a list.

Definition at line 70 of file linkedlist.h.

Here is the call graph for this function:

◆ setPrevious()

template<class T >
void semf::LinkedList< T >::Node::setPrevious ( T *  previous)
inline

Sets a pointer to the previous element in a list.

Attention
Do not use outside LinkedList. That leads to undefined behavior.
Parameters
previousThe previous element in a list.

Definition at line 88 of file linkedlist.h.

Here is the call graph for this function: