/* -*- C++ -*- */ // $Id$ // Containers.i template ACE_INLINE int ACE_Bounded_Stack::is_empty (void) const { ACE_TRACE ("ACE_Bounded_Stack::is_empty"); return this->top_ == 0; } template ACE_INLINE int ACE_Bounded_Stack::is_full (void) const { ACE_TRACE ("ACE_Bounded_Stack::is_full"); return this->top_ >= this->size_; } template ACE_INLINE int ACE_Bounded_Stack::push (const T &new_item) { ACE_TRACE ("ACE_Bounded_Stack::push"); if (this->is_full () == 0) { this->stack_[this->top_++] = new_item; return 0; } else return -1; } template ACE_INLINE int ACE_Bounded_Stack::pop (T &item) { ACE_TRACE ("ACE_Bounded_Stack::pop"); if (this->is_empty () == 0) { item = this->stack_[--this->top_]; return 0; } else return -1; } template ACE_INLINE int ACE_Bounded_Stack::top (T &item) const { ACE_TRACE ("ACE_Bounded_Stack::top"); if (this->is_empty () == 0) { item = this->stack_[this->top_ - 1]; return 0; } else return -1; } template ACE_INLINE size_t ACE_Bounded_Stack::size (void) const { return this->size_; } //---------------------------------------- template ACE_INLINE int ACE_Fixed_Stack::is_empty (void) const { ACE_TRACE ("ACE_Fixed_Stack::is_empty"); return this->top_ == 0; } template ACE_INLINE int ACE_Fixed_Stack::is_full (void) const { ACE_TRACE ("ACE_Fixed_Stack::is_full"); return this->top_ >= this->size_; } template ACE_INLINE int ACE_Fixed_Stack::push (const T &new_item) { ACE_TRACE ("ACE_Fixed_Stack::push"); if (this->is_full () == 0) { this->stack_[this->top_++] = new_item; return 0; } else return -1; } template ACE_INLINE int ACE_Fixed_Stack::pop (T &item) { ACE_TRACE ("ACE_Fixed_Stack::pop"); if (this->is_empty () == 0) { item = this->stack_[--this->top_]; return 0; } else return -1; } template ACE_INLINE int ACE_Fixed_Stack::top (T &item) const { ACE_TRACE ("ACE_Fixed_Stack::top"); if (this->is_empty () == 0) { item = this->stack_[this->top_ - 1]; return 0; } else return -1; } template ACE_INLINE size_t ACE_Fixed_Stack::size (void) const { return this->size_; } template ACE_INLINE int ACE_Unbounded_Stack::is_empty (void) const { // ACE_TRACE ("ACE_Unbounded_Stack::is_empty"); return this->head_ == this->head_->next_; } template ACE_INLINE int ACE_Unbounded_Stack::top (T &item) const { ACE_TRACE ("ACE_Unbounded_Stack::top"); if (this->is_empty () == 0) { item = this->head_->next_->item_; return 0; } else return -1; } template ACE_INLINE int ACE_Unbounded_Stack::is_full (void) const { ACE_TRACE ("ACE_Unbounded_Stack::is_full"); return 0; // ??? } template ACE_INLINE size_t ACE_Unbounded_Stack::size (void) const { return this->cur_size_; } // --- template ACE_INLINE size_t ACE_Unbounded_Queue::size (void) const { return this->cur_size_; } template ACE_INLINE int ACE_Unbounded_Queue::is_empty (void) const { // ACE_TRACE ("ACE_Unbounded_Queue::is_empty"); return this->head_ == this->head_->next_; } template ACE_INLINE int ACE_Unbounded_Queue::is_full (void) const { // ACE_TRACE ("ACE_Unbounded_Queue::is_full"); return 0; // We should implement a "node of last resort for this..." } // --- template ACE_INLINE int ACE_Unbounded_Set::is_empty (void) const { ACE_TRACE ("ACE_Unbounded_Set::is_empty"); return this->head_ == this->head_->next_; } template ACE_INLINE int ACE_Unbounded_Set::is_full (void) const { ACE_TRACE ("ACE_Unbounded_Set::is_full"); return 0; // We should implement a "node of last resort for this..." } // --- template ACE_INLINE int ACE_Fixed_Set::is_empty (void) const { ACE_TRACE ("ACE_Fixed_Set::is_empty"); return this->cur_size_ == 0; } template ACE_INLINE int ACE_Fixed_Set::is_full (void) const { ACE_TRACE ("ACE_Fixed_Set::is_full"); return this->cur_size_ == this->max_size_; } // --- template ACE_INLINE int ACE_Bounded_Set::is_empty (void) const { ACE_TRACE ("ACE_Bounded_Set::is_empty"); return this->cur_size_ == 0; } #if !defined (__Lynx__) // LynxOS 3.0.0 native g++ compiler raises internal error with this inline. template ACE_INLINE int ACE_Bounded_Set::is_full (void) const { ACE_TRACE ("ACE_Bounded_Set::is_full"); return this->cur_size_ == this->max_size_; } #endif /* ! __Lynx__ */ // -- template ACE_INLINE int ACE_Ordered_MultiSet_Iterator::first (void) { ACE_TRACE ("ACE_Ordered_MultiSet_Iterator::first"); current_ = set_.head_; return (current_ ? 1 : 0); } template ACE_INLINE int ACE_Ordered_MultiSet_Iterator::last (void) { ACE_TRACE ("ACE_Ordered_MultiSet_Iterator::last"); current_ = set_.tail_; return (current_ ? 1 : 0); } template ACE_INLINE int ACE_Ordered_MultiSet_Iterator::advance (void) { ACE_TRACE ("ACE_Ordered_MultiSet_Iterator::advance"); current_ = current_ ? current_->next_ : 0; return (current_ ? 1 : 0); } template ACE_INLINE int ACE_Ordered_MultiSet_Iterator::retreat (void) { ACE_TRACE ("ACE_Ordered_MultiSet_Iterator::retreat"); current_ = current_ ? current_->prev_ : 0; return (current_ ? 1 : 0); } template ACE_INLINE int ACE_Ordered_MultiSet_Iterator::done (void) const { ACE_TRACE ("ACE_Ordered_MultiSet_Iterator::done"); return (current_ ? 0 : 1); } template ACE_INLINE void ACE_Ordered_MultiSet_Iterator::dump (void) const { // ACE_TRACE ("ACE_Ordered_MultiSet_Iterator::dump"); } // -- template ACE_INLINE int ACE_Ordered_MultiSet::is_empty (void) const { ACE_TRACE ("ACE_Ordered_MultiSet::is_empty"); return this->cur_size_ > 0 ? 0 : 1; } template ACE_INLINE size_t ACE_Ordered_MultiSet::size (void) const { // ACE_TRACE ("ACE_Ordered_MultiSet::size"); return this->cur_size_; } // **************************************************************** // Clean up the array (e.g., delete dynamically allocated memory). template ACE_INLINE ACE_Array_Base::~ACE_Array_Base (void) { ACE_DES_ARRAY_FREE (this->array_, this->max_size_, this->allocator_->free, T); } template ACE_INLINE size_t ACE_Array_Base::size (void) const { return this->cur_size_; } template ACE_INLINE size_t ACE_Array_Base::max_size (void) const { return this->max_size_; } template ACE_INLINE int ACE_Array_Base::in_range (size_t index) const { return index < this->cur_size_; } template ACE_INLINE T & ACE_Array_Base::operator[] (size_t index) { return this->array_[index]; } template ACE_INLINE const T & ACE_Array_Base::operator[] (size_t index) const { return this->array_[index]; } // **************************************************************** template ACE_INLINE ACE_Array::ACE_Array (size_t size, ACE_Allocator *alloc) : ACE_Array_Base (size, alloc) { } template ACE_INLINE ACE_Array::ACE_Array (size_t size, const T &default_value, ACE_Allocator *alloc) : ACE_Array_Base (size, default_value, alloc) { } // The copy constructor (performs initialization). template ACE_INLINE ACE_Array::ACE_Array (const ACE_Array &s) : ACE_Array_Base (s) { } // Assignment operator (performs assignment). template ACE_INLINE void ACE_Array::operator= (const ACE_Array &s) { // Check for "self-assignment". if (this != &s) this->ACE_Array_Base::operator= (s); } // Compare this array with for inequality. template ACE_INLINE int ACE_Array::operator!= (const ACE_Array &s) const { return !(*this == s); } // **************************************************************** template ACE_INLINE void ACE_Array_Iterator::dump (void) const { // ACE_TRACE ("ACE_Array_Iterator::dump"); } template ACE_INLINE ACE_Array_Iterator::ACE_Array_Iterator (ACE_Array_Base &a) : current_ (0), array_ (a) { // ACE_TRACE ("ACE_Array_Iterator::ACE_Array_Iterator"); } template ACE_INLINE int ACE_Array_Iterator::advance (void) { // ACE_TRACE ("ACE_Array_Iterator::advance"); if (this->current_ < array_.size ()) { ++this->current_; return 1; } else { // Already finished iterating. return 0; } } template ACE_INLINE int ACE_Array_Iterator::done (void) const { ACE_TRACE ("ACE_Array_Iterator::done"); return this->current_ >= array_.size (); } // **************************************************************** template ACE_INLINE void ACE_DLList::operator= (ACE_DLList &l) { *(ACE_DLList_Base *) this = l; } template ACE_INLINE int ACE_DLList::get (T *&item, size_t index) { ACE_DLList_Node *node; int result = ACE_DLList_Base::get (node, index); item = (T *) node->item_; return result; } template ACE_INLINE void ACE_DLList::dump (void) const { ACE_DLList_Base::dump (); } template ACE_INLINE int ACE_DLList::remove (ACE_DLList_Node *n) { int result = ACE_DLList_Base::remove (n); ACE_DES_FREE (n, this->allocator_->free, ACE_DLList_Node); return result; } template ACE_INLINE ACE_DLList::ACE_DLList (ACE_Allocator *alloc ) : ACE_DLList_Base (alloc) { } template ACE_INLINE ACE_DLList::ACE_DLList (ACE_DLList &l) : ACE_DLList_Base ((ACE_DLList &) l) { } template ACE_INLINE ACE_DLList::~ACE_DLList (void) { while (this->delete_head ()) ; } template ACE_INLINE int ACE_DLList_Iterator::remove (void) { ACE_DLList_Node *temp = this->ACE_Double_Linked_List_Iterator ::next (); this->ACE_Double_Linked_List_Iterator ::advance (); return dllist_->remove (temp); } template ACE_INLINE ACE_DLList_Iterator::ACE_DLList_Iterator (ACE_DLList &l) : ACE_Double_Linked_List_Iterator ((ACE_DLList_Base &)l), list_ (&l) { } template ACE_INLINE void ACE_DLList_Iterator::reset (ACE_DLList &l) { list_ = &l; this->ACE_Double_Linked_List_Iterator ::reset ((ACE_DLList_Base &)l); } template ACE_INLINE int ACE_DLList_Iterator::next (T *&ptr) { ACE_DLList_Node *temp = ACE_Double_Linked_List_Iterator ::next (); if (temp) ptr = (T *) temp->item_; return temp ? 1 : 0; } template ACE_INLINE T * ACE_DLList_Iterator::next (void) const { ACE_DLList_Node *temp = ACE_Double_Linked_List_Iterator ::next (); return (T *) (temp ? temp->item_ : 0); } template ACE_INLINE int ACE_DLList_Iterator::advance (void) { return this->ACE_Double_Linked_List_Iterator ::advance (); } template ACE_INLINE void ACE_DLList_Iterator::dump (void) const { ACE_Double_Linked_List_Iterator ::dump (); } template ACE_INLINE int ACE_DLList_Reverse_Iterator::remove (void) { ACE_DLList_Node *temp = ACE_Double_Linked_List_Reverse_Iterator ::next (); this->ACE_Double_Linked_List_Reverse_Iterator ::advance (); return dllist_->remove (temp); } template ACE_INLINE ACE_DLList_Reverse_Iterator::ACE_DLList_Reverse_Iterator (ACE_DLList &l) : ACE_Double_Linked_List_Reverse_Iterator ((ACE_DLList_Base &)l), list_ (&l) { } template ACE_INLINE void ACE_DLList_Reverse_Iterator::reset (ACE_DLList &l) { list_ = &l; this->ACE_Double_Linked_List_Reverse_Iterator ::reset ((ACE_DLList_Base &)l); } template ACE_INLINE int ACE_DLList_Reverse_Iterator::advance (void) { return ACE_Double_Linked_List_Reverse_Iterator ::advance (); } template ACE_INLINE int ACE_DLList_Reverse_Iterator::next (T *&ptr) { ACE_DLList_Node *temp = ACE_Double_Linked_List_Reverse_Iterator ::next (); ptr = (T *) temp->item_; return ptr ? 1 : 0; } template ACE_INLINE T * ACE_DLList_Reverse_Iterator::next (void) const { ACE_DLList_Node *temp = ACE_Double_Linked_List_Reverse_Iterator ::next (); return (T *) (temp ? temp->item_ : 0); } template ACE_INLINE void ACE_DLList_Reverse_Iterator::dump (void) const { ACE_Double_Linked_List_Reverse_Iterator ::dump (); }