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

CORBA::_TAO_Unbounded_Object_Sequence_CORBA_PolicyList Class Reference

#include <Policy_ForwardC.h>

Inheritance diagram for CORBA::_TAO_Unbounded_Object_Sequence_CORBA_PolicyList:

Inheritance graph
[legend]
Collaboration diagram for CORBA::_TAO_Unbounded_Object_Sequence_CORBA_PolicyList:

Collaboration graph
[legend]
List of all members.

Public Methods

 _TAO_Unbounded_Object_Sequence_CORBA_PolicyList (void)
 _TAO_Unbounded_Object_Sequence_CORBA_PolicyList (CORBA::ULong maximum)
 _TAO_Unbounded_Object_Sequence_CORBA_PolicyList (CORBA::ULong maximum, CORBA::ULong length, Policy **value, CORBA::Boolean release=0)
 _TAO_Unbounded_Object_Sequence_CORBA_PolicyList (const _TAO_Unbounded_Object_Sequence_CORBA_PolicyList &rhs)
_TAO_Unbounded_Object_Sequence_CORBA_PolicyList & operator= (const _TAO_Unbounded_Object_Sequence_CORBA_PolicyList &rhs)
virtual ~_TAO_Unbounded_Object_Sequence_CORBA_PolicyList (void)
TAO_Object_Manager< CORBA::Policy,
CORBA::Policy_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...

Policy ** get_buffer (CORBA::Boolean orphan=0)
const Policy ** get_buffer (void) const
virtual void _shrink_buffer (CORBA::ULong nl, CORBA::ULong ol)
virtual void _downcast (void *target, CORBA_Object *src ACE_ENV_ARG_DECL_WITH_DEFAULTS)
 Used for sequences of objects to downcast a recently demarshalled object reference into the right type. More...

virtual CORBA_Object_upcast (void *src) const
 Used for sequences of object to convert from the derived type into the Object class. More...


Static Public Methods

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

Constructor & Destructor Documentation

ACE_INLINE CORBA::_TAO_Unbounded_Object_Sequence_CORBA_PolicyList::_TAO_Unbounded_Object_Sequence_CORBA_PolicyList void   
 

Definition at line 52 of file Policy_ForwardC.i.

00053 {
00054 }

ACE_INLINE CORBA::_TAO_Unbounded_Object_Sequence_CORBA_PolicyList::_TAO_Unbounded_Object_Sequence_CORBA_PolicyList CORBA::ULong    maximum
 

Definition at line 57 of file Policy_ForwardC.i.

00058   : TAO_Unbounded_Base_Sequence (maximum, _TAO_Unbounded_Object_Sequence_CORBA_PolicyList::allocbuf (maximum))
00059 {
00060 }

ACE_INLINE CORBA::_TAO_Unbounded_Object_Sequence_CORBA_PolicyList::_TAO_Unbounded_Object_Sequence_CORBA_PolicyList CORBA::ULong    maximum,
CORBA::ULong    length,
Policy **    value,
CORBA::Boolean    release = 0
 

Definition at line 63 of file Policy_ForwardC.i.

00067 : TAO_Unbounded_Base_Sequence (maximum, length, value, release)
00068 {
00069 }

ACE_INLINE CORBA::_TAO_Unbounded_Object_Sequence_CORBA_PolicyList::_TAO_Unbounded_Object_Sequence_CORBA_PolicyList const _TAO_Unbounded_Object_Sequence_CORBA_PolicyList &    rhs
 

Definition at line 72 of file Policy_ForwardC.i.

References TAO_Base_Sequence::buffer_, and tao_CORBA_Policy_duplicate.

00073   : TAO_Unbounded_Base_Sequence (rhs)
00074 {
00075   if (rhs.buffer_ != 0)
00076   {
00077     CORBA::Policy **tmp1 = _TAO_Unbounded_Object_Sequence_CORBA_PolicyList::allocbuf (this->maximum_);
00078     CORBA::Policy ** const tmp2 = ACE_reinterpret_cast (CORBA::Policy ** ACE_CAST_CONST, rhs.buffer_);
00079     
00080     for (CORBA::ULong i = 0; i < rhs.length_; ++i)
00081       {
00082         tmp1[i] = tao_CORBA_Policy_duplicate (tmp2[i]);
00083       }
00084     
00085     this->buffer_ = tmp1;
00086   }
00087   else
00088   {
00089     this->buffer_ = 0;
00090   }
00091 }

CORBA::_TAO_Unbounded_Object_Sequence_CORBA_PolicyList::~_TAO_Unbounded_Object_Sequence_CORBA_PolicyList void    [virtual]
 

Definition at line 130 of file Policy_ForwardC.cpp.

References _deallocate_buffer.

00131 {
00132   this->_deallocate_buffer ();
00133 }


Member Function Documentation

void CORBA::_TAO_Unbounded_Object_Sequence_CORBA_PolicyList::_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 85 of file Policy_ForwardC.cpp.

References TAO_Base_Sequence::buffer_, TAO_Unbounded_Base_Sequence::length, TAO_Base_Sequence::length_, TAO_Base_Sequence::release_, and tao_CORBA_Policy_duplicate.

00086 {
00087   CORBA::Policy **tmp = 0;
00088   tmp = _TAO_Unbounded_Object_Sequence_CORBA_PolicyList::allocbuf (length);
00089   
00090   if (this->buffer_ != 0)
00091   {
00092     CORBA::Policy **old = ACE_reinterpret_cast (CORBA::Policy**, this->buffer_);
00093     for (CORBA::ULong i = 0; i < this->length_; ++i)
00094       {
00095         if (!this->release_)
00096           {
00097             tmp[i] = tao_CORBA_Policy_duplicate (old[i]);
00098           }
00099         else
00100           {
00101             tmp[i] = old[i];
00102           }
00103       }
00104     
00105     if (this->release_)
00106       {
00107         delete[] old;
00108       }
00109   }
00110   this->buffer_ = tmp;
00111 }

void CORBA::_TAO_Unbounded_Object_Sequence_CORBA_PolicyList::_deallocate_buffer void    [virtual]
 

Must deallocate the buffer and then set it to zero.

Implements TAO_Base_Sequence.

Definition at line 114 of file Policy_ForwardC.cpp.

References TAO_Base_Sequence::buffer_, TAO_Base_Sequence::length_, TAO_Base_Sequence::release_, tao_CORBA_Policy_nil, and tao_CORBA_Policy_release.

Referenced by ~_TAO_Unbounded_Object_Sequence_CORBA_PolicyList.

00115 {
00116   if (this->buffer_ == 0 || this->release_ == 0)
00117     return;
00118   CORBA::Policy **tmp = ACE_reinterpret_cast (CORBA::Policy**, this->buffer_);
00119   
00120   for (CORBA::ULong i = 0; i < this->length_; ++i)
00121     {
00122       tao_CORBA_Policy_release (tmp[i]);
00123       tmp[i] = tao_CORBA_Policy_nil ();
00124     }
00125   
00126   _TAO_Unbounded_Object_Sequence_CORBA_PolicyList::freebuf (tmp);
00127   this->buffer_ = 0;
00128 }

void CORBA::_TAO_Unbounded_Object_Sequence_CORBA_PolicyList::_downcast void *    target,
CORBA_Object *src    ACE_ENV_ARG_DECL_WITH_DEFAULTS
[virtual]
 

Used for sequences of objects to downcast a recently demarshalled object reference into the right type.

Reimplemented from TAO_Base_Sequence.

Definition at line 148 of file Policy_ForwardC.cpp.

References ACE_CHECK, ACE_ENV_ARG_DECL, ACE_ENV_ARG_PARAMETER, and tao_CORBA_Policy_narrow.

00153 {
00154   CORBA::Policy **tmp = ACE_static_cast (CORBA::Policy**, target);
00155   *tmp = tao_CORBA_Policy_narrow (src ACE_ENV_ARG_PARAMETER);
00156   ACE_CHECK;
00157 }

void CORBA::_TAO_Unbounded_Object_Sequence_CORBA_PolicyList::_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 136 of file Policy_ForwardC.cpp.

References tao_CORBA_Policy_nil, and tao_CORBA_Policy_release.

00137 {
00138   CORBA::Policy **tmp = ACE_reinterpret_cast (CORBA::Policy**, this->buffer_);
00139   
00140   for (CORBA::ULong i = nl; i < ol; ++i)
00141     {
00142       tao_CORBA_Policy_release (tmp[i]);
00143       tmp[i] = tao_CORBA_Policy_nil ();
00144     }
00145 }

CORBA_Object * CORBA::_TAO_Unbounded_Object_Sequence_CORBA_PolicyList::_upcast void *    src const [virtual]
 

Used for sequences of object to convert from the derived type into the Object class.

Reimplemented from TAO_Base_Sequence.

Definition at line 160 of file Policy_ForwardC.cpp.

References tao_CORBA_Policy_upcast.

00161 {
00162   return tao_CORBA_Policy_upcast (src);
00163 }

ACE_INLINE CORBA::Policy ** CORBA::_TAO_Unbounded_Object_Sequence_CORBA_PolicyList::allocbuf CORBA::ULong    nelems [static]
 

Definition at line 29 of file Policy_ForwardC.i.

References ACE_NEW_RETURN, and tao_CORBA_Policy_nil.

00030 {
00031   CORBA::Policy **buf = 0;
00032   
00033   ACE_NEW_RETURN (buf, CORBA::Policy*[nelems], 0);
00034   
00035   for (CORBA::ULong i = 0; i < nelems; i++)
00036     {
00037       buf[i] = tao_CORBA_Policy_nil ();
00038     }
00039   
00040   return buf;
00041 }

ACE_INLINE void CORBA::_TAO_Unbounded_Object_Sequence_CORBA_PolicyList::freebuf Policy **    buffer [static]
 

Definition at line 44 of file Policy_ForwardC.i.

00045 {
00046   if (buffer == 0)
00047     return;
00048   delete[] buffer;
00049 }

ACE_INLINE const CORBA::Policy ** CORBA::_TAO_Unbounded_Object_Sequence_CORBA_PolicyList::get_buffer void    const
 

Definition at line 174 of file Policy_ForwardC.i.

00175 {
00176   return ACE_reinterpret_cast(const CORBA::Policy ** ACE_CAST_CONST, this->buffer_);
00177 }

ACE_INLINE CORBA::Policy ** CORBA::_TAO_Unbounded_Object_Sequence_CORBA_PolicyList::get_buffer CORBA::Boolean    orphan = 0
 

Definition at line 140 of file Policy_ForwardC.i.

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

00141 {
00142   CORBA::Policy **result = 0;
00143   if (orphan == 0)
00144   {
00145     // We retain ownership.
00146     if (this->buffer_ == 0)
00147     {
00148       result = _TAO_Unbounded_Object_Sequence_CORBA_PolicyList::allocbuf (this->maximum_);
00149       this->buffer_ = result;
00150       this->release_ = 1;
00151     }
00152     else
00153     {
00154       result = ACE_reinterpret_cast (CORBA::Policy**, this->buffer_);
00155     }
00156   }
00157   else // if (orphan == 1)
00158   {
00159     if (this->release_ != 0)
00160     {
00161       // We set the state back to default and relinquish
00162       // ownership.
00163       result = ACE_reinterpret_cast(CORBA::Policy**,this->buffer_);
00164       this->maximum_ = 0;
00165       this->length_ = 0;
00166       this->buffer_ = 0;
00167       this->release_ = 0;
00168     }
00169   }
00170   return result;
00171 }

ACE_INLINE CORBA::_TAO_Unbounded_Object_Sequence_CORBA_PolicyList & CORBA::_TAO_Unbounded_Object_Sequence_CORBA_PolicyList::operator= const _TAO_Unbounded_Object_Sequence_CORBA_PolicyList &    rhs
 

Definition at line 94 of file Policy_ForwardC.i.

References TAO_Base_Sequence::buffer_, TAO_Base_Sequence::length_, TAO_Base_Sequence::maximum_, TAO_Base_Sequence::operator=, TAO_Base_Sequence::release_, tao_CORBA_Policy_duplicate, tao_CORBA_Policy_nil, and tao_CORBA_Policy_release.

00095 {
00096   if (this == &rhs)
00097     return *this;
00098   
00099   if (this->release_)
00100   {
00101     CORBA::Policy **tmp = ACE_reinterpret_cast (CORBA::Policy **, this->buffer_);
00102     
00103     for (CORBA::ULong i = 0; i < this->length_; ++i)
00104     {
00105       tao_CORBA_Policy_release (tmp[i]);
00106       tmp[i] = tao_CORBA_Policy_nil ();
00107     }
00108     if (this->maximum_ < rhs.maximum_)
00109     {
00110       _TAO_Unbounded_Object_Sequence_CORBA_PolicyList::freebuf (tmp);
00111       this->buffer_ = _TAO_Unbounded_Object_Sequence_CORBA_PolicyList::allocbuf (rhs.maximum_);
00112     }
00113   }
00114   else
00115     this->buffer_ = _TAO_Unbounded_Object_Sequence_CORBA_PolicyList::allocbuf (rhs.maximum_);
00116   
00117   TAO_Unbounded_Base_Sequence::operator= (rhs);
00118   
00119   CORBA::Policy **tmp1 = ACE_reinterpret_cast (CORBA::Policy **, this->buffer_);
00120   CORBA::Policy ** const tmp2 = ACE_reinterpret_cast (CORBA::Policy ** ACE_CAST_CONST, rhs.buffer_);
00121   
00122   for (CORBA::ULong i = 0; i < rhs.length_; ++i)
00123     {
00124       tmp1[i] = tao_CORBA_Policy_duplicate (tmp2[i]);
00125     }
00126   
00127   return *this;
00128 }

ACE_INLINE TAO_Object_Manager< CORBA::Policy, CORBA::Policy_var > CORBA::_TAO_Unbounded_Object_Sequence_CORBA_PolicyList::operator[] CORBA::ULong    index const
 

Definition at line 131 of file Policy_ForwardC.i.

References ACE_ASSERT.

00133 {
00134   ACE_ASSERT (index < this->maximum_);
00135   CORBA::Policy ** const tmp = ACE_reinterpret_cast (CORBA::Policy ** ACE_CAST_CONST, this->buffer_);
00136   return TAO_Object_Manager<CORBA::Policy,CORBA::Policy_var> (tmp + index, this->release_);
00137 }


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