ucc::LinkedObject Class Reference

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

#include <linked.h>

Inheritance diagram for ucc::LinkedObject:

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

Collaboration graph
[legend]

Public Member Functions

virtual void release (void)
 Release list, mark as no longer linked.
virtual void retain (void)
 Retain by marking as self referenced list.
void enlist (LinkedObject **root)
 Add our object to an existing linked list through a pointer.
void delist (LinkedObject **root)
 Locate and remove ourselves from a list of objects.
bool isMember (LinkedObject *list) const
 Search to see if we are a member of a specific list.
LinkedObject * getNext (void) const
 Get next effective object when iterating.

Static Public Member Functions

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

Static Public Attributes

static const LinkedObject * nil
 Marker for end of linked list.
static const LinkedObject * inv
 Marker for invalid list pointer.

Protected Member Functions

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

Protected Attributes

LinkedObject * next

Friends

class OrderedIndex
class LinkedRing
class NamedObject

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@gnutelephony.org>

Definition at line 45 of file linked.h.


Constructor & Destructor Documentation

ucc::LinkedObject::LinkedObject ( LinkedObject **  root  )  [protected]

Construct base class attached to a chain of objects.

Parameters:
root pointer to chain of objects we are part of.

ucc::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

static unsigned ucc::LinkedObject::count ( LinkedObject *  root  )  [static]

Count the number of linked objects in a list.

Parameters:
root pointer to list we are counting.

void ucc::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:
root pointer to list we are removing ourselves from.

void ucc::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:
root pointer to list we are adding ourselves to.

static LinkedObject* ucc::LinkedObject::getIndexed ( LinkedObject *  root,
unsigned  index 
) [static]

Get member by index.

Returns:
indexed member in linked list.
Parameters:
root pionter to list we are indexing.
index member to find.

LinkedObject* ucc::LinkedObject::getNext ( void   )  const [inline]

Get next effective object when iterating.

Returns:
next linked object in list.

Reimplemented in ucc::OrderedObject, ucc::NamedObject, and ucc::LinkedList.

Definition at line 129 of file linked.h.

bool ucc::LinkedObject::isMember ( LinkedObject *  list  )  const

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

Returns:
true if we are member of the list.

static void ucc::LinkedObject::purge ( LinkedObject *  root  )  [static]

Release all objects from a list.

Parameters:
root pointer to list we are purging.

virtual void ucc::LinkedObject::release ( void   )  [virtual]

Release list, mark as no longer linked.

Inherited from base Object.

Reimplemented from ucc::Object.

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

virtual void ucc::LinkedObject::retain ( void   )  [virtual]

Retain by marking as self referenced list.

Inherited from base Object.

Reimplemented from ucc::Object.


Field Documentation

Marker for end of linked list.

Definition at line 68 of file linked.h.


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

Generated on Mon Jul 27 21:11:22 2009 for UCommon by  doxygen 1.5.9