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

Sequence_T.i

Go to the documentation of this file.
00001 // This may look like C, but it's really -*- C++ -*-
00002 // $Id: Sequence_T.i,v 1.1.1.4 2003/02/21 18:36:45 chad Exp $
00003 
00004 // ***************************************************
00005 // Operations on the generic unbounded sequence class.
00006 // ***************************************************
00007 
00008 template <class T> ACE_INLINE T *
00009 TAO_Unbounded_Sequence<T>::allocbuf (CORBA::ULong size)
00010 {
00011   return new T[size];
00012 }
00013 
00014 template <class T> ACE_INLINE void
00015 TAO_Unbounded_Sequence<T>::freebuf (T *buffer)
00016 {
00017   delete [] buffer;
00018 }
00019 
00020 template <class T> ACE_INLINE
00021 TAO_Unbounded_Sequence<T>::TAO_Unbounded_Sequence (void)
00022 {
00023 }
00024 
00025 template <class T> ACE_INLINE
00026 TAO_Unbounded_Sequence<T>::TAO_Unbounded_Sequence (CORBA::ULong maximum)
00027   : TAO_Unbounded_Base_Sequence (maximum,
00028                                  TAO_Unbounded_Sequence<T>::allocbuf (maximum))
00029 {
00030 }
00031 
00032 template <class T> ACE_INLINE
00033 TAO_Unbounded_Sequence<T>::TAO_Unbounded_Sequence (CORBA::ULong maximum,
00034                                                    CORBA::ULong length,
00035                                                    T *data,
00036                                                    CORBA::Boolean release)
00037   : TAO_Unbounded_Base_Sequence (maximum, length, data, release)
00038 {
00039 }
00040 
00041 template <class T> ACE_INLINE T *
00042 TAO_Unbounded_Sequence<T>::get_buffer (CORBA::Boolean orphan)
00043 {
00044   T *result = 0;
00045   if (orphan == 0)
00046     {
00047       // We retain ownership.
00048       if (this->buffer_ == 0)
00049         {
00050           if (this->length_ > 0)
00051             {
00052               result = TAO_Unbounded_Sequence<T>::allocbuf (this->length_);
00053               this->buffer_ = result;
00054               this->release_ = 1;
00055             }
00056         }
00057       else
00058         {
00059           result =
00060             ACE_reinterpret_cast (T*, 
00061                                   this->buffer_);
00062         }
00063     }
00064   else // if (orphan == 1)
00065     {
00066       result = ACE_reinterpret_cast (T*,
00067                                      this->buffer_);
00068 
00069       if (this->release_ != 0)
00070         {
00071           // We set the state back to default and relinquish
00072           // ownership.
00073           this->maximum_ = 0;
00074           this->length_ = 0;
00075           this->buffer_ = 0;
00076           this->release_ = 0;
00077         }
00078     }
00079 
00080   return result;
00081 }
00082 
00083 template <class T> ACE_INLINE const T *
00084 TAO_Unbounded_Sequence<T>::get_buffer (void) const
00085 {
00086   return ACE_reinterpret_cast (const T * ACE_CAST_CONST, this->buffer_);
00087 }
00088 
00089 template <class T> ACE_INLINE void
00090 TAO_Unbounded_Sequence<T>::replace (CORBA::ULong max,
00091                                     CORBA::ULong length,
00092                                     T *data,
00093                                     CORBA::Boolean release)
00094 {
00095   this->maximum_ = max;
00096   this->length_ = length;
00097   if (this->buffer_ && this->release_ == 1)
00098     {
00099       T *tmp = ACE_reinterpret_cast(T*,this->buffer_);
00100       TAO_Unbounded_Sequence<T>::freebuf (tmp);
00101     }
00102   this->buffer_ = data;
00103   this->release_ = release;
00104 }
00105 
00106 // ***************************************************
00107 // operations on the generic Bounded sequence class
00108 // ***************************************************
00109 
00110 template <class T, size_t MAX> ACE_INLINE T *
00111 TAO_Bounded_Sequence<T, MAX>::allocbuf (CORBA::ULong)
00112 {
00113   return new T[MAX];
00114 }
00115 
00116 template <class T, size_t MAX> ACE_INLINE void
00117 TAO_Bounded_Sequence<T, MAX>::freebuf (T *buffer)
00118 {
00119   delete [] buffer;
00120 }
00121 
00122 template <class T, size_t MAX> ACE_INLINE
00123 TAO_Bounded_Sequence<T, MAX>::TAO_Bounded_Sequence (void)
00124 {
00125   this->maximum_ = MAX;
00126 }
00127 
00128 template <class T, size_t MAX> ACE_INLINE
00129 TAO_Bounded_Sequence<T, MAX>::TAO_Bounded_Sequence (CORBA::ULong length,
00130                                                     T *data,
00131                                                     CORBA::Boolean release)
00132   : TAO_Bounded_Base_Sequence (MAX, length, data, release)
00133 {
00134 }
00135 
00136 template <class T, size_t MAX> ACE_INLINE T *
00137 TAO_Bounded_Sequence<T, MAX>::get_buffer (CORBA::Boolean orphan)
00138 {
00139   T *result = 0;
00140   if (orphan == 0)
00141     {
00142       // We retain ownership.
00143 
00144       if (this->buffer_ == 0)
00145         {
00146           result = TAO_Bounded_Sequence<T,MAX>::allocbuf (this->maximum_);
00147           this->buffer_ = result;
00148           this->release_ = 1;
00149         }
00150       else
00151         {
00152           result =
00153             ACE_reinterpret_cast (T*, this->buffer_);
00154         }
00155     }
00156   else // if (orphan == 1)
00157     {
00158       if (this->release_ != 0)
00159         {
00160           // We set the state back to default and relinquish
00161           // ownership.
00162           result = ACE_reinterpret_cast(T*,this->buffer_);
00163           this->maximum_ = 0;
00164           this->length_ = 0;
00165           this->buffer_ = 0;
00166           this->release_ = 0;
00167         }
00168     }
00169   return result;
00170 }
00171 
00172 template <class T, size_t MAX> ACE_INLINE const T *
00173 TAO_Bounded_Sequence<T, MAX>::get_buffer (void) const
00174 {
00175   return ACE_reinterpret_cast(const T * ACE_CAST_CONST, this->buffer_);
00176 }
00177 
00178 template <class T, size_t MAX> ACE_INLINE void
00179 TAO_Bounded_Sequence<T, MAX>::replace (CORBA::ULong max,
00180                                        CORBA::ULong length,
00181                                        T *data,
00182                                        CORBA::Boolean release)
00183 {
00184   this->maximum_ = max;
00185   this->length_ = length;
00186   if (this->buffer_ && this->release_ == 1)
00187     {
00188       T* tmp = ACE_reinterpret_cast(T*, this->buffer_);
00189       TAO_Bounded_Sequence<T, MAX>::freebuf (tmp);
00190     }
00191   this->buffer_ = data;
00192   this->release_ = release;
00193 }
00194 
00195 template <class T, size_t MAX> ACE_INLINE T &
00196 TAO_Bounded_Sequence<T, MAX>::operator[] (CORBA::ULong i)
00197 {
00198   ACE_ASSERT (i < this->maximum_);
00199   T *tmp = ACE_reinterpret_cast (T*,this->buffer_);
00200   return tmp[i];
00201 }
00202 
00203 template <class T, size_t MAX> ACE_INLINE const T &
00204 TAO_Bounded_Sequence<T, MAX>::operator[] (CORBA::ULong i) const
00205 {
00206   ACE_ASSERT (i < this->maximum_);
00207   const T* tmp = ACE_reinterpret_cast (const T* ACE_CAST_CONST,this->buffer_);
00208   return tmp[i];
00209 }
00210 
00211 // *************************************************************
00212 // Inline operations for class TAO_Object_Manager<T>
00213 // *************************************************************
00214 
00215 template <class T, class T_var> ACE_INLINE
00216 TAO_Object_Manager<T,T_var>::~TAO_Object_Manager (void)
00217 {
00218 }
00219 
00220 template <class T, class T_var> ACE_INLINE
00221 TAO_Object_Manager<T,T_var>::TAO_Object_Manager (const TAO_Object_Manager<T,T_var> &rhs)
00222   : ptr_ (rhs.ptr_),
00223     release_ (rhs.release_)
00224 {
00225 }
00226 
00227 template <class T, class T_var> ACE_INLINE
00228 TAO_Object_Manager<T,T_var>::TAO_Object_Manager(T** buffer, CORBA::Boolean release)
00229   : ptr_ (buffer),
00230     release_ (release)
00231 {
00232 }
00233 
00234 template <class T, class T_var> ACE_INLINE T *
00235 TAO_Object_Manager<T,T_var>::operator-> (void) const
00236 {
00237   return *this->ptr_;
00238 }
00239 
00240 template <class T, class T_var> ACE_INLINE
00241 TAO_Object_Manager<T,T_var>::operator const T_var () const
00242 {
00243   return T_var::tao_duplicate (*this->ptr_);
00244 }
00245 
00246 template <class T, class T_var> ACE_INLINE
00247 TAO_Object_Manager<T,T_var>::operator const T* () const // cast
00248 {
00249   return *this->ptr_;
00250 }
00251 
00252 template <class T, class T_var> ACE_INLINE
00253 TAO_Object_Manager<T,T_var>::operator T* &() // cast
00254 {
00255   return *this->ptr_;
00256 }
00257 
00258 template <class T, class T_var> ACE_INLINE T *
00259 TAO_Object_Manager<T,T_var>::in (void) const
00260 {
00261   return *this->ptr_;
00262 }
00263 
00264 template <class T, class T_var> ACE_INLINE T *&
00265 TAO_Object_Manager<T,T_var>::inout (void)
00266 {
00267   return *this->ptr_;
00268 }
00269 
00270 // *************************************************************
00271 // Inline operations for class TAO_Pseudo_Object_Manager<T>
00272 // *************************************************************
00273 
00274 template <class T, class T_var> ACE_INLINE
00275 TAO_Pseudo_Object_Manager<T,T_var>::~TAO_Pseudo_Object_Manager (void)
00276 {
00277 }
00278 
00279 template <class T, class T_var> ACE_INLINE
00280 
00281 TAO_Pseudo_Object_Manager<T,T_var>::    TAO_Pseudo_Object_Manager (const TAO_Pseudo_Object_Manager<T,T_var> &rhs)
00282   : ptr_ (rhs.ptr_),
00283     release_ (rhs.release_)
00284 {
00285 }
00286 
00287 template <class T, class T_var> ACE_INLINE
00288 
00289 TAO_Pseudo_Object_Manager<T,T_var>::    TAO_Pseudo_Object_Manager(T** buffer, CORBA::Boolean release)
00290   : ptr_ (buffer),
00291     release_ (release)
00292 {
00293 }
00294 
00295 template <class T, class T_var> ACE_INLINE T *
00296 TAO_Pseudo_Object_Manager<T,T_var>::operator-> (void) const
00297 {
00298   return *this->ptr_;
00299 }
00300 
00301 template <class T, class T_var> ACE_INLINE
00302 TAO_Pseudo_Object_Manager<T,T_var>::operator const T* () const // cast
00303 {
00304   return *this->ptr_;
00305 }
00306 
00307 template <class T, class T_var> ACE_INLINE
00308 TAO_Pseudo_Object_Manager<T,T_var>::operator T* &() // cast
00309 {
00310   return *this->ptr_;
00311 }
00312 
00313 template <class T, class T_var> ACE_INLINE T *
00314 TAO_Pseudo_Object_Manager<T,T_var>::in (void) const
00315 {
00316   return *this->ptr_;
00317 }
00318 
00319 template <class T, class T_var> ACE_INLINE T *&
00320 TAO_Pseudo_Object_Manager<T,T_var>::inout (void)
00321 {
00322   return *this->ptr_;
00323 }
00324 
00325 template <class T, class T_var> ACE_INLINE T *&
00326 TAO_Pseudo_Object_Manager<T,T_var>::out (void)
00327 {
00328   CORBA::release (*this->ptr_);
00329   *this->ptr_ = T::_nil ();
00330   return *this->ptr_;
00331 }
00332 
00333 template <class T, class T_var> ACE_INLINE T *
00334 TAO_Pseudo_Object_Manager<T,T_var>::_retn (void)
00335 {
00336   T *temp = *this->ptr_;
00337   *this->ptr_ = T::_nil ();
00338   return temp;
00339 }
00340 
00341 // *************************************************************
00342 // Inline operations for class TAO_Valuetype_Manager
00343 // *************************************************************
00344 
00345 template <class T, class T_var> ACE_INLINE
00346 TAO_Valuetype_Manager<T,T_var>::~TAO_Valuetype_Manager (void)
00347 {
00348 }
00349 
00350 template <class T, class T_var> ACE_INLINE
00351 TAO_Valuetype_Manager<T,T_var>::TAO_Valuetype_Manager (
00352     const TAO_Valuetype_Manager<T,T_var> &rhs
00353   )
00354   : ptr_ (rhs.ptr_),
00355     release_ (rhs.release_)
00356 {
00357 }
00358 
00359 template <class T, class T_var> ACE_INLINE
00360 TAO_Valuetype_Manager<T,T_var>::TAO_Valuetype_Manager(
00361     T** buffer, CORBA::Boolean release
00362   )
00363   : ptr_ (buffer),
00364     release_ (release)
00365 {
00366 }
00367 
00368 template <class T, class T_var> ACE_INLINE T *
00369 TAO_Valuetype_Manager<T,T_var>::operator-> (void) const
00370 {
00371   return *this->ptr_;
00372 }
00373 
00374 template <class T, class T_var> ACE_INLINE
00375 TAO_Valuetype_Manager<T,T_var>::operator const T_var () const
00376 {
00377   T_var::tao_add_ref (*this->ptr_);
00378   return *this->ptr_;
00379 }
00380 
00381 template <class T, class T_var> ACE_INLINE
00382 TAO_Valuetype_Manager<T,T_var>::operator const T* () const // cast
00383 {
00384   return *this->ptr_;
00385 }
00386 
00387 template <class T, class T_var> ACE_INLINE
00388 TAO_Valuetype_Manager<T,T_var>::operator T* &() // cast
00389 {
00390   return *this->ptr_;
00391 }
00392 
00393 template <class T, class T_var> ACE_INLINE T *
00394 TAO_Valuetype_Manager<T,T_var>::in (void) const
00395 {
00396   return *this->ptr_;
00397 }
00398 
00399 template <class T, class T_var> ACE_INLINE T *&
00400 TAO_Valuetype_Manager<T,T_var>::inout (void)
00401 {
00402   return *this->ptr_;
00403 }
00404 
00405 template <class T, class T_var> ACE_INLINE T *&
00406 TAO_Valuetype_Manager<T,T_var>::out (void)
00407 {
00408   T_var::tao_remove_ref (*this->ptr_);
00409   *this->ptr_ = 0;
00410   return *this->ptr_;
00411 }
00412 
00413 template <class T, class T_var> ACE_INLINE T *
00414 TAO_Valuetype_Manager<T,T_var>::_retn (void)
00415 {
00416   T *temp = *this->ptr_;
00417   *this->ptr_ = 0;
00418   return temp;
00419 }
00420 
00421 // *************************************************************
00422 // Inline operations for class TAO_Abstract_Manager
00423 // *************************************************************
00424 
00425 template <class T, class T_var> ACE_INLINE
00426 TAO_Abstract_Manager<T,T_var>::~TAO_Abstract_Manager (void)
00427 {
00428 }
00429 
00430 template <class T, class T_var> ACE_INLINE
00431 TAO_Abstract_Manager<T,T_var>::TAO_Abstract_Manager (
00432     const TAO_Abstract_Manager<T,T_var> &rhs
00433   )
00434   : ptr_ (rhs.ptr_),
00435     release_ (rhs.release_)
00436 {
00437 }
00438 
00439 template <class T, class T_var> ACE_INLINE
00440 TAO_Abstract_Manager<T,T_var>::TAO_Abstract_Manager(
00441     T** buffer, CORBA::Boolean release
00442   )
00443   : ptr_ (buffer),
00444     release_ (release)
00445 {
00446 }
00447 
00448 template <class T, class T_var> ACE_INLINE T *
00449 TAO_Abstract_Manager<T,T_var>::operator-> (void) const
00450 {
00451   return *this->ptr_;
00452 }
00453 
00454 template <class T, class T_var> ACE_INLINE
00455 TAO_Abstract_Manager<T,T_var>::operator const T_var () const
00456 {
00457   if (*this->ptr_ != 0)
00458     {
00459       (*this->ptr_)->_add_ref ();
00460     }
00461 
00462   return *this->ptr_;
00463 }
00464 
00465 template <class T, class T_var> ACE_INLINE
00466 TAO_Abstract_Manager<T,T_var>::operator const T* () const // cast
00467 {
00468   return *this->ptr_;
00469 }
00470 
00471 template <class T, class T_var> ACE_INLINE
00472 TAO_Abstract_Manager<T,T_var>::operator T* &() // cast
00473 {
00474   return *this->ptr_;
00475 }
00476 
00477 template <class T, class T_var> ACE_INLINE T *
00478 TAO_Abstract_Manager<T,T_var>::in (void) const
00479 {
00480   return *this->ptr_;
00481 }
00482 
00483 template <class T, class T_var> ACE_INLINE T *&
00484 TAO_Abstract_Manager<T,T_var>::inout (void)
00485 {
00486   return *this->ptr_;
00487 }
00488 
00489 template <class T, class T_var> ACE_INLINE T *&
00490 TAO_Abstract_Manager<T,T_var>::out (void)
00491 {
00492   if (*this->ptr_ != 0)
00493     {
00494       (*this->ptr_)->_remove_ref ();
00495     }
00496 
00497   *this->ptr_ = 0;
00498   return *this->ptr_;
00499 }
00500 
00501 template <class T, class T_var> ACE_INLINE T *
00502 TAO_Abstract_Manager<T,T_var>::_retn (void)
00503 {
00504   T *temp = *this->ptr_;
00505   *this->ptr_ = 0;
00506   return temp;
00507 }
00508 
00509 // *************************************************************
00510 // class TAO_Unbounded_Object_Sequence
00511 // *************************************************************
00512 
00513 //default constructor
00514 template <class T, class T_var> ACE_INLINE
00515 TAO_Unbounded_Object_Sequence<T,T_var>::TAO_Unbounded_Object_Sequence (void)
00516 {
00517 }
00518 
00519 template <class T, class T_var> ACE_INLINE
00520 
00521 TAO_Unbounded_Object_Sequence<T,T_var>::TAO_Unbounded_Object_Sequence (CORBA::ULong maximum,
00522                                CORBA::ULong length,
00523                                T* *value,
00524                                CORBA::Boolean release)
00525   : TAO_Unbounded_Base_Sequence (maximum, length, value, release)
00526 {
00527 }
00528 
00529 template <class T, class T_var> ACE_INLINE TAO_Object_Manager<T,T_var>
00530 TAO_Unbounded_Object_Sequence<T,T_var>::operator[] (CORBA::ULong slot) const
00531 {
00532   ACE_ASSERT (slot < this->maximum_);
00533   T ** const tmp = ACE_reinterpret_cast (T ** ACE_CAST_CONST, this->buffer_);
00534   return TAO_Object_Manager<T,T_var> (tmp + slot, this->release_);
00535 }
00536 
00537 // *************************************************************
00538 // class TAO_Bounded_Object_Sequence
00539 // *************************************************************
00540 
00541 template<class T, class T_var, size_t MAX> ACE_INLINE
00542 TAO_Bounded_Object_Sequence<T,T_var,MAX>::~TAO_Bounded_Object_Sequence (void)
00543 {
00544   this->_deallocate_buffer ();
00545 }
00546 
00547 template <class T, class T_var, size_t MAX> ACE_INLINE
00548 
00549 TAO_Bounded_Object_Sequence<T,T_var,MAX>::TAO_Bounded_Object_Sequence (CORBA::ULong length,
00550                              T **value,
00551                              CORBA::Boolean release)
00552   : TAO_Bounded_Base_Sequence (MAX, length, value, release)
00553 {
00554 }
00555 
00556 template <class T, class T_var, size_t MAX> ACE_INLINE TAO_Object_Manager<T,T_var>
00557 TAO_Bounded_Object_Sequence<T, T_var,MAX>::operator[] (CORBA::ULong slot) const
00558 {
00559   ACE_ASSERT (slot < this->maximum_);
00560   T **const tmp = ACE_reinterpret_cast (T ** ACE_CAST_CONST, this->buffer_);
00561   return TAO_Object_Manager<T,T_var> (tmp + slot, this->release_);
00562 }
00563 
00564 // *************************************************************
00565 // class TAO_Unbounded_Pseudo_Sequence
00566 // *************************************************************
00567 
00568 //default constructor
00569 template <class T, class T_var> ACE_INLINE
00570 TAO_Unbounded_Pseudo_Sequence<T,T_var>::TAO_Unbounded_Pseudo_Sequence (void)
00571 {
00572 }
00573 
00574 template <class T, class T_var> ACE_INLINE
00575 
00576 TAO_Unbounded_Pseudo_Sequence<T,T_var>::TAO_Unbounded_Pseudo_Sequence (CORBA::ULong maximum,
00577                                CORBA::ULong length,
00578                                T* *value,
00579                                CORBA::Boolean release)
00580   : TAO_Unbounded_Base_Sequence (maximum, length, value, release)
00581 {
00582 }
00583 
00584 template <class T, class T_var> ACE_INLINE TAO_Pseudo_Object_Manager<T,T_var>
00585 TAO_Unbounded_Pseudo_Sequence<T,T_var>::operator[] (CORBA::ULong slot) const
00586 {
00587   ACE_ASSERT (slot < this->maximum_);
00588   T ** const tmp = ACE_reinterpret_cast (T ** ACE_CAST_CONST, this->buffer_);
00589   return TAO_Pseudo_Object_Manager<T,T_var> (tmp + slot, this->release_);
00590 }
00591 
00592 // *************************************************************
00593 // class TAO_Bounded_Pseudo_Sequence
00594 // *************************************************************
00595 
00596 template<class T, class T_var, size_t MAX> ACE_INLINE
00597 TAO_Bounded_Pseudo_Sequence<T,T_var,MAX>::~TAO_Bounded_Pseudo_Sequence (void)
00598 {
00599   this->_deallocate_buffer ();
00600 }
00601 
00602 template <class T, class T_var, size_t MAX> ACE_INLINE
00603 
00604 TAO_Bounded_Pseudo_Sequence<T,T_var,MAX>::TAO_Bounded_Pseudo_Sequence (CORBA::ULong length,
00605                              T **value,
00606                              CORBA::Boolean release)
00607   : TAO_Bounded_Base_Sequence (MAX, length, value, release)
00608 {
00609 }
00610 
00611 template <class T, class T_var, size_t MAX> ACE_INLINE TAO_Pseudo_Object_Manager<T,T_var>
00612 TAO_Bounded_Pseudo_Sequence<T, T_var,MAX>::operator[] (CORBA::ULong slot) const
00613 {
00614   ACE_ASSERT (slot < this->maximum_);
00615   T **const tmp = ACE_reinterpret_cast (T ** ACE_CAST_CONST,
00616                                         this->buffer_);
00617   return TAO_Pseudo_Object_Manager<T,T_var> (tmp + slot,
00618                                              this->release_);
00619 }
00620 
00621 // *************************************************************
00622 // class TAO_Unbounded_Valuetype_Sequence
00623 // *************************************************************
00624 
00625 //default constructor
00626 template <class T, class T_var> 
00627 ACE_INLINE
00628 TAO_Unbounded_Valuetype_Sequence<T,T_var>::TAO_Unbounded_Valuetype_Sequence (
00629     void
00630   )
00631 {
00632 }
00633 
00634 template <class T, class T_var> 
00635 ACE_INLINE
00636 TAO_Unbounded_Valuetype_Sequence<T,T_var>::TAO_Unbounded_Valuetype_Sequence (
00637     CORBA::ULong maximum,
00638     CORBA::ULong length,
00639     T* *value,
00640     CORBA::Boolean release
00641   )
00642   : TAO_Unbounded_Base_Sequence (maximum, length, value, release)
00643 {
00644 }
00645 
00646 template <class T, class T_var> 
00647 ACE_INLINE 
00648 TAO_Valuetype_Manager<T,T_var>
00649 TAO_Unbounded_Valuetype_Sequence<T,T_var>::operator[] (
00650     CORBA::ULong slot
00651   ) const
00652 {
00653   ACE_ASSERT (slot < this->maximum_);
00654   T ** const tmp = ACE_reinterpret_cast (T ** ACE_CAST_CONST, this->buffer_);
00655   return TAO_Valuetype_Manager<T,T_var> (tmp + slot, this->release_);
00656 }
00657 
00658 // *************************************************************
00659 // class TAO_Bounded_Valuetype_Sequence
00660 // *************************************************************
00661 
00662 template<class T, class T_var, size_t MAX> 
00663 ACE_INLINE
00664 TAO_Bounded_Valuetype_Sequence<T,T_var,MAX>::~TAO_Bounded_Valuetype_Sequence (
00665     void
00666   )
00667 {
00668   this->_deallocate_buffer ();
00669 }
00670 
00671 template <class T, class T_var, size_t MAX> 
00672 ACE_INLINE
00673 TAO_Bounded_Valuetype_Sequence<T,T_var,MAX>::TAO_Bounded_Valuetype_Sequence (
00674     CORBA::ULong length,
00675     T **value,
00676     CORBA::Boolean release
00677   )
00678   : TAO_Bounded_Base_Sequence (MAX, length, value, release)
00679 {
00680 }
00681 
00682 template <class T, class T_var, size_t MAX> 
00683 ACE_INLINE 
00684 TAO_Valuetype_Manager<T,T_var>
00685 TAO_Bounded_Valuetype_Sequence<T, T_var, MAX>::operator[] (
00686     CORBA::ULong slot
00687   ) const
00688 {
00689   ACE_ASSERT (slot < this->maximum_);
00690   T **const tmp = ACE_reinterpret_cast (T ** ACE_CAST_CONST, this->buffer_);
00691   return TAO_Valuetype_Manager<T,T_var> (tmp + slot, this->release_);
00692 }
00693 
00694 // *************************************************************
00695 // class TAO_Unbounded_Abstract_Sequence
00696 // *************************************************************
00697 
00698 //default constructor
00699 template <class T, class T_var> 
00700 ACE_INLINE
00701 TAO_Unbounded_Abstract_Sequence<T,T_var>::TAO_Unbounded_Abstract_Sequence (
00702     void
00703   )
00704 {
00705 }
00706 
00707 template <class T, class T_var> 
00708 ACE_INLINE
00709 TAO_Unbounded_Abstract_Sequence<T,T_var>::TAO_Unbounded_Abstract_Sequence (
00710     CORBA::ULong maximum,
00711     CORBA::ULong length,
00712     T* *value,
00713     CORBA::Boolean release
00714   )
00715   : TAO_Unbounded_Base_Sequence (maximum, length, value, release)
00716 {
00717 }
00718 
00719 template <class T, class T_var> 
00720 ACE_INLINE 
00721 TAO_Abstract_Manager<T,T_var>
00722 TAO_Unbounded_Abstract_Sequence<T,T_var>::operator[] (CORBA::ULong slot) const
00723 {
00724   ACE_ASSERT (slot < this->maximum_);
00725   T ** const tmp = ACE_reinterpret_cast (T ** ACE_CAST_CONST, this->buffer_);
00726   return TAO_Abstract_Manager<T,T_var> (tmp + slot, this->release_);
00727 }
00728 
00729 // *************************************************************
00730 // class TAO_Bounded_Abstract_Sequence
00731 // *************************************************************
00732 
00733 template<class T, class T_var, size_t MAX> 
00734 ACE_INLINE
00735 TAO_Bounded_Abstract_Sequence<T,T_var,MAX>::~TAO_Bounded_Abstract_Sequence (
00736     void
00737   )
00738 {
00739   this->_deallocate_buffer ();
00740 }
00741 
00742 template <class T, class T_var, size_t MAX> ACE_INLINE
00743 TAO_Bounded_Abstract_Sequence<T,T_var,MAX>::TAO_Bounded_Abstract_Sequence (
00744     CORBA::ULong length,
00745     T **value,
00746     CORBA::Boolean release
00747   )
00748   : TAO_Bounded_Base_Sequence (MAX, length, value, release)
00749 {
00750 }
00751 
00752 template <class T, class T_var, size_t MAX> 
00753 ACE_INLINE 
00754 TAO_Abstract_Manager<T,T_var>
00755 TAO_Bounded_Abstract_Sequence<T, T_var, MAX>::operator[] (
00756     CORBA::ULong slot
00757   ) const
00758 {
00759   ACE_ASSERT (slot < this->maximum_);
00760   T **const tmp = ACE_reinterpret_cast (T ** ACE_CAST_CONST, this->buffer_);
00761   return TAO_Abstract_Manager<T,T_var> (tmp + slot, this->release_);
00762 }
00763 
00764 // *************************************************************
00765 // class TAO_Unbounded_Array_Sequence
00766 // *************************************************************
00767 
00768 template <class T, class T_var> ACE_INLINE void
00769 TAO_Unbounded_Array_Sequence<T, T_var>::freebuf (T *buffer)
00770 {
00771   if (buffer == 0)
00772     return;
00773 
00774   delete [] buffer;
00775 }
00776 
00777 //default constructor
00778 template <class T, class T_var> ACE_INLINE
00779 TAO_Unbounded_Array_Sequence<T, T_var>::TAO_Unbounded_Array_Sequence (void)
00780 {
00781 }
00782 
00783 template <class T, class T_var> ACE_INLINE
00784 
00785 TAO_Unbounded_Array_Sequence<T, T_var>::TAO_Unbounded_Array_Sequence (CORBA::ULong maximum)
00786   : TAO_Unbounded_Base_Sequence (maximum,
00787                                  TAO_Unbounded_Array_Sequence<T, T_var>::allocbuf (maximum))
00788 {
00789 }
00790 
00791 template <class T, class T_var> ACE_INLINE
00792 
00793 TAO_Unbounded_Array_Sequence<T, T_var>::TAO_Unbounded_Array_Sequence (CORBA::ULong maximum,
00794                               CORBA::ULong length,
00795                               T *value,
00796                               CORBA::Boolean release)
00797   : TAO_Unbounded_Base_Sequence (maximum, length, value, release)
00798 {
00799 }
00800 
00801 template <class T, class T_var> ACE_INLINE T &
00802 TAO_Unbounded_Array_Sequence<T, T_var>::operator[] (CORBA::ULong i)
00803 {
00804   ACE_ASSERT (i < this->maximum_);
00805 
00806 #if defined (__SUNPRO_CC) && (__SUNPRO_CC < 0x500)
00807   return ((T*) this->buffer_)[i];
00808 #else /* (__SUNPRO_CC) && (__SUNPRO_CC < 0x500) */
00809   return (ACE_reinterpret_cast (T*, this->buffer_))[i];
00810 #endif /* (__SUNPRO_CC) && (__SUNPRO_CC < 0x500) */
00811 }
00812 
00813 template <class T, class T_var> ACE_INLINE const T &
00814 TAO_Unbounded_Array_Sequence<T, T_var>::operator[] (CORBA::ULong i) const
00815 {
00816   ACE_ASSERT (i < this->maximum_);
00817 
00818 #if defined (__SUNPRO_CC) && (__SUNPRO_CC < 0x500)
00819   return ((const T* ACE_CAST_CONST) this->buffer_)[i];
00820 #else /* (__SUNPRO_CC) && (__SUNPRO_CC < 0x500) */
00821   return (ACE_reinterpret_cast (const T* ACE_CAST_CONST, this->buffer_))[i];
00822 #endif /* (__SUNPRO_CC) && (__SUNPRO_CC < 0x500) */
00823 }
00824 
00825 template <class T, class T_var> ACE_INLINE T *
00826 TAO_Unbounded_Array_Sequence<T, T_var>::get_buffer (CORBA::Boolean orphan)
00827 {
00828   T *result = 0;
00829   if (orphan == 0)
00830     {
00831       // We retain ownership.
00832 
00833       if (this->buffer_ == 0)
00834         {
00835           if (this->length_ > 0)
00836             {
00837               result = 
00838                 TAO_Unbounded_Array_Sequence<T, T_var>::allocbuf (
00839                     this->length_
00840                   );
00841               this->buffer_ = result;
00842               this->release_ = 1;
00843             }
00844         }
00845       else
00846         {
00847           result =
00848             ACE_reinterpret_cast (T*, 
00849                                   this->buffer_);
00850         }
00851     }
00852   else // if (orphan == 1)
00853     {
00854       if (this->release_ != 0)
00855         {
00856           // We set the state back to default and relinquish
00857           // ownership.
00858           result = ACE_reinterpret_cast (T*,
00859                                          this->buffer_);
00860           this->maximum_ = 0;
00861           this->length_ = 0;
00862           this->buffer_ = 0;
00863           this->release_ = 0;
00864         }
00865     }
00866   return result;
00867 }
00868 
00869 template <class T, class T_var> ACE_INLINE const T *
00870 TAO_Unbounded_Array_Sequence<T, T_var>::get_buffer (void) const
00871 {
00872   return ACE_reinterpret_cast (const T * ACE_CAST_CONST, 
00873                                this->buffer_);
00874 }
00875 
00876 template <class T, class T_var> ACE_INLINE void
00877 TAO_Unbounded_Array_Sequence<T, T_var>::replace (CORBA::ULong max,
00878                                                    CORBA::ULong length,
00879                                                    T *data,
00880                                                    CORBA::Boolean release)
00881 {
00882   this->maximum_ = max;
00883   this->length_ = length;
00884   if (this->buffer_ && this->release_ == 1)
00885     {
00886       T *tmp = ACE_reinterpret_cast (T*,
00887                                      this->buffer_);
00888       TAO_Unbounded_Array_Sequence<T, T_var>::freebuf (tmp);
00889     }
00890   this->buffer_ = data;
00891   this->release_ = release;
00892 }
00893 
00894 // *************************************************************
00895 // class TAO_Bounded_Array_Sequence
00896 // *************************************************************
00897 
00898 template <class T, class T_var, size_t MAX> ACE_INLINE void
00899 TAO_Bounded_Array_Sequence<T, T_var, MAX>::freebuf (T *buffer)
00900 {
00901   if (buffer == 0)
00902     return;
00903 
00904   delete [] buffer;
00905 }
00906 
00907 template <class T, class T_var, size_t MAX> ACE_INLINE
00908 
00909 TAO_Bounded_Array_Sequence<T, T_var, MAX>::TAO_Bounded_Array_Sequence (void)
00910   : TAO_Bounded_Base_Sequence (MAX, 0, allocbuf (MAX), 1)
00911 {
00912 }
00913 
00914 template <class T, class T_var, size_t MAX> ACE_INLINE
00915 
00916 TAO_Bounded_Array_Sequence<T, T_var, MAX>::TAO_Bounded_Array_Sequence (CORBA::ULong length,
00917                             T *data,
00918                             CORBA::Boolean release)
00919   : TAO_Bounded_Base_Sequence (MAX, length, data, release)
00920 {
00921 }
00922 
00923 template <class T, class T_var, size_t MAX> ACE_INLINE T &
00924 TAO_Bounded_Array_Sequence<T, T_var, MAX>::operator[] (CORBA::ULong i)
00925 {
00926   ACE_ASSERT (i < this->maximum_);
00927 
00928 #if defined (__SUNPRO_CC) && (__SUNPRO_CC < 0x500)
00929   return ((T*) this->buffer_)[i];
00930 #else /* (__SUNPRO_CC) && (__SUNPRO_CC < 0x500) */
00931   return (ACE_reinterpret_cast (T*, this->buffer_))[i];
00932 #endif /* (__SUNPRO_CC) && (__SUNPRO_CC < 0x500) */
00933 }
00934 
00935 template <class T, class T_var, size_t MAX> ACE_INLINE const T &
00936 TAO_Bounded_Array_Sequence<T, T_var, MAX>::operator[] (CORBA::ULong i) const
00937 {
00938   ACE_ASSERT (i < this->maximum_);
00939 
00940 #if defined (__SUNPRO_CC) && (__SUNPRO_CC < 0x500)
00941   return ((const T* ACE_CAST_CONST) this->buffer_)[i];
00942 #else /* (__SUNPRO_CC) && (__SUNPRO_CC < 0x500) */
00943   return (ACE_reinterpret_cast (const T* ACE_CAST_CONST, this->buffer_))[i];
00944 #endif /* (__SUNPRO_CC) && (__SUNPRO_CC < 0x500) */
00945 }
00946 
00947 template <class T, class T_var, size_t MAX> ACE_INLINE T *
00948 TAO_Bounded_Array_Sequence<T, T_var, MAX>::get_buffer (CORBA::Boolean orphan)
00949 {
00950   T *result = 0;
00951   if (orphan == 0)
00952     {
00953       // We retain ownership.
00954 
00955       if (this->buffer_ == 0)
00956         {
00957           result = 
00958             TAO_Bounded_Array_Sequence<T, T_var, MAX>::allocbuf (this->maximum_);
00959           this->buffer_ = result;
00960           this->release_ = 1;
00961         }
00962       else
00963         {
00964           result =
00965             ACE_reinterpret_cast (T*, this->buffer_);
00966         }
00967     }
00968   else // if (orphan == 1)
00969     {
00970       if (this->release_ != 0)
00971         {
00972           // We set the state back to default and relinquish
00973           // ownership.
00974           result = ACE_reinterpret_cast(T*,this->buffer_);
00975           this->maximum_ = 0;
00976           this->length_ = 0;
00977           this->buffer_ = 0;
00978           this->release_ = 0;
00979         }
00980     }
00981   return result;
00982 }
00983 
00984 template <class T, class T_var, size_t MAX> ACE_INLINE const T *
00985 TAO_Bounded_Array_Sequence<T, T_var, MAX>::get_buffer (void) const
00986 {
00987   return ACE_reinterpret_cast (const T * ACE_CAST_CONST, 
00988                                this->buffer_);
00989 }
00990 
00991 template <class T, class T_var, size_t MAX> ACE_INLINE void
00992 TAO_Bounded_Array_Sequence<T, T_var, MAX>::replace (CORBA::ULong max,
00993                                                       CORBA::ULong length,
00994                                                       T *data,
00995                                                       CORBA::Boolean release)
00996 {
00997   this->maximum_ = max;
00998   this->length_ = length;
00999   if (this->buffer_ && this->release_ == 1)
01000     {
01001       T* tmp = ACE_reinterpret_cast (T*, 
01002                                      this->buffer_);
01003       TAO_Bounded_Array_Sequence<T, T_var, MAX>::freebuf (tmp);
01004     }
01005   this->buffer_ = data;
01006   this->release_ = release;
01007 }
01008 
01009 // *************************************************************
01010 // class TAO_Bounded_String_Sequence
01011 // *************************************************************
01012 
01013 template<size_t MAX> ACE_INLINE
01014 TAO_Bounded_String_Sequence<MAX>::~TAO_Bounded_String_Sequence (void)
01015 {
01016   this->_deallocate_buffer ();
01017 }
01018 
01019 template<size_t MAX> ACE_INLINE
01020 
01021 TAO_Bounded_String_Sequence<MAX>::TAO_Bounded_String_Sequence (CORBA::ULong length,
01022                              char **value,
01023                              CORBA::Boolean release)
01024   : TAO_Bounded_Base_Sequence (MAX, length, value, release)
01025 {
01026 }
01027 
01028 // *************************************************************
01029 // class TAO_Bounded_WString_Sequence
01030 // *************************************************************
01031 
01032 template<size_t MAX> ACE_INLINE
01033 TAO_Bounded_WString_Sequence<MAX>::~TAO_Bounded_WString_Sequence (void)
01034 {
01035   this->_deallocate_buffer ();
01036 }
01037 
01038 template<size_t MAX> ACE_INLINE
01039 
01040 TAO_Bounded_WString_Sequence<MAX>::TAO_Bounded_WString_Sequence (CORBA::ULong length,
01041                               CORBA::WChar **value,
01042                               CORBA::Boolean release)
01043   : TAO_Bounded_Base_Sequence (MAX, length, value, release)
01044 {
01045 }

Generated on Mon Jun 16 13:49:49 2003 for TAO by doxygen1.2.14 written by Dimitri van Heesch, © 1997-2002