Main Page   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members   File Members   Related Pages  

Containers_T.i

Go to the documentation of this file.
00001 /* -*- C++ -*- */
00002 // $Id: Containers_T.i,v 1.1.1.2 2001/12/04 14:33:00 chad Exp $
00003 
00004 // Containers.i
00005 
00006 template <class T> ACE_INLINE int
00007 ACE_Bounded_Stack<T>::is_empty (void) const
00008 {
00009   ACE_TRACE ("ACE_Bounded_Stack<T>::is_empty");
00010   return this->top_ == 0;
00011 }
00012 
00013 template <class T> ACE_INLINE int
00014 ACE_Bounded_Stack<T>::is_full (void) const
00015 {
00016   ACE_TRACE ("ACE_Bounded_Stack<T>::is_full");
00017   return this->top_ >= this->size_;
00018 }
00019 
00020 template <class T> ACE_INLINE int
00021 ACE_Bounded_Stack<T>::push (const T &new_item)
00022 {
00023   ACE_TRACE ("ACE_Bounded_Stack<T>::push");
00024   if (this->is_full () == 0)
00025     {
00026       this->stack_[this->top_++] = new_item;
00027       return 0;
00028     }
00029   else
00030     return -1;
00031 }
00032 
00033 template <class T> ACE_INLINE int
00034 ACE_Bounded_Stack<T>::pop (T &item)
00035 {
00036   ACE_TRACE ("ACE_Bounded_Stack<T>::pop");
00037   if (this->is_empty () == 0)
00038     {
00039       item = this->stack_[--this->top_];
00040       return 0;
00041     }
00042   else
00043     return -1;
00044 }
00045 
00046 template <class T> ACE_INLINE int
00047 ACE_Bounded_Stack<T>::top (T &item) const
00048 {
00049   ACE_TRACE ("ACE_Bounded_Stack<T>::top");
00050   if (this->is_empty () == 0)
00051     {
00052       item = this->stack_[this->top_ - 1];
00053       return 0;
00054     }
00055   else
00056     return -1;
00057 }
00058 
00059 template <class T> ACE_INLINE size_t
00060 ACE_Bounded_Stack<T>::size (void) const
00061 {
00062   return this->size_;
00063 }
00064 
00065 //----------------------------------------
00066 
00067 template <class T, size_t ACE_SIZE> ACE_INLINE int
00068 ACE_Fixed_Stack<T, ACE_SIZE>::is_empty (void) const
00069 {
00070   ACE_TRACE ("ACE_Fixed_Stack<T, ACE_SIZE>::is_empty");
00071   return this->top_ == 0;
00072 }
00073 
00074 template <class T, size_t ACE_SIZE> ACE_INLINE int
00075 ACE_Fixed_Stack<T, ACE_SIZE>::is_full (void) const
00076 {
00077   ACE_TRACE ("ACE_Fixed_Stack<T, ACE_SIZE>::is_full");
00078   return this->top_ >= this->size_;
00079 }
00080 
00081 template <class T, size_t ACE_SIZE> ACE_INLINE int
00082 ACE_Fixed_Stack<T, ACE_SIZE>::push (const T &new_item)
00083 {
00084   ACE_TRACE ("ACE_Fixed_Stack<T, ACE_SIZE>::push");
00085   if (this->is_full () == 0)
00086     {
00087       this->stack_[this->top_++] = new_item;
00088       return 0;
00089     }
00090   else
00091     return -1;
00092 }
00093 
00094 template <class T, size_t ACE_SIZE> ACE_INLINE int
00095 ACE_Fixed_Stack<T, ACE_SIZE>::pop (T &item)
00096 {
00097   ACE_TRACE ("ACE_Fixed_Stack<T, ACE_SIZE>::pop");
00098   if (this->is_empty () == 0)
00099     {
00100       item = this->stack_[--this->top_];
00101       return 0;
00102     }
00103   else
00104     return -1;
00105 }
00106 
00107 template <class T, size_t ACE_SIZE> ACE_INLINE int
00108 ACE_Fixed_Stack<T, ACE_SIZE>::top (T &item) const
00109 {
00110   ACE_TRACE ("ACE_Fixed_Stack<T, ACE_SIZE>::top");
00111   if (this->is_empty () == 0)
00112     {
00113       item = this->stack_[this->top_ - 1];
00114       return 0;
00115     }
00116   else
00117     return -1;
00118 }
00119 
00120 template <class T, size_t ACE_SIZE> ACE_INLINE size_t
00121 ACE_Fixed_Stack<T, ACE_SIZE>::size (void) const
00122 {
00123   return this->size_;
00124 }
00125 
00126 template <class T> ACE_INLINE int
00127 ACE_Unbounded_Stack<T>::is_empty (void) const
00128 {
00129   //  ACE_TRACE ("ACE_Unbounded_Stack<T>::is_empty");
00130   return this->head_ == this->head_->next_;
00131 }
00132 
00133 template <class T> ACE_INLINE int
00134 ACE_Unbounded_Stack<T>::top (T &item) const
00135 {
00136   ACE_TRACE ("ACE_Unbounded_Stack<T>::top");
00137   if (this->is_empty () == 0)
00138     {
00139       item = this->head_->next_->item_;
00140       return 0;
00141     }
00142   else
00143     return -1;
00144 }
00145 
00146 template <class T> ACE_INLINE int
00147 ACE_Unbounded_Stack<T>::is_full (void) const
00148 {
00149   ACE_TRACE ("ACE_Unbounded_Stack<T>::is_full");
00150   return 0; // ???
00151 }
00152 
00153 template <class T> ACE_INLINE size_t
00154 ACE_Unbounded_Stack<T>::size (void) const
00155 {
00156   return this->cur_size_;
00157 }
00158 
00159 // ---
00160 
00161 
00162 // ---
00163 
00164 template <class T, size_t ACE_SIZE> ACE_INLINE int
00165 ACE_Fixed_Set<T, ACE_SIZE>::is_empty (void) const
00166 {
00167   ACE_TRACE ("ACE_Fixed_Set<T>::is_empty");
00168   return this->cur_size_ == 0;
00169 }
00170 
00171 template <class T, size_t ACE_SIZE> ACE_INLINE int
00172 ACE_Fixed_Set<T, ACE_SIZE>::is_full (void) const
00173 {
00174   ACE_TRACE ("ACE_Fixed_Set<T, ACE_SIZE>::is_full");
00175   return this->cur_size_ == this->max_size_;
00176 }
00177 
00178 // ---
00179 
00180 template <class T> ACE_INLINE int
00181 ACE_Bounded_Set<T>::is_empty (void) const
00182 {
00183   ACE_TRACE ("ACE_Bounded_Set<T>::is_empty");
00184   return this->cur_size_ == 0;
00185 }
00186 
00187 #if !defined (__Lynx__)
00188  // LynxOS 3.0.0 native g++ compiler raises internal error with this inline.
00189 template <class T> ACE_INLINE int
00190 ACE_Bounded_Set<T>::is_full (void) const
00191 {
00192   ACE_TRACE ("ACE_Bounded_Set<T>::is_full");
00193   return this->cur_size_ == this->max_size_;
00194 }
00195 #endif /* ! __Lynx__ */
00196 
00197 // --
00198 
00199 template <class T> ACE_INLINE int
00200 ACE_Ordered_MultiSet_Iterator<T>::first (void)
00201 {
00202   ACE_TRACE ("ACE_Ordered_MultiSet_Iterator<T>::first");
00203   current_ = set_.head_;
00204 
00205   return (current_ ? 1 : 0);
00206 }
00207 
00208 template <class T> ACE_INLINE int
00209 ACE_Ordered_MultiSet_Iterator<T>::last (void)
00210 {
00211   ACE_TRACE ("ACE_Ordered_MultiSet_Iterator<T>::last");
00212   current_ = set_.tail_;
00213 
00214   return (current_ ? 1 : 0);
00215 }
00216 
00217 template <class T> ACE_INLINE int
00218 ACE_Ordered_MultiSet_Iterator<T>::advance (void)
00219 {
00220   ACE_TRACE ("ACE_Ordered_MultiSet_Iterator<T>::advance");
00221 
00222   current_ = current_ ? current_->next_ : 0;
00223 
00224   return (current_ ? 1 : 0);
00225 }
00226 
00227 template <class T> ACE_INLINE int
00228 ACE_Ordered_MultiSet_Iterator<T>::retreat (void)
00229 {
00230   ACE_TRACE ("ACE_Ordered_MultiSet_Iterator<T>::retreat");
00231 
00232   current_ = current_ ? current_->prev_ : 0;
00233 
00234   return (current_ ? 1 : 0);
00235 }
00236 
00237 template <class T> ACE_INLINE int
00238 ACE_Ordered_MultiSet_Iterator<T>::done (void) const
00239 {
00240   ACE_TRACE ("ACE_Ordered_MultiSet_Iterator<T>::done");
00241 
00242   return (current_ ? 0 : 1);
00243 }
00244 
00245 template <class T> ACE_INLINE void
00246 ACE_Ordered_MultiSet_Iterator<T>::dump (void) const
00247 {
00248 // ACE_TRACE ("ACE_Ordered_MultiSet_Iterator<T>::dump");
00249 }
00250 
00251 
00252 
00253 // --
00254 
00255 template <class T> ACE_INLINE int
00256 ACE_Ordered_MultiSet<T>::is_empty (void) const
00257 {
00258   ACE_TRACE ("ACE_Ordered_MultiSet<T>::is_empty");
00259   return this->cur_size_ > 0 ? 0 : 1;
00260 }
00261 
00262 template <class T> ACE_INLINE size_t
00263 ACE_Ordered_MultiSet<T>::size (void) const
00264 {
00265 // ACE_TRACE ("ACE_Ordered_MultiSet<T>::size");
00266   return this->cur_size_;
00267 }
00268 
00269 // ****************************************************************
00270 
00271 template <class T> ACE_INLINE
00272 ACE_Array<T>::ACE_Array (size_t size,
00273                          ACE_Allocator *alloc)
00274   : ACE_Array_Base<T> (size, alloc)
00275 {
00276 }
00277 
00278 template <class T> ACE_INLINE
00279 ACE_Array<T>::ACE_Array (size_t size,
00280                          const T &default_value,
00281                          ACE_Allocator *alloc)
00282   : ACE_Array_Base<T> (size, default_value, alloc)
00283 {
00284 }
00285 
00286 // The copy constructor (performs initialization).
00287 
00288 template <class T> ACE_INLINE
00289 ACE_Array<T>::ACE_Array (const ACE_Array<T> &s)
00290    : ACE_Array_Base<T> (s)
00291 {
00292 }
00293 
00294 // Assignment operator (performs assignment).
00295 
00296 template <class T> ACE_INLINE void
00297 ACE_Array<T>::operator= (const ACE_Array<T> &s)
00298 {
00299   // Check for "self-assignment".
00300 
00301   if (this != &s)
00302     this->ACE_Array_Base<T>::operator= (s);
00303 }
00304 
00305 // Compare this array with <s> for inequality.
00306 
00307 template <class T> ACE_INLINE int
00308 ACE_Array<T>::operator!= (const ACE_Array<T> &s) const
00309 {
00310   return !(*this == s);
00311 }
00312 
00313 // ****************************************************************
00314 
00315 
00316 // ****************************************************************
00317 
00318 template <class T> ACE_INLINE void
00319 ACE_DLList<T>::operator= (const ACE_DLList<T> &l)
00320 {
00321   *(ACE_DLList_Base *) this = l;
00322 }
00323 
00324 template <class T> ACE_INLINE int
00325 ACE_DLList<T>::get (T *&item, size_t index)
00326 {
00327   ACE_DLList_Node *node;
00328   int result = ACE_DLList_Base::get (node, index);
00329   if (result != -1)
00330     item = (T *) node->item_;
00331   return result;
00332 }
00333 
00334 template <class T> ACE_INLINE void
00335 ACE_DLList<T>::dump (void) const
00336 {
00337   ACE_DLList_Base::dump ();
00338 }
00339 
00340 template <class T> ACE_INLINE int
00341 ACE_DLList<T>::remove (ACE_DLList_Node *n)
00342 {
00343   int result = ACE_DLList_Base::remove (n);
00344   ACE_DES_FREE (n,
00345                 this->allocator_->free,
00346                 ACE_DLList_Node);
00347   return result;
00348 }
00349 
00350 template <class T> ACE_INLINE
00351 ACE_DLList<T>::ACE_DLList (ACE_Allocator *alloc )
00352   : ACE_DLList_Base (alloc)
00353 {
00354 }
00355 
00356 template <class T> ACE_INLINE
00357 ACE_DLList<T>::ACE_DLList (const ACE_DLList<T> &l)
00358   : ACE_DLList_Base ((ACE_DLList<T> &) l)
00359 {
00360 }
00361 
00362 template <class T> ACE_INLINE
00363 ACE_DLList<T>::~ACE_DLList (void)
00364 {
00365   while (this->delete_head ()) ;
00366 }
00367 
00368 template <class T> ACE_INLINE int
00369 ACE_DLList_Iterator<T>::remove (void)
00370 {
00371   ACE_DLList_Node *temp = this->ACE_Double_Linked_List_Iterator <ACE_DLList_Node>::next ();
00372   this->ACE_Double_Linked_List_Iterator <ACE_DLList_Node>::advance ();
00373   return list_->remove (temp);
00374 }
00375 
00376 template <class T> ACE_INLINE
00377 ACE_DLList_Iterator<T>::ACE_DLList_Iterator (ACE_DLList<T> &l)
00378   : ACE_Double_Linked_List_Iterator <ACE_DLList_Node> ((ACE_DLList_Base &)l),
00379     list_ (&l)
00380 {
00381 }
00382 
00383 template <class T> ACE_INLINE void
00384 ACE_DLList_Iterator<T>::reset (ACE_DLList<T> &l)
00385 {
00386   list_ = &l;
00387   this->ACE_Double_Linked_List_Iterator <ACE_DLList_Node>::reset ((ACE_DLList_Base &)l);
00388 }
00389 
00390 template <class T> ACE_INLINE int
00391 ACE_DLList_Iterator<T>::next (T *&ptr)
00392 {
00393   ACE_DLList_Node *temp =
00394     ACE_Double_Linked_List_Iterator <ACE_DLList_Node>::next ();
00395   if (temp)
00396     ptr = (T *) temp->item_;
00397   return temp ? 1 : 0;
00398 }
00399 
00400 template <class T> ACE_INLINE T *
00401 ACE_DLList_Iterator<T>::next (void) const
00402 {
00403   ACE_DLList_Node *temp = ACE_Double_Linked_List_Iterator <ACE_DLList_Node>::next ();
00404   return (T *) (temp ? temp->item_ : 0);
00405 }
00406 
00407 template <class T> ACE_INLINE int
00408 ACE_DLList_Iterator<T>::advance (void)
00409 {
00410   return this->ACE_Double_Linked_List_Iterator <ACE_DLList_Node>::advance ();
00411 }
00412 
00413 template <class T> ACE_INLINE void
00414 ACE_DLList_Iterator<T>::dump (void) const
00415 {
00416   ACE_Double_Linked_List_Iterator <ACE_DLList_Node>::dump ();
00417 }
00418 
00419 
00420 template <class T> ACE_INLINE int
00421 ACE_DLList_Reverse_Iterator<T>::remove (void)
00422 {
00423   ACE_DLList_Node *temp = ACE_Double_Linked_List_Reverse_Iterator <ACE_DLList_Node>::next ();
00424   this->ACE_Double_Linked_List_Reverse_Iterator <ACE_DLList_Node>::advance ();
00425   return list_->remove (temp);
00426 }
00427 
00428 template <class T> ACE_INLINE
00429 ACE_DLList_Reverse_Iterator<T>::ACE_DLList_Reverse_Iterator (ACE_DLList<T> &l)
00430   : ACE_Double_Linked_List_Reverse_Iterator <ACE_DLList_Node> ((ACE_DLList_Base &)l),
00431     list_ (&l)
00432 {
00433 }
00434 
00435 template <class T> ACE_INLINE void
00436 ACE_DLList_Reverse_Iterator<T>::reset (ACE_DLList<T> &l)
00437 {
00438   list_ = &l;
00439   this->ACE_Double_Linked_List_Reverse_Iterator <ACE_DLList_Node>::reset ((ACE_DLList_Base &)l);
00440 }
00441 
00442 template <class T> ACE_INLINE int
00443 ACE_DLList_Reverse_Iterator<T>::advance (void)
00444 {
00445   return ACE_Double_Linked_List_Reverse_Iterator <ACE_DLList_Node>::advance ();
00446 }
00447 
00448 template <class T> ACE_INLINE int
00449 ACE_DLList_Reverse_Iterator<T>::next (T *&ptr)
00450 {
00451   ACE_DLList_Node *temp =
00452     ACE_Double_Linked_List_Reverse_Iterator <ACE_DLList_Node>::next ();
00453   ptr = (T *) temp->item_;
00454   return ptr ? 1 : 0;
00455 }
00456 
00457 template <class T> ACE_INLINE T *
00458 ACE_DLList_Reverse_Iterator<T>::next (void) const
00459 {
00460   ACE_DLList_Node *temp = ACE_Double_Linked_List_Reverse_Iterator <ACE_DLList_Node>::next ();
00461   return (T *) (temp ? temp->item_ : 0);
00462 }
00463 
00464 
00465 template <class T> ACE_INLINE void
00466 ACE_DLList_Reverse_Iterator<T>::dump (void) const
00467 {
00468   ACE_Double_Linked_List_Reverse_Iterator <ACE_DLList_Node>::dump ();
00469 }

Generated on Mon Jun 16 11:19:33 2003 for ACE by doxygen1.2.14 written by Dimitri van Heesch, © 1997-2002