UCommon
ucommon::OrderedIndex Class Reference

An index container for maintaining an ordered list of objects. More...

#include <linked.h>

Inheritance diagram for ucommon::OrderedIndex:
Collaboration diagram for ucommon::OrderedIndex:

Public Member Functions

void add (OrderedObject *ordered)
 Add an object into the ordered index.
 
LinkedObjectbegin (void) const
 Return first object in list for iterators.
 
void copy (const OrderedIndex &source)
 
unsigned count (void) const
 Count of objects this list manages.
 
LinkedObjectend (void) const
 Return last object in list for iterators.
 
LinkedObjectfind (unsigned offset) const
 Find a specific member in the ordered list.
 
LinkedObjectget (void)
 Get (pull) object off the list.
 
LinkedObjectgetIndexed (unsigned index) const
 Get an indexed member from the ordered index.
 
LinkedObject ** index (void) const
 Return a pointer to the head of the list.
 
virtual void lock_index (void)
 Used to synchronize lists managed by multiple threads.
 
LinkedObjectoperator* () const
 Return head object pointer.
 
void operator*= (OrderedObject *object)
 Add object to our list.
 
OrderedIndexoperator= (const OrderedIndex &object)
 Assign ordered index.
 
 OrderedIndex ()
 Create and initialize an empty index.
 
 OrderedIndex (const OrderedIndex &source)
 
void purge (void)
 Purge the linked list and then set the index to empty.
 
void reset (void)
 Reset linked list to empty without purging.
 
virtual void unlock_index (void)
 Used to synchronize lists managed by multiple threads.
 
virtual ~OrderedIndex ()
 Destroy index.
 

Protected Attributes

OrderedObjecthead
 
OrderedObjecttail
 

Friends

class DLinkedObject
 
class NamedObject
 
class OrderedObject
 

Detailed Description

An index container for maintaining an ordered list of objects.

This index holds a pointer to the head and tail of an ordered list of linked objects. Fundamental methods for supporting iterators are also provided.

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

Definition at line 176 of file linked.h.

Constructor & Destructor Documentation

◆ OrderedIndex()

ucommon::OrderedIndex::OrderedIndex ( const OrderedIndex & source)
inline

Definition at line 193 of file linked.h.

Member Function Documentation

◆ add()

void ucommon::OrderedIndex::add ( OrderedObject * ordered)

Add an object into the ordered index.

Parameters
orderedobject to add to the index.

◆ begin()

LinkedObject * ucommon::OrderedIndex::begin ( void ) const
inline

Return first object in list for iterators.

Returns
first object in list.

Definition at line 270 of file linked.h.

◆ count()

unsigned ucommon::OrderedIndex::count ( void ) const

Count of objects this list manages.

Returns
number of objects in the list.

◆ end()

LinkedObject * ucommon::OrderedIndex::end ( void ) const
inline

Return last object in list for iterators.

Returns
last object in list.

Definition at line 278 of file linked.h.

◆ find()

LinkedObject * ucommon::OrderedIndex::find ( unsigned offset) const

Find a specific member in the ordered list.

Parameters
offsetto member to find.

◆ get()

LinkedObject * ucommon::OrderedIndex::get ( void )

Get (pull) object off the list.

The start of the list is advanced to the next object.

Returns
LinkedObject based object that was head of the list.

◆ getIndexed()

LinkedObject * ucommon::OrderedIndex::getIndexed ( unsigned index) const
inline

Get an indexed member from the ordered index.

Parameters
indexof member to fetch.
Returns
LinkedObject member of index.

Definition at line 262 of file linked.h.

◆ index()

LinkedObject ** ucommon::OrderedIndex::index ( void ) const

Return a pointer to the head of the list.

This allows the head pointer to be used like a simple root list pointer for pure LinkedObject based objects.

Returns
LinkedIndex style object.

◆ lock_index()

virtual void ucommon::OrderedIndex::lock_index ( void )
virtual

Used to synchronize lists managed by multiple threads.

A derived locking method would be invoked.

◆ operator*()

LinkedObject * ucommon::OrderedIndex::operator* ( ) const
inline

Return head object pointer.

Returns
head pointer.

Definition at line 286 of file linked.h.

◆ operator*=()

void ucommon::OrderedIndex::operator*= ( OrderedObject * object)

Add object to our list.

Parameters
objectto add.

◆ operator=()

OrderedIndex & ucommon::OrderedIndex::operator= ( const OrderedIndex & object)
inline

Assign ordered index.

Parameters
objectto copy from.

Definition at line 294 of file linked.h.

Here is the call graph for this function:

◆ unlock_index()

virtual void ucommon::OrderedIndex::unlock_index ( void )
virtual

Used to synchronize lists managed by multiple threads.

A derived unlocking method would be invoked.

Friends And Related Symbol Documentation

◆ DLinkedObject

friend class DLinkedObject
friend

Definition at line 180 of file linked.h.

◆ NamedObject

friend class NamedObject
friend

Definition at line 181 of file linked.h.

◆ OrderedObject

friend class OrderedObject
friend

Definition at line 179 of file linked.h.

Field Documentation

◆ head

OrderedObject* ucommon::OrderedIndex::head
protected

Definition at line 183 of file linked.h.

◆ tail

OrderedObject * ucommon::OrderedIndex::tail
protected

Definition at line 183 of file linked.h.


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