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< Request >, LinkedObjectTemplate< Item >, LinkedObjectTemplate< HttpResourcePlugin >, LinkedObjectTemplate< StationInfo >, LinkedObjectTemplate< Element >, LinkedObjectTemplate< PluginRef >, LinkedObjectTemplate< Object >, LinkedObjectTemplate< Asset >, LinkedObjectTemplate< Answer >, LinkedObjectTemplate< Controller >, LinkedObjectTemplate< Handler >, LinkedObjectTemplate< Question >, LinkedObjectTemplate< Service >, LinkedObjectTemplate< Device >, LinkedObjectTemplate< PriorityNode< ObjectType > >, LinkedObjectTemplate< Renderer >, LinkedObjectTemplate< ClassType >, LinkedObjectTemplate< Info >, LinkedObjectTemplate< ObjectType >

Public Functions

inline virtual ~LinkedObject()
inline virtual LinkedObject *next() 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}

Friends

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
#include <LinkedObject.h>

Public Types

using iterator_category = std::forward_iterator_tag
using value_type = T
using difference_type = std::ptrdiff_t
using pointer = T*
using reference = T&

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.

Note

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

Subclassed by LinkedObjectListTemplate< Controller >, LinkedObjectListTemplate< Handler >, LinkedObjectListTemplate< Service >, LinkedObjectListTemplate< Control >, LinkedObjectListTemplate< ObjectType >

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< Request >, OwnedLinkedObjectListTemplate< Item >, OwnedLinkedObjectListTemplate< HttpResourcePlugin >, OwnedLinkedObjectListTemplate< Surface >, OwnedLinkedObjectListTemplate< Element >, OwnedLinkedObjectListTemplate< StationInfo >, OwnedLinkedObjectListTemplate< PluginRef >, OwnedLinkedObjectListTemplate< Asset >, OwnedLinkedObjectListTemplate< Answer >, OwnedLinkedObjectListTemplate< Question >, OwnedLinkedObjectListTemplate< Device >, OwnedLinkedObjectListTemplate< PriorityNode< ObjectType > >, OwnedLinkedObjectListTemplate< ClassType >, OwnedLinkedObjectListTemplate< Info >, OwnedLinkedObjectListTemplate< ObjectType >

Public Types

using Iterator = typename LinkedObjectTemplate<ObjectType>::template IteratorTemplate<ObjectType, ObjectType*, ObjectType&>
using ConstIterator = typename LinkedObjectTemplate<ObjectType>::template IteratorTemplate<const ObjectType, const ObjectType*, const ObjectType&>

Public Functions

LinkedObjectListTemplate() = default
inline LinkedObjectListTemplate(ObjectType *object)
inline ObjectType *head()
inline const ObjectType *head() const
inline Iterator begin()
inline Iterator end()
inline ConstIterator begin() const
inline 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.

Note

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

Subclassed by Storage::Disk::BasePartitionTable

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()