#include <ace/Containers.h>
template<class T> class ACE_Unbounded_Queue {
public:
friend class ACE_Unbounded_Queue_Iterator<T>;
typedef ACE_Unbounded_Queue_Iterator<T> ITERATOR;
ACE_Unbounded_Queue (ACE_Allocator *alloc = 0);
ACE_Unbounded_Queue (const ACE_Unbounded_Queue<T> &);
void operator= (const ACE_Unbounded_Queue<T> &);
~ACE_Unbounded_Queue (void);
int is_empty (void) const;
int is_full (void) const;
int enqueue_tail (const T &new_item);
int enqueue_head (const T &new_item);
int dequeue_head (T &item);
void reset (void);
int get (T *&item, size_t slot = 0) const;
int set (const T &item, size_t slot);
size_t size (void) const;
void dump (void) const;
ACE_Unbounded_Queue_Iterator<T> begin (void);
ACE_Unbounded_Queue_Iterator<T> end (void);
ACE_ALLOC_HOOK_DECLARE;
protected:
void delete_nodes (void);
void copy_nodes (const ACE_Unbounded_Queue<T> &);
ACE_Node<T> *head_;
size_t cur_size_;
ACE_Allocator *allocator_;
};
ACE_Unbounded_Queue (ACE_Allocator *alloc = 0);
ACE_Unbounded_Queue (const ACE_Unbounded_Queue<T> &);
void operator= (const ACE_Unbounded_Queue<T> &);
~ACE_Unbounded_Queue (void);
int is_empty (void) const;
int is_full (void) const;
int enqueue_tail (const T &new_item);
new_item
to the tail of the queue. Returns 0 on success,
-1 on failure.
int enqueue_head (const T &new_item);
new_item
to the head of the queue. Returns 0 on success,
-1 on failure.
int dequeue_head (T &item);
item
on the queue. Returns 0 on
success, -1 if the queue was empty.
void reset (void);
ACE_Unbounded_Queue
to be empty and release all its
dynamically allocated resources.
int get (T *&item, size_t slot = 0) const;
slot
th element in the set. Returns -1 if the element
isn't in the range {0..size
- 1}, else 0.
int set (const T &item, size_t slot);
slot
th element in the set. Will pad out the set with
empty nodes if slot
is beyond the range {0..size
- 1}.
Returns -1 on failure, 0 if slot
isn't initially in range, and
0 otherwise.
size_t size (void) const;
void dump (void) const;
ACE_Unbounded_Queue_Iterator<T> begin (void);
ACE_Unbounded_Queue_Iterator<T> end (void);
ACE_ALLOC_HOOK_DECLARE;