Linked Object Lists

class LinkedObject
#include <LinkedObject.h>

Base virtual class to allow objects to be linked together.

This can be more efficient than defining a separate list, as each object requires only an additional pointer field for ‘next’.

Subclassed by LinkedObjectTemplate< ObjectType >, LinkedObjectTemplate< Answer >, LinkedObjectTemplate< Asset >, LinkedObjectTemplate< Device >, LinkedObjectTemplate< Element >, LinkedObjectTemplate< Handler >, LinkedObjectTemplate< HttpResourcePlugin >, LinkedObjectTemplate< Item >, LinkedObjectTemplate< Object >, LinkedObjectTemplate< PluginRef >, LinkedObjectTemplate< PriorityNode< ObjectType > >, LinkedObjectTemplate< Question >, LinkedObjectTemplate< Renderer >, LinkedObjectTemplate< Service >, LinkedObjectTemplate< StationInfo >

Public Functions

inline virtual ~LinkedObject()
inline virtual LinkedObject *next() const
inline LinkedObject *getNext() const
inline bool insertAfter(LinkedObject *object)
inline bool operator==(const LinkedObject &other) const
inline bool operator!=(const LinkedObject &other) const

Private Members

LinkedObject *mNext = {nullptr}


friend class LinkedObjectList
template<typename ObjectType>
class LinkedObjectTemplate : public LinkedObject
#include <LinkedObject.h>

Base class template for linked items with type casting.

Public Types

using Iterator = IteratorTemplate<ObjectType, ObjectType*, ObjectType&>
using ConstIterator = IteratorTemplate<const ObjectType, const ObjectType*, const ObjectType&>

Public Functions

inline ObjectType *getNext() const
inline bool insertAfter(ObjectType *object)
inline Iterator begin() const
inline Iterator end() const
inline Iterator cbegin() const
inline Iterator cend() const
template<typename T, typename TPtr, typename TRef>
class IteratorTemplate : public std::iterator<std::forward_iterator_tag, T>
#include <LinkedObject.h>

Public Functions

inline IteratorTemplate(TPtr x)
inline IteratorTemplate(TRef &x)
inline IteratorTemplate(const IteratorTemplate &other)
inline IteratorTemplate &operator++()
inline IteratorTemplate operator++(int)
inline bool operator==(const IteratorTemplate &rhs) const
inline bool operator!=(const IteratorTemplate &rhs) const
inline TRef operator*()
inline TPtr operator->()
inline operator TPtr()

Private Members

TPtr mObject
class LinkedObjectList
#include <LinkedObjectList.h>

Singly-linked list of objects.


We don’t own the items, just keep references to them

Subclassed by LinkedObjectListTemplate< ObjectType >, LinkedObjectListTemplate< Answer >, LinkedObjectListTemplate< Asset >, LinkedObjectListTemplate< Element >, LinkedObjectListTemplate< Handler >, LinkedObjectListTemplate< HttpResourcePlugin >, LinkedObjectListTemplate< Item >, LinkedObjectListTemplate< PluginRef >, LinkedObjectListTemplate< PriorityNode< ObjectType > >, LinkedObjectListTemplate< Question >, LinkedObjectListTemplate< Service >, LinkedObjectListTemplate< StationInfo >, LinkedObjectListTemplate< Surface >

Public Functions

inline LinkedObjectList()
inline LinkedObjectList(LinkedObject *object)
bool add(LinkedObject *object)
inline bool add(const LinkedObject *object)
inline bool insert(LinkedObject *object)
inline bool insert(const LinkedObject *object)
bool remove(LinkedObject *object)
inline LinkedObject *pop()
inline void clear()
inline LinkedObject *head()
inline const LinkedObject *head() const
inline bool isEmpty() const

Protected Attributes

LinkedObject *mHead = {nullptr}
template<typename ObjectType>
class LinkedObjectListTemplate : public LinkedObjectList
#include <LinkedObjectList.h>

Subclassed by OwnedLinkedObjectListTemplate< ObjectType >

Public Functions

LinkedObjectListTemplate() = default
inline LinkedObjectListTemplate(ObjectType *object)
inline ObjectType *head()
inline const ObjectType *head() const
inline ObjectType::Iterator begin()
inline ObjectType::Iterator end()
inline ObjectType::ConstIterator begin() const
inline ObjectType::ConstIterator end() const
inline bool add(ObjectType *object)
inline bool add(const ObjectType *object)
inline bool insert(ObjectType *object)
inline bool insert(const ObjectType *object)
inline ObjectType *pop()
inline size_t count() const
inline bool contains(const ObjectType &object) const
template<typename ObjectType>
class OwnedLinkedObjectListTemplate : public LinkedObjectListTemplate<ObjectType>
#include <LinkedObjectList.h>

Class template for singly-linked list of objects.


We own the objects so are responsible for destroying them when removed

Public Functions

OwnedLinkedObjectListTemplate() = default
OwnedLinkedObjectListTemplate(const OwnedLinkedObjectListTemplate &other) = delete
OwnedLinkedObjectListTemplate &operator=(const OwnedLinkedObjectListTemplate &other) = delete
inline ~OwnedLinkedObjectListTemplate()
inline bool remove(ObjectType *object)
inline void clear()