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..
![]() ![]() |
An index container for maintaining an ordered list of objects. More...
#include <linked.h>
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... | |
LinkedObject * | find (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... | |
LinkedObject * | get (void) |
Get (pull) object off the list. More... | |
void | add (OrderedObject *ordered) |
Add an object into the ordered index. More... | |
LinkedObject * | getIndexed (unsigned index) const |
Get an indexed member from the ordered index. More... | |
LinkedObject * | begin (void) const |
Return first object in list for iterators. More... | |
LinkedObject * | end (void) const |
Return last object in list for iterators. More... | |
LinkedObject * | operator* () const |
Return head object pointer. More... | |
OrderedIndex & | operator= (const OrderedIndex &object) |
Assign ordered index. More... | |
void | operator*= (OrderedObject *object) |
Add object to our list. More... | |
Protected Attributes | |
OrderedObject * | head |
OrderedObject * | tail |
Friends | |
class | OrderedObject |
class | DLinkedObject |
class | NamedObject |
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.
ucommon::OrderedIndex::OrderedIndex | ( | ) |
Create and initialize an empty index.
Definition at line 851 of file linked.cpp.
|
inline |
Definition at line 193 of file linked.h.
References ucommon::copy().
|
virtual |
void ucommon::OrderedIndex::add | ( | OrderedObject * | ordered | ) |
Add an object into the ordered index.
ordered | object to add to the index. |
Definition at line 874 of file linked.cpp.
|
inline |
Return first object in list for iterators.
Definition at line 270 of file linked.h.
Referenced by ucommon::keydata::begin(), ucommon::keyfile::begin(), ucommon::TimerQueue::expire(), ucommon::NamedTree::find(), ucommon::shell::getargv(), ucommon::NamedTree::getChild(), ucommon::NamedTree::getFirst(), ucommon::NamedTree::getLeaf(), ucommon::treemap< T >::is_attribute(), ucommon::NamedTree::is_leaf(), ucommon::NamedTree::leaf(), ucommon::linked_pointer< T >::linked_pointer(), ucommon::linked_pointer< T >::operator=(), ucommon::shell::parse(), and ucommon::NamedTree::purge().
void ucommon::OrderedIndex::copy | ( | const OrderedIndex & | source | ) |
Definition at line 861 of file linked.cpp.
Referenced by ucommon::keyfile::assign(), and ucommon::Timer::Timer().
unsigned ucommon::OrderedIndex::count | ( | void | ) | const |
Count of objects this list manages.
Definition at line 945 of file linked.cpp.
References count(), head, and ucommon::LinkedObject::Next.
Referenced by count(), find(), and index().
|
inline |
Return last object in list for iterators.
Definition at line 278 of file linked.h.
Referenced by ucommon::keydata::end(), and ucommon::keyfile::end().
LinkedObject * ucommon::OrderedIndex::find | ( | unsigned | offset | ) | const |
Find a specific member in the ordered list.
offset | to member to find. |
Definition at line 932 of file linked.cpp.
References count(), head, index(), and ucommon::LinkedObject::Next.
LinkedObject * ucommon::OrderedIndex::get | ( | void | ) |
Get (pull) object off the list.
The start of the list is advanced to the next object.
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().
|
inline |
Get an indexed member from the ordered index.
index | of member to fetch. |
Definition at line 262 of file linked.h.
Referenced by ucommon::NamedTree::getIndexed(), and ucommon::treemap< T >::getIndexed().
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.
Definition at line 917 of file linked.cpp.
References count(), head, and ucommon::LinkedObject::Next.
Referenced by find().
|
virtual |
Used to synchronize lists managed by multiple threads.
A derived locking method would be invoked.
Definition at line 909 of file linked.cpp.
|
inline |
void ucommon::OrderedIndex::operator*= | ( | OrderedObject * | object | ) |
|
inline |
Assign ordered index.
object | to copy from. |
Definition at line 294 of file linked.h.
References ucommon::copy().
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.
void ucommon::OrderedIndex::reset | ( | void | ) |
Reset linked list to empty without purging.
Definition at line 904 of file linked.cpp.
Referenced by ucommon::keyfile::assign(), and ucommon::keyfile::release().
|
virtual |
Used to synchronize lists managed by multiple threads.
A derived unlocking method would be invoked.
Definition at line 913 of file linked.cpp.
|
friend |
|
friend |
|
friend |
|
protected |
Definition at line 183 of file linked.h.
Referenced by copy(), count(), ucommon::OrderedObject::delist(), ucommon::DLinkedObject::delist(), ucommon::OrderedObject::enlistHead(), ucommon::DLinkedObject::enlistHead(), ucommon::OrderedObject::enlistTail(), ucommon::DLinkedObject::enlistTail(), find(), get(), index(), ucommon::DLinkedObject::insertHead(), ucommon::DLinkedObject::is_head(), ucommon::NamedObject::NamedObject(), OrderedIndex(), purge(), reset(), and ~OrderedIndex().
|
protected |
Definition at line 183 of file linked.h.
Referenced by copy(), ucommon::OrderedObject::delist(), ucommon::DLinkedObject::delist(), ucommon::OrderedObject::enlistHead(), ucommon::DLinkedObject::enlistHead(), ucommon::OrderedObject::enlistTail(), ucommon::DLinkedObject::enlistTail(), get(), ucommon::DLinkedObject::insertTail(), ucommon::DLinkedObject::is_tail(), ucommon::NamedObject::NamedObject(), OrderedIndex(), purge(), reset(), and ~OrderedIndex().