Open Model Railroad Network (OpenMRN)
Loading...
Searching...
No Matches
LinkedObject< T > Class Template Reference

Using this class as a base class will cause the given class to have all its instances linked up in a list. More...

#include <LinkedObject.hxx>

Public Member Functions

T * link_next ()
 

Static Public Member Functions

static T * link_head ()
 
static Atomichead_mu ()
 Locks the list for modification (at any entry!).
 

Protected Member Functions

T * link_this ()
 
 LinkedObject ()
 Constructor. Puts *this on the linked list.
 
 ~LinkedObject ()
 Constructor. Removes *this from the linked list.
 

Protected Attributes

T * link_
 Linked list pointer.
 

Static Protected Attributes

static T * head_ {nullptr}
 Beginning of the list.
 

Detailed Description

template<class T>
class LinkedObject< T >

Using this class as a base class will cause the given class to have all its instances linked up in a list.

The cost is 4 bytes per object, and some CPU cost in the destructor (to walk the list).

Definition at line 83 of file LinkedObject.hxx.

Constructor & Destructor Documentation

◆ LinkedObject()

template<class T >
LinkedObject< T >::LinkedObject ( )
inlineprotected

Constructor. Puts *this on the linked list.

Definition at line 112 of file LinkedObject.hxx.

◆ ~LinkedObject()

template<class T >
LinkedObject< T >::~LinkedObject ( )
inlineprotected

Constructor. Removes *this from the linked list.

Definition at line 120 of file LinkedObject.hxx.

Member Function Documentation

◆ head_mu()

template<class T >
static Atomic * LinkedObject< T >::head_mu ( )
inlinestatic

Locks the list for modification (at any entry!).

Definition at line 100 of file LinkedObject.hxx.

◆ link_head()

template<class T >
static T * LinkedObject< T >::link_head ( )
inlinestatic
Returns
the subclass pointer of the beginning of the list.

Definition at line 94 of file LinkedObject.hxx.

◆ link_next()

template<class T >
T * LinkedObject< T >::link_next ( )
inline
Returns
the subclass pointer next on the list (or nullptr if we're at the end of the list).

Definition at line 88 of file LinkedObject.hxx.

◆ link_this()

template<class T >
T * LinkedObject< T >::link_this ( )
inlineprotected
Returns
the current subclass pointer.

Definition at line 106 of file LinkedObject.hxx.

Member Data Documentation

◆ head_

template<class T >
T * LinkedObject< T >::head_ {nullptr}
staticprotected

Beginning of the list.

Definition at line 141 of file LinkedObject.hxx.

◆ link_

template<class T >
T* LinkedObject< T >::link_
protected

Linked list pointer.

Definition at line 139 of file LinkedObject.hxx.


The documentation for this class was generated from the following file: