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

Dynamic::_TAO_Unbounded_Object_Sequence_Dynamic_ExceptionList Class Reference

#include <DynamicC.h>

Inheritance diagram for Dynamic::_TAO_Unbounded_Object_Sequence_Dynamic_ExceptionList:

Inheritance graph
[legend]
Collaboration diagram for Dynamic::_TAO_Unbounded_Object_Sequence_Dynamic_ExceptionList:

Collaboration graph
[legend]
List of all members.

Public Methods

 _TAO_Unbounded_Object_Sequence_Dynamic_ExceptionList (void)
 _TAO_Unbounded_Object_Sequence_Dynamic_ExceptionList (CORBA::ULong maximum)
 _TAO_Unbounded_Object_Sequence_Dynamic_ExceptionList (CORBA::ULong maximum, CORBA::ULong length, CORBA::TypeCode **value, CORBA::Boolean release=0)
 _TAO_Unbounded_Object_Sequence_Dynamic_ExceptionList (const _TAO_Unbounded_Object_Sequence_Dynamic_ExceptionList &rhs)
_TAO_Unbounded_Object_Sequence_Dynamic_ExceptionList & operator= (const _TAO_Unbounded_Object_Sequence_Dynamic_ExceptionList &rhs)
virtual ~_TAO_Unbounded_Object_Sequence_Dynamic_ExceptionList (void)
TAO_Pseudo_Object_Manager<
Dynamic::TypeCode, Dynamic::TypeCode_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...

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

Static Public Methods

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

Constructor & Destructor Documentation

Dynamic::_TAO_Unbounded_Object_Sequence_Dynamic_ExceptionList::_TAO_Unbounded_Object_Sequence_Dynamic_ExceptionList void   
 

Dynamic::_TAO_Unbounded_Object_Sequence_Dynamic_ExceptionList::_TAO_Unbounded_Object_Sequence_Dynamic_ExceptionList CORBA::ULong    maximum
 

Dynamic::_TAO_Unbounded_Object_Sequence_Dynamic_ExceptionList::_TAO_Unbounded_Object_Sequence_Dynamic_ExceptionList CORBA::ULong    maximum,
CORBA::ULong    length,
CORBA::TypeCode **    value,
CORBA::Boolean    release = 0
 

Dynamic::_TAO_Unbounded_Object_Sequence_Dynamic_ExceptionList::_TAO_Unbounded_Object_Sequence_Dynamic_ExceptionList const _TAO_Unbounded_Object_Sequence_Dynamic_ExceptionList &    rhs
 

Dynamic::_TAO_Unbounded_Object_Sequence_Dynamic_ExceptionList::~_TAO_Unbounded_Object_Sequence_Dynamic_ExceptionList void    [virtual]
 

Definition at line 452 of file DynamicC.cpp.

References _deallocate_buffer.

00453 {
00454   this->_deallocate_buffer ();
00455 }


Member Function Documentation

void Dynamic::_TAO_Unbounded_Object_Sequence_Dynamic_ExceptionList::_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 407 of file DynamicC.cpp.

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

00408 {
00409   CORBA::TypeCode **tmp = 0;
00410   tmp = _TAO_Unbounded_Object_Sequence_Dynamic_ExceptionList::allocbuf (length);
00411   
00412   if (this->buffer_ != 0)
00413   {
00414     CORBA::TypeCode **old = ACE_reinterpret_cast (CORBA::TypeCode**, this->buffer_);
00415     for (CORBA::ULong i = 0; i < this->length_; ++i)
00416       {
00417         if (!this->release_)
00418           {
00419             tmp[i] = CORBA::TypeCode::_duplicate (old[i]);
00420           }
00421         else
00422           {
00423             tmp[i] = old[i];
00424           }
00425       }
00426     
00427     if (this->release_)
00428       {
00429         delete[] old;
00430       }
00431   }
00432   this->buffer_ = tmp;
00433 }

void Dynamic::_TAO_Unbounded_Object_Sequence_Dynamic_ExceptionList::_deallocate_buffer void    [virtual]
 

Must deallocate the buffer and then set it to zero.

Implements TAO_Base_Sequence.

Definition at line 436 of file DynamicC.cpp.

References TAO_Base_Sequence::buffer_, TAO_Base_Sequence::length_, CORBA::release, and TAO_Base_Sequence::release_.

Referenced by ~_TAO_Unbounded_Object_Sequence_Dynamic_ExceptionList.

00437 {
00438   if (this->buffer_ == 0 || this->release_ == 0)
00439     return;
00440   CORBA::TypeCode **tmp = ACE_reinterpret_cast (CORBA::TypeCode**, this->buffer_);
00441   
00442   for (CORBA::ULong i = 0; i < this->length_; ++i)
00443     {
00444       CORBA::release (tmp[i]);
00445       tmp[i] = CORBA::TypeCode::_nil ();
00446     }
00447   
00448   _TAO_Unbounded_Object_Sequence_Dynamic_ExceptionList::freebuf (tmp);
00449   this->buffer_ = 0;
00450 }

void Dynamic::_TAO_Unbounded_Object_Sequence_Dynamic_ExceptionList::_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 458 of file DynamicC.cpp.

References CORBA::release.

00459 {
00460   CORBA::TypeCode **tmp = ACE_reinterpret_cast (CORBA::TypeCode**, this->buffer_);
00461   
00462   for (CORBA::ULong i = nl; i < ol; ++i)
00463     {
00464       CORBA::release (tmp[i]);
00465       tmp[i] = CORBA::TypeCode::_nil ();
00466     }
00467 }

CORBA::TypeCode** Dynamic::_TAO_Unbounded_Object_Sequence_Dynamic_ExceptionList::allocbuf CORBA::ULong    nelems [static]
 

void Dynamic::_TAO_Unbounded_Object_Sequence_Dynamic_ExceptionList::freebuf CORBA::TypeCode **    buffer [static]
 

ACE_INLINE const CORBA::TypeCode ** Dynamic::_TAO_Unbounded_Object_Sequence_Dynamic_ExceptionList::get_buffer void    const
 

Definition at line 761 of file DynamicC.i.

00762 {
00763   return ACE_reinterpret_cast(const CORBA::TypeCode ** ACE_CAST_CONST, this->buffer_);
00764 }

ACE_INLINE CORBA::TypeCode ** Dynamic::_TAO_Unbounded_Object_Sequence_Dynamic_ExceptionList::get_buffer CORBA::Boolean    orphan = 0
 

Definition at line 727 of file DynamicC.i.

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

00728 {
00729   CORBA::TypeCode **result = 0;
00730   if (orphan == 0)
00731   {
00732     // We retain ownership.
00733     if (this->buffer_ == 0)
00734     {
00735       result = _TAO_Unbounded_Object_Sequence_Dynamic_ExceptionList::allocbuf (this->maximum_);
00736       this->buffer_ = result;
00737       this->release_ = 1;
00738     }
00739     else
00740     {
00741       result = ACE_reinterpret_cast (CORBA::TypeCode**, this->buffer_);
00742     }
00743   }
00744   else // if (orphan == 1)
00745   {
00746     if (this->release_ != 0)
00747     {
00748       // We set the state back to default and relinquish
00749       // ownership.
00750       result = ACE_reinterpret_cast(CORBA::TypeCode**,this->buffer_);
00751       this->maximum_ = 0;
00752       this->length_ = 0;
00753       this->buffer_ = 0;
00754       this->release_ = 0;
00755     }
00756   }
00757   return result;
00758 }

_TAO_Unbounded_Object_Sequence_Dynamic_ExceptionList& Dynamic::_TAO_Unbounded_Object_Sequence_Dynamic_ExceptionList::operator= const _TAO_Unbounded_Object_Sequence_Dynamic_ExceptionList &    rhs
 

Dynamic::TypeCode_var Dynamic::_TAO_Unbounded_Object_Sequence_Dynamic_ExceptionList::operator[] CORBA::ULong    index const
 

Definition at line 718 of file DynamicC.i.

References ACE_ASSERT.

00720 {
00721   ACE_ASSERT (index < this->maximum_);
00722   CORBA::TypeCode ** const tmp = ACE_reinterpret_cast (CORBA::TypeCode ** ACE_CAST_CONST, this->buffer_);
00723   return TAO_Pseudo_Object_Manager<Dynamic::TypeCode,Dynamic::TypeCode_var> (tmp + index, this->release_);
00724 }


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