UCommon
Public Member Functions | Static Public Member Functions | Protected Member Functions | Protected Attributes | Friends
ucommon::LinkedObject Class Reference

Common base class for all objects that can be formed into a linked list. More...

#include <linked.h>

Inheritance diagram for ucommon::LinkedObject:
Inheritance graph
[legend]
Collaboration diagram for ucommon::LinkedObject:
Collaboration graph
[legend]

Public Member Functions

void delist (LinkedObject **root)
 Locate and remove ourselves from a list of objects. More...
 
void enlist (LinkedObject **root)
 Add our object to an existing linked list through a pointer. More...
 
LinkedObjectgetNext (void) const
 Get next effective object when iterating. More...
 
bool is_member (LinkedObject *list) const
 Search to see if we are a member of a specific list. More...
 
virtual void release (void)
 Release list, mark as no longer linked. More...
 
virtual void retain (void)
 Retain by marking as self referenced list. More...
 
- Public Member Functions inherited from ucommon::ObjectProtocol
ObjectProtocolcopy (void)
 Retain (increase retention of) object when copying.
 
void operator++ (void)
 Increase retention operator.
 
void operator-- (void)
 Decrease retention operator.
 
virtual ~ObjectProtocol ()
 Required virtual destructor.
 

Static Public Member Functions

static unsigned count (const LinkedObject *root)
 Count the number of linked objects in a list. More...
 
static LinkedObjectgetIndexed (LinkedObject *root, unsigned index)
 Get member by index. More...
 
static void purge (LinkedObject *root)
 Release all objects from a list. More...
 

Protected Member Functions

 LinkedObject (LinkedObject **root)
 Construct base class attached to a chain of objects. More...
 
 LinkedObject ()
 Construct base class unattached to anyone. More...
 
 LinkedObject (const LinkedObject &from)
 

Protected Attributes

LinkedObjectNext
 

Friends

class NamedObject
 
class OrderedIndex
 

Detailed Description

Common base class for all objects that can be formed into a linked list.

This base class is used directly for objects that can be formed into a single linked list. It is also used directly as a type for a pointer to the start of list of objects that are linked together as a list.

Author
David Sugar dyfet.nosp@m.@gnu.nosp@m.telep.nosp@m.hony.nosp@m..org

Definition at line 55 of file linked.h.

Constructor & Destructor Documentation

◆ LinkedObject() [1/2]

ucommon::LinkedObject::LinkedObject ( LinkedObject **  root)
protected

Construct base class attached to a chain of objects.

Parameters
rootpointer to chain of objects we are part of.

◆ LinkedObject() [2/2]

ucommon::LinkedObject::LinkedObject ( )
protected

Construct base class unattached to anyone.

This might be used to construct intermediary base classes that may form lists through indexing objects.

Member Function Documentation

◆ count()

static unsigned ucommon::LinkedObject::count ( const LinkedObject root)
static

Count the number of linked objects in a list.

Parameters
rootpointer to list we are counting.

◆ delist()

void ucommon::LinkedObject::delist ( LinkedObject **  root)

Locate and remove ourselves from a list of objects.

This searches the list to locate our object and if found relinks the list around us.

Parameters
rootpointer to list we are removing ourselves from.

◆ enlist()

void ucommon::LinkedObject::enlist ( LinkedObject **  root)

Add our object to an existing linked list through a pointer.

This forms a container sorted in lifo order since we become the head of the list, and the previous head becomes our next.

Parameters
rootpointer to list we are adding ourselves to.

◆ getIndexed()

static LinkedObject* ucommon::LinkedObject::getIndexed ( LinkedObject root,
unsigned  index 
)
static

Get member by index.

Returns
indexed member in linked list.
Parameters
rootpointer to list we are indexing.
indexmember to find.

◆ getNext()

LinkedObject* ucommon::LinkedObject::getNext ( void  ) const
inline

Get next effective object when iterating.

Returns
next linked object in list.

Definition at line 138 of file linked.h.

◆ is_member()

bool ucommon::LinkedObject::is_member ( LinkedObject list) const

Search to see if we are a member of a specific list.

Returns
true if we are member of the list.

◆ purge()

static void ucommon::LinkedObject::purge ( LinkedObject root)
static

Release all objects from a list.

Parameters
rootpointer to list we are purging.

◆ release()

virtual void ucommon::LinkedObject::release ( void  )
virtual

Release list, mark as no longer linked.

Inherited from base Object.

Implements ucommon::ObjectProtocol.

Reimplemented in ucommon::PagerObject, and ucommon::ReusableObject.

◆ retain()

virtual void ucommon::LinkedObject::retain ( void  )
virtual

Retain by marking as self referenced list.

Inherited from base Object.

Implements ucommon::ObjectProtocol.

Reimplemented in ucommon::PagerObject.


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