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

void clear ()
 empties the list
iterator begin ()
 returns an iterator pointing to the first element of the list
iterator end ()
 returns an iterator pointing one element from the end of the list
const_iterator begin () const
 returns an iterator pointing to the first element of the list
const_iterator end () const
 returns an iterator pointing one element from the end of the list
iterator last ()
 returns an iterator pointing to the last element in the list
const_iterator last () const
 returns an iterator pointing to the last element in the list
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
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
void push_front (T data)
 adds an element to the beginning of the list (constant time)
void push_back (T data)
 adds an element to the end of the list (constant time)
void populate (self_t &other)
 concatenates all elements of this list to the end of the list passed
void populate (self_t *other)
 concatenates all elements of this list to the end of the list passed
bool empty () const
 returns true if the list is empty
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>
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 Mon Oct 26 09:09:50 2009 for Qore Programming Language by  doxygen 1.5.6