#include <ace/Containers.h>
template<class T> class ACE_Double_Linked_List {
public:friend class ACE_Double_Linked_List_Iterator<T>;typedef ACE_Double_Linked_List_Iterator<T> ITERATOR;ACE_Double_Linked_List (ACE_Allocator *alloc = 0);ACE_Double_Linked_List (ACE_Double_Linked_List<T> &);void operator= (ACE_Double_Linked_List<T> &);~ACE_Double_Linked_List (void);int is_empty (void) const;int is_full (void) const;T *insert_tail (T *new_item);T *insert_head (T *new_item);T* delete_head (void);T *delete_tail (void);void reset (void);int get (T *&item, size_t index = 0);size_t size (void) const;void dump (void) const;int remove (T *n);ACE_ALLOC_HOOK_DECLARE;protected:void delete_nodes (void);void copy_nodes (ACE_Double_Linked_List<T> &);void init_head (void);int insert_element (T *new_item, int before = 0, T *old_item = 0);int remove_element (T *item);T *head_;size_t size_;ACE_Allocator *allocator_;};
ACE_Double_Linked_List (ACE_Allocator *alloc = 0);
ACE_Double_Linked_List (ACE_Double_Linked_List<T> &);
void operator= (ACE_Double_Linked_List<T> &);
~ACE_Double_Linked_List (void);
int is_empty (void) const;
int is_full (void) const;
T *insert_tail (T *new_item);
new_item to the tail of the list. Returns the new item
that was inserted.
T *insert_head (T *new_item);
new_item to the head of the list.Returns the new item that
was inserted.
T* delete_head (void);
item in the list. Returns
internal node's address on success, 0 if the queue was empty.
This method will *not* free the internal node.
T *delete_tail (void);
item in the list. Returns
internal nodes's address on success, 0 if the queue was
empty. This method will *not* free the internal node.
void reset (void);
ACE_Double_Linked_List to be empty.
Notice that since no one is interested in the items within,
This operation will delete all items.
int get (T *&item, size_t index = 0);
indexth element in the set. Returns -1 if the element
isn't in the range 0..size() - 1, else 0.
size_t size (void) const;
void dump (void) const;
int remove (T *n);
ACE_ALLOC_HOOK_DECLARE;