ucommon  7.0.0
About: GNU uCommon C++ is a portable and optimized class framework for writing C++ applications that need to use threads and support concurrent synchronization, and that use sockets, XML parsing, object serialization, thread-optimized string and data structure classes, etc..
  Fossies Dox: ucommon-7.0.0.tar.gz  ("unofficial" and yet experimental doxygen-generated source code documentation)  

Loading...
Searching...
No Matches
ucommon::OrderedIndex Class Reference

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

#include <linked.h>

Inheritance diagram for ucommon::OrderedIndex:
[legend]
Collaboration diagram for ucommon::OrderedIndex:
[legend]

Public Member Functions

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

Protected Attributes

OrderedObjecthead
 
OrderedObjecttail
 

Friends

class OrderedObject
 
class DLinkedObject
 
class NamedObject
 

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

Definition at line 176 of file linked.h.

Constructor & Destructor Documentation

◆ OrderedIndex() [1/2]

ucommon::OrderedIndex::OrderedIndex ( )

Create and initialize an empty index.

Definition at line 851 of file linked.cpp.

References head, and tail.

◆ OrderedIndex() [2/2]

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

Definition at line 193 of file linked.h.

References ucommon::copy().

Here is the call graph for this function:

◆ ~OrderedIndex()

ucommon::OrderedIndex::~OrderedIndex ( )
virtual

Destroy index.

Definition at line 856 of file linked.cpp.

References head, and tail.

Member Function Documentation

◆ add()

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

Add an object into the ordered index.

Parameters
orderedobject to add to the index.

Definition at line 874 of file linked.cpp.

◆ begin()

◆ copy()

void ucommon::OrderedIndex::copy ( const OrderedIndex source)

Definition at line 861 of file linked.cpp.

References head, and tail.

Referenced by ucommon::keyfile::assign(), and ucommon::Timer::Timer().

◆ count()

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

Count of objects this list manages.

Returns
number of objects in the list.

Definition at line 945 of file linked.cpp.

References count(), head, and ucommon::LinkedObject::Next.

Referenced by count(), find(), and index().

Here is the call graph for this function:

◆ 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.

Referenced by ucommon::keydata::end(), and ucommon::keyfile::end().

◆ find()

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

Find a specific member in the ordered list.

Parameters
offsetto member to find.

Definition at line 932 of file linked.cpp.

References count(), head, index(), and ucommon::LinkedObject::Next.

Here is the call graph for this function:

◆ 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.

Definition at line 881 of file linked.cpp.

References ucommon::LinkedObject::getNext(), head, and tail.

Referenced by ucommon::Timer::operator bool(), ucommon::Timer::operator!(), ucommon::Timer::operator!=(), ucommon::Timer::operator-(), ucommon::Timer::operator<(), ucommon::Timer::operator<=(), ucommon::Timer::operator==(), ucommon::Timer::operator>(), ucommon::Timer::operator>=(), and ucommon::TimerQueue::event::timeout().

Here is the call graph for this function:

◆ 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.

Referenced by ucommon::NamedTree::getIndexed(), and ucommon::treemap< T >::getIndexed().

◆ 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.

Definition at line 917 of file linked.cpp.

References count(), head, and ucommon::LinkedObject::Next.

Referenced by find().

Here is the call graph for this function:

◆ lock_index()

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

Used to synchronize lists managed by multiple threads.

A derived locking method would be invoked.

Definition at line 909 of file linked.cpp.

◆ 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.

Definition at line 867 of file linked.cpp.

◆ operator=()

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

Assign ordered index.

Parameters
objectto copy from.

Definition at line 294 of file linked.h.

References ucommon::copy().

Here is the call graph for this function:

◆ purge()

void ucommon::OrderedIndex::purge ( void  )

Purge the linked list and then set the index to empty.

Definition at line 896 of file linked.cpp.

References head, ucommon::LinkedObject::purge(), and tail.

Here is the call graph for this function:

◆ reset()

void ucommon::OrderedIndex::reset ( void  )

Reset linked list to empty without purging.

Definition at line 904 of file linked.cpp.

References head, and tail.

Referenced by ucommon::keyfile::assign(), and ucommon::keyfile::release().

◆ unlock_index()

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

Used to synchronize lists managed by multiple threads.

A derived unlocking method would be invoked.

Definition at line 913 of file linked.cpp.

Friends And Related Function 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.

Member Data Documentation

◆ head

◆ tail


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