safe_dslist< T > Class Template Reference

templated class for a double-ended singly-linked list that can be safely read from multiple threads without locking as long as writes are locked More...

List of all members.

Public Member Functions

DLLLOCAL void clear ()
 empties the list
DLLLOCAL iterator begin ()
 returns an iterator pointing to the first element of the list
DLLLOCAL iterator end ()
 returns an iterator pointing one element from the end of the list
DLLLOCAL const_iterator begin () const
 returns an iterator pointing to the first element of the list
DLLLOCAL const_iterator end () const
 returns an iterator pointing one element from the end of the list
DLLLOCAL iterator last ()
 returns an iterator pointing to the last element in the list
DLLLOCAL const_iterator last () const
 returns an iterator pointing to the last element in the list
DLLLOCAL iterator find (T data)
 returns an iterator either pointing to the element given if present in the list or pointing to one element from the end of the list if not
DLLLOCAL const_iterator find (T data) const
 returns an iterator either pointing to the element given if present in the list or pointing to one element from the end of the list if not
DLLLOCAL void push_front (T data)
 adds an element to the beginning of the list (constant time)
DLLLOCAL void push_back (T data)
 adds an element to the end of the list (constant time)
DLLLOCAL void populate (self_t &other)
 concatenates all elements of this list to the end of the list passed
DLLLOCAL void populate (self_t *other)
 concatenates all elements of this list to the end of the list passed
DLLLOCAL bool empty () const
 returns true if the list is empty
DLLLOCAL bool singular () const
 returns true if the list contains only one element (constant time)
DLLLOCAL bool plural () const
 returns true if the list contains more than one element (constant time)
DLLLOCAL void erase (iterator i)
 deletes the list element given by the iterator argument

Detailed Description

template<typename T>
class safe_dslist< T >

templated class for a double-ended singly-linked list that can be safely read from multiple threads without locking as long as writes are locked

Reading in multiple threads is safe as long as writes (appends at the end or beginning) are locked. Implements a singly-linked list with constant-time inserts at the beginning and end that can be read in a multi-threaded context without locking. Writes must be performed in a lock; however this class does not provide any locking; locking must be provided and performed externally to the class. Provides an STL-like interface.


Member Function Documentation

template<typename T>
DLLLOCAL void safe_dslist< T >::erase ( iterator  i  )  [inline]

deletes the list element given by the iterator argument

only constant time for the first element in the list, otherwise is O(n), linear with the length of the list


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

Generated on 14 Jun 2010 for Qore Programming Language by  doxygen 1.6.1