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

PortableInterceptor::_TAO_Unbounded_Valuetype_Sequence_PortableInterceptor_ObjectReferenceTemplateSeq Class Reference

#include <ObjectReferenceTemplateC.h>

Inheritance diagram for PortableInterceptor::_TAO_Unbounded_Valuetype_Sequence_PortableInterceptor_ObjectReferenceTemplateSeq:

Inheritance graph
[legend]
Collaboration diagram for PortableInterceptor::_TAO_Unbounded_Valuetype_Sequence_PortableInterceptor_ObjectReferenceTemplateSeq:

Collaboration graph
[legend]
List of all members.

Public Methods

 _TAO_Unbounded_Valuetype_Sequence_PortableInterceptor_ObjectReferenceTemplateSeq (void)
 _TAO_Unbounded_Valuetype_Sequence_PortableInterceptor_ObjectReferenceTemplateSeq (CORBA::ULong maximum)
 _TAO_Unbounded_Valuetype_Sequence_PortableInterceptor_ObjectReferenceTemplateSeq (CORBA::ULong maximum, CORBA::ULong length, ObjectReferenceTemplate **value, CORBA::Boolean release=0)
 _TAO_Unbounded_Valuetype_Sequence_PortableInterceptor_ObjectReferenceTemplateSeq (const _TAO_Unbounded_Valuetype_Sequence_PortableInterceptor_ObjectReferenceTemplateSeq &rhs)
_TAO_Unbounded_Valuetype_Sequence_PortableInterceptor_ObjectReferenceTemplateSeq & operator= (const _TAO_Unbounded_Valuetype_Sequence_PortableInterceptor_ObjectReferenceTemplateSeq &rhs)
virtual ~_TAO_Unbounded_Valuetype_Sequence_PortableInterceptor_ObjectReferenceTemplateSeq (void)
TAO_Valuetype_Manager< PortableInterceptor::ObjectReferenceTemplate,
PortableInterceptor::ObjectReferenceTemplate_var
operator[] (CORBA::ULong index) const
virtual void _allocate_buffer (CORBA::ULong length)
virtual void _deallocate_buffer (void)
 Must deallocate the buffer and then set it to zero. More...

ObjectReferenceTemplate ** get_buffer (CORBA::Boolean orphan=0)
const ObjectReferenceTemplate ** get_buffer (void) const
virtual void _shrink_buffer (CORBA::ULong nl, CORBA::ULong ol)

Static Public Methods

ObjectReferenceTemplate ** allocbuf (CORBA::ULong nelems)
void freebuf (ObjectReferenceTemplate **buffer)

Constructor & Destructor Documentation

ACE_INLINE PortableInterceptor::_TAO_Unbounded_Valuetype_Sequence_PortableInterceptor_ObjectReferenceTemplateSeq::_TAO_Unbounded_Valuetype_Sequence_PortableInterceptor_ObjectReferenceTemplateSeq void   
 

Definition at line 80 of file ObjectReferenceTemplateC.i.

00081 {
00082 }

ACE_INLINE PortableInterceptor::_TAO_Unbounded_Valuetype_Sequence_PortableInterceptor_ObjectReferenceTemplateSeq::_TAO_Unbounded_Valuetype_Sequence_PortableInterceptor_ObjectReferenceTemplateSeq CORBA::ULong    maximum
 

Definition at line 85 of file ObjectReferenceTemplateC.i.

00086   : TAO_Unbounded_Base_Sequence (maximum, _TAO_Unbounded_Valuetype_Sequence_PortableInterceptor_ObjectReferenceTemplateSeq::allocbuf (maximum))
00087 {
00088 }

ACE_INLINE PortableInterceptor::_TAO_Unbounded_Valuetype_Sequence_PortableInterceptor_ObjectReferenceTemplateSeq::_TAO_Unbounded_Valuetype_Sequence_PortableInterceptor_ObjectReferenceTemplateSeq CORBA::ULong    maximum,
CORBA::ULong    length,
ObjectReferenceTemplate **    value,
CORBA::Boolean    release = 0
 

Definition at line 91 of file ObjectReferenceTemplateC.i.

00095 : TAO_Unbounded_Base_Sequence (maximum, length, value, release)
00096 {
00097 }

ACE_INLINE PortableInterceptor::_TAO_Unbounded_Valuetype_Sequence_PortableInterceptor_ObjectReferenceTemplateSeq::_TAO_Unbounded_Valuetype_Sequence_PortableInterceptor_ObjectReferenceTemplateSeq const _TAO_Unbounded_Valuetype_Sequence_PortableInterceptor_ObjectReferenceTemplateSeq &    rhs
 

Definition at line 100 of file ObjectReferenceTemplateC.i.

References CORBA_ValueBase::_add_ref, and TAO_Base_Sequence::buffer_.

00101   : TAO_Unbounded_Base_Sequence (rhs)
00102 {
00103   if (rhs.buffer_ != 0)
00104   {
00105     PortableInterceptor::ObjectReferenceTemplate **tmp1 = _TAO_Unbounded_Valuetype_Sequence_PortableInterceptor_ObjectReferenceTemplateSeq::allocbuf (this->maximum_);
00106     PortableInterceptor::ObjectReferenceTemplate ** const tmp2 = ACE_reinterpret_cast (PortableInterceptor::ObjectReferenceTemplate ** ACE_CAST_CONST, rhs.buffer_);
00107     
00108     for (CORBA::ULong i = 0; i < rhs.length_; ++i)
00109       {
00110         if (tmp2[i] != 0)
00111           tmp2[i]->_add_ref ();
00112         tmp1[i] = tmp2 [i];
00113       }
00114     
00115     this->buffer_ = tmp1;
00116   }
00117   else
00118   {
00119     this->buffer_ = 0;
00120   }
00121 }

PortableInterceptor::_TAO_Unbounded_Valuetype_Sequence_PortableInterceptor_ObjectReferenceTemplateSeq::~_TAO_Unbounded_Valuetype_Sequence_PortableInterceptor_ObjectReferenceTemplateSeq void    [virtual]
 

Definition at line 961 of file ObjectReferenceTemplateC.cpp.

References _deallocate_buffer.

00962 {
00963   this->_deallocate_buffer ();
00964 }


Member Function Documentation

void PortableInterceptor::_TAO_Unbounded_Valuetype_Sequence_PortableInterceptor_ObjectReferenceTemplateSeq::_allocate_buffer CORBA::ULong    length [virtual]
 

Ensure that the buffer contains space for at least <length> elements. The constructor must be called for any new elements, the old ones (if any) must be copied into the buffer using operator= and then their destructors must be called. Finally the old buffer must be released.

Implements TAO_Base_Sequence.

Definition at line 913 of file ObjectReferenceTemplateC.cpp.

References CORBA_ValueBase::_add_ref, TAO_Base_Sequence::buffer_, TAO_Unbounded_Base_Sequence::length, TAO_Base_Sequence::length_, and TAO_Base_Sequence::release_.

00914 {
00915   PortableInterceptor::ObjectReferenceTemplate **tmp = 0;
00916   tmp = _TAO_Unbounded_Valuetype_Sequence_PortableInterceptor_ObjectReferenceTemplateSeq::allocbuf (length);
00917 
00918   if (this->buffer_ != 0)
00919   {
00920     PortableInterceptor::ObjectReferenceTemplate **old = ACE_reinterpret_cast (PortableInterceptor::ObjectReferenceTemplate**, this->buffer_);
00921     for (CORBA::ULong i = 0; i < this->length_; ++i)
00922       {
00923         if (!this->release_)
00924           {
00925             if (old[i] != 0)
00926               old[i]->_add_ref ();
00927             tmp[i] = old[i];
00928           }
00929         else
00930           {
00931             tmp[i] = old[i];
00932           }
00933       }
00934 
00935     if (this->release_)
00936       {
00937         delete[] old;
00938       }
00939   }
00940   this->buffer_ = tmp;
00941 }

void PortableInterceptor::_TAO_Unbounded_Valuetype_Sequence_PortableInterceptor_ObjectReferenceTemplateSeq::_deallocate_buffer void    [virtual]
 

Must deallocate the buffer and then set it to zero.

Implements TAO_Base_Sequence.

Definition at line 944 of file ObjectReferenceTemplateC.cpp.

References CORBA_ValueBase::_remove_ref, TAO_Base_Sequence::buffer_, TAO_Base_Sequence::length_, and TAO_Base_Sequence::release_.

Referenced by ~_TAO_Unbounded_Valuetype_Sequence_PortableInterceptor_ObjectReferenceTemplateSeq.

00945 {
00946   if (this->buffer_ == 0 || this->release_ == 0)
00947     return;
00948   PortableInterceptor::ObjectReferenceTemplate **tmp = ACE_reinterpret_cast (PortableInterceptor::ObjectReferenceTemplate**, this->buffer_);
00949 
00950   for (CORBA::ULong i = 0; i < this->length_; ++i)
00951     {
00952       if (tmp[i] != 0)
00953         tmp[i]->_remove_ref ();
00954       tmp[i] = 0;
00955     }
00956 
00957   _TAO_Unbounded_Valuetype_Sequence_PortableInterceptor_ObjectReferenceTemplateSeq::freebuf (tmp);
00958   this->buffer_ = 0;
00959 }

void PortableInterceptor::_TAO_Unbounded_Valuetype_Sequence_PortableInterceptor_ObjectReferenceTemplateSeq::_shrink_buffer CORBA::ULong    nl,
CORBA::ULong    ol
[virtual]
 

Some sequences (of objects and strings) require some cleanup if the sequence is shrunk. The spec requires the destructor to release the objects only from position <0> to <length-1>; so shrink and then delete could result in a memory leak.

Reimplemented from TAO_Base_Sequence.

Definition at line 967 of file ObjectReferenceTemplateC.cpp.

References CORBA_ValueBase::_remove_ref.

00968 {
00969   PortableInterceptor::ObjectReferenceTemplate **tmp = ACE_reinterpret_cast (PortableInterceptor::ObjectReferenceTemplate**, this->buffer_);
00970 
00971   for (CORBA::ULong i = nl; i < ol; ++i)
00972     {
00973       if (tmp[i] != 0)
00974         tmp[i]->_remove_ref ();
00975       tmp[i] = 0;
00976     }
00977 }

ACE_INLINE PortableInterceptor::ObjectReferenceTemplate ** PortableInterceptor::_TAO_Unbounded_Valuetype_Sequence_PortableInterceptor_ObjectReferenceTemplateSeq::allocbuf CORBA::ULong    nelems [static]
 

Definition at line 57 of file ObjectReferenceTemplateC.i.

References ACE_NEW_RETURN.

00058 {
00059   PortableInterceptor::ObjectReferenceTemplate **buf = 0;
00060   
00061   ACE_NEW_RETURN (buf, PortableInterceptor::ObjectReferenceTemplate*[nelems], 0);
00062   
00063   for (CORBA::ULong i = 0; i < nelems; i++)
00064     {
00065       buf[i] = 0;
00066     }
00067   
00068   return buf;
00069 }

ACE_INLINE void PortableInterceptor::_TAO_Unbounded_Valuetype_Sequence_PortableInterceptor_ObjectReferenceTemplateSeq::freebuf ObjectReferenceTemplate **    buffer [static]
 

Definition at line 72 of file ObjectReferenceTemplateC.i.

00073 {
00074   if (buffer == 0)
00075     return;
00076   delete[] buffer;
00077 }

ACE_INLINE const PortableInterceptor::ObjectReferenceTemplate ** PortableInterceptor::_TAO_Unbounded_Valuetype_Sequence_PortableInterceptor_ObjectReferenceTemplateSeq::get_buffer void    const
 

Definition at line 207 of file ObjectReferenceTemplateC.i.

00208 {
00209   return ACE_reinterpret_cast(const PortableInterceptor::ObjectReferenceTemplate ** ACE_CAST_CONST, this->buffer_);
00210 }

ACE_INLINE PortableInterceptor::ObjectReferenceTemplate ** PortableInterceptor::_TAO_Unbounded_Valuetype_Sequence_PortableInterceptor_ObjectReferenceTemplateSeq::get_buffer CORBA::Boolean    orphan = 0
 

Definition at line 173 of file ObjectReferenceTemplateC.i.

References TAO_Base_Sequence::buffer_, TAO_Base_Sequence::length_, TAO_Base_Sequence::maximum_, and TAO_Base_Sequence::release_.

00174 {
00175   PortableInterceptor::ObjectReferenceTemplate **result = 0;
00176   if (orphan == 0)
00177   {
00178     // We retain ownership.
00179     if (this->buffer_ == 0)
00180     {
00181       result = _TAO_Unbounded_Valuetype_Sequence_PortableInterceptor_ObjectReferenceTemplateSeq::allocbuf (this->maximum_);
00182       this->buffer_ = result;
00183       this->release_ = 1;
00184     }
00185     else
00186     {
00187       result = ACE_reinterpret_cast (PortableInterceptor::ObjectReferenceTemplate**, this->buffer_);
00188     }
00189   }
00190   else // if (orphan == 1)
00191   {
00192     if (this->release_ != 0)
00193     {
00194       // We set the state back to default and relinquish
00195       // ownership.
00196       result = ACE_reinterpret_cast(PortableInterceptor::ObjectReferenceTemplate**,this->buffer_);
00197       this->maximum_ = 0;
00198       this->length_ = 0;
00199       this->buffer_ = 0;
00200       this->release_ = 0;
00201     }
00202   }
00203   return result;
00204 }

ACE_INLINE PortableInterceptor::_TAO_Unbounded_Valuetype_Sequence_PortableInterceptor_ObjectReferenceTemplateSeq & PortableInterceptor::_TAO_Unbounded_Valuetype_Sequence_PortableInterceptor_ObjectReferenceTemplateSeq::operator= const _TAO_Unbounded_Valuetype_Sequence_PortableInterceptor_ObjectReferenceTemplateSeq &    rhs
 

Definition at line 124 of file ObjectReferenceTemplateC.i.

References CORBA_ValueBase::_add_ref, CORBA_ValueBase::_remove_ref, TAO_Base_Sequence::buffer_, TAO_Base_Sequence::length_, TAO_Base_Sequence::maximum_, TAO_Base_Sequence::operator=, and TAO_Base_Sequence::release_.

00125 {
00126   if (this == &rhs)
00127     return *this;
00128   
00129   if (this->release_)
00130   {
00131     PortableInterceptor::ObjectReferenceTemplate **tmp = ACE_reinterpret_cast (PortableInterceptor::ObjectReferenceTemplate **, this->buffer_);
00132     
00133     for (CORBA::ULong i = 0; i < this->length_; ++i)
00134     {
00135       if (tmp[i] != 0)
00136         tmp[i]->_remove_ref ();
00137       tmp[i] = 0;
00138     }
00139     if (this->maximum_ < rhs.maximum_)
00140     {
00141       _TAO_Unbounded_Valuetype_Sequence_PortableInterceptor_ObjectReferenceTemplateSeq::freebuf (tmp);
00142       this->buffer_ = _TAO_Unbounded_Valuetype_Sequence_PortableInterceptor_ObjectReferenceTemplateSeq::allocbuf (rhs.maximum_);
00143     }
00144   }
00145   else
00146     this->buffer_ = _TAO_Unbounded_Valuetype_Sequence_PortableInterceptor_ObjectReferenceTemplateSeq::allocbuf (rhs.maximum_);
00147   
00148   TAO_Unbounded_Base_Sequence::operator= (rhs);
00149   
00150   PortableInterceptor::ObjectReferenceTemplate **tmp1 = ACE_reinterpret_cast (PortableInterceptor::ObjectReferenceTemplate **, this->buffer_);
00151   PortableInterceptor::ObjectReferenceTemplate ** const tmp2 = ACE_reinterpret_cast (PortableInterceptor::ObjectReferenceTemplate ** ACE_CAST_CONST, rhs.buffer_);
00152   
00153   for (CORBA::ULong i = 0; i < rhs.length_; ++i)
00154     {
00155       if (tmp2[i] != 0)
00156         tmp2[i]->_add_ref ();
00157       tmp1[i] = tmp2 [i];
00158     }
00159   
00160   return *this;
00161 }

ACE_INLINE TAO_Valuetype_Manager< PortableInterceptor::ObjectReferenceTemplate, PortableInterceptor::ObjectReferenceTemplate_var > PortableInterceptor::_TAO_Unbounded_Valuetype_Sequence_PortableInterceptor_ObjectReferenceTemplateSeq::operator[] CORBA::ULong    index const
 

Definition at line 164 of file ObjectReferenceTemplateC.i.

References ACE_ASSERT.

00166 {
00167   ACE_ASSERT (index < this->maximum_);
00168   PortableInterceptor::ObjectReferenceTemplate ** const tmp = ACE_reinterpret_cast (PortableInterceptor::ObjectReferenceTemplate ** ACE_CAST_CONST, this->buffer_);
00169   return TAO_Valuetype_Manager<PortableInterceptor::ObjectReferenceTemplate,PortableInterceptor::ObjectReferenceTemplate_var> (tmp + index, this->release_);
00170 }


The documentation for this class was generated from the following files:
Generated on Mon Jun 16 16:03:12 2003 for TAO by doxygen1.2.14 written by Dimitri van Heesch, © 1997-2002