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

_TAO_Unbounded_Sequence_TAO_IIOPEndpointSequence Class Reference

#include <iiop_endpoints.h>

Inheritance diagram for _TAO_Unbounded_Sequence_TAO_IIOPEndpointSequence:

Inheritance graph
[legend]
Collaboration diagram for _TAO_Unbounded_Sequence_TAO_IIOPEndpointSequence:

Collaboration graph
[legend]
List of all members.

Public Methods

 _TAO_Unbounded_Sequence_TAO_IIOPEndpointSequence (void)
 _TAO_Unbounded_Sequence_TAO_IIOPEndpointSequence (CORBA::ULong maximum)
 _TAO_Unbounded_Sequence_TAO_IIOPEndpointSequence (CORBA::ULong maximum, CORBA::ULong length, TAO_IIOP_Endpoint_Info *data, CORBA::Boolean release=0)
 _TAO_Unbounded_Sequence_TAO_IIOPEndpointSequence (const _TAO_Unbounded_Sequence_TAO_IIOPEndpointSequence &rhs)
_TAO_Unbounded_Sequence_TAO_IIOPEndpointSequence & operator= (const _TAO_Unbounded_Sequence_TAO_IIOPEndpointSequence &rhs)
virtual ~_TAO_Unbounded_Sequence_TAO_IIOPEndpointSequence (void)
TAO_IIOP_Endpoint_Infooperator[] (CORBA::ULong i)
const TAO_IIOP_Endpoint_Infooperator[] (CORBA::ULong i) const
virtual void _allocate_buffer (CORBA::ULong length)
virtual void _deallocate_buffer (void)
 Must deallocate the buffer and then set it to zero. More...

TAO_IIOP_Endpoint_Infoget_buffer (CORBA::Boolean orphan=0)
const TAO_IIOP_Endpoint_Infoget_buffer (void) const
void replace (CORBA::ULong max, CORBA::ULong length, TAO_IIOP_Endpoint_Info *data, CORBA::Boolean release)

Static Public Methods

TAO_IIOP_Endpoint_Infoallocbuf (CORBA::ULong size)
void freebuf (TAO_IIOP_Endpoint_Info *buffer)

Constructor & Destructor Documentation

ACE_INLINE _TAO_Unbounded_Sequence_TAO_IIOPEndpointSequence::_TAO_Unbounded_Sequence_TAO_IIOPEndpointSequence void   
 

Definition at line 37 of file iiop_endpoints.i.

00038   {
00039   }

ACE_INLINE _TAO_Unbounded_Sequence_TAO_IIOPEndpointSequence::_TAO_Unbounded_Sequence_TAO_IIOPEndpointSequence CORBA::ULong    maximum
 

Definition at line 42 of file iiop_endpoints.i.

References allocbuf.

ACE_INLINE _TAO_Unbounded_Sequence_TAO_IIOPEndpointSequence::_TAO_Unbounded_Sequence_TAO_IIOPEndpointSequence CORBA::ULong    maximum,
CORBA::ULong    length,
TAO_IIOP_Endpoint_Info   data,
CORBA::Boolean    release = 0
 

Definition at line 48 of file iiop_endpoints.i.

00052   : TAO_Unbounded_Base_Sequence (maximum, length, data, release)
00053   {
00054   }

ACE_INLINE _TAO_Unbounded_Sequence_TAO_IIOPEndpointSequence::_TAO_Unbounded_Sequence_TAO_IIOPEndpointSequence const _TAO_Unbounded_Sequence_TAO_IIOPEndpointSequence &    rhs
 

Definition at line 57 of file iiop_endpoints.i.

References allocbuf.

00059     : TAO_Unbounded_Base_Sequence (rhs)
00060   {
00061     if (rhs.buffer_ != 0)
00062     {
00063       TAO_IIOP_Endpoint_Info *tmp1 = _TAO_Unbounded_Sequence_TAO_IIOPEndpointSequence::allocbuf (this->maximum_);
00064       TAO_IIOP_Endpoint_Info * const tmp2 = ACE_reinterpret_cast (TAO_IIOP_Endpoint_Info * ACE_CAST_CONST, rhs.buffer_);
00065       
00066       for (CORBA::ULong i = 0; i < this->length_; ++i)
00067         tmp1[i] = tmp2[i];
00068       
00069       this->buffer_ = tmp1;
00070     }
00071     else
00072     {
00073       this->buffer_ = 0;
00074     }
00075   }

_TAO_Unbounded_Sequence_TAO_IIOPEndpointSequence::~_TAO_Unbounded_Sequence_TAO_IIOPEndpointSequence void    [virtual]
 

Definition at line 81 of file iiop_endpoints.cpp.

00082   {
00083     this->_deallocate_buffer ();
00084   }


Member Function Documentation

void _TAO_Unbounded_Sequence_TAO_IIOPEndpointSequence::_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 50 of file iiop_endpoints.cpp.

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

00051   {
00052     TAO_IIOP_Endpoint_Info* tmp = 0;
00053     tmp = _TAO_Unbounded_Sequence_TAO_IIOPEndpointSequence::allocbuf (length);
00054     
00055     if (this->buffer_ != 0)
00056     {
00057       TAO_IIOP_Endpoint_Info *old = ACE_reinterpret_cast (TAO_IIOP_Endpoint_Info *,this->buffer_);
00058       
00059       for (CORBA::ULong i = 0; i < this->length_; ++i)
00060         tmp[i] = old[i];
00061       
00062       if (this->release_)
00063         _TAO_Unbounded_Sequence_TAO_IIOPEndpointSequence::freebuf (old);
00064       
00065     }
00066     this->buffer_ = tmp;
00067   }

void _TAO_Unbounded_Sequence_TAO_IIOPEndpointSequence::_deallocate_buffer void    [virtual]
 

Must deallocate the buffer and then set it to zero.

Implements TAO_Base_Sequence.

Definition at line 70 of file iiop_endpoints.cpp.

References TAO_Base_Sequence::buffer_, freebuf, and TAO_Base_Sequence::release_.

00071   {
00072     if (this->buffer_ == 0 || this->release_ == 0)
00073       return;
00074     
00075     TAO_IIOP_Endpoint_Info *tmp = ACE_reinterpret_cast (TAO_IIOP_Endpoint_Info *,this->buffer_);
00076     
00077     _TAO_Unbounded_Sequence_TAO_IIOPEndpointSequence::freebuf (tmp);
00078     this->buffer_ = 0;
00079   } 

ACE_INLINE TAO_IIOP_Endpoint_Info * _TAO_Unbounded_Sequence_TAO_IIOPEndpointSequence::allocbuf CORBA::ULong    size [static]
 

Definition at line 22 of file iiop_endpoints.i.

References ACE_NEW_RETURN.

Referenced by _allocate_buffer, _TAO_Unbounded_Sequence_TAO_IIOPEndpointSequence, get_buffer, and operator=.

00024   {
00025     TAO_IIOP_Endpoint_Info *retval = 0;
00026     ACE_NEW_RETURN (retval, TAO_IIOP_Endpoint_Info[size], 0);
00027     return retval;
00028   }

ACE_INLINE void _TAO_Unbounded_Sequence_TAO_IIOPEndpointSequence::freebuf TAO_IIOP_Endpoint_Info   buffer [static]
 

Definition at line 30 of file iiop_endpoints.i.

References ACE_INLINE.

Referenced by _allocate_buffer, _deallocate_buffer, operator=, and replace.

00032   {
00033     delete [] buffer;
00034   }

ACE_INLINE const TAO_IIOP_Endpoint_Info * _TAO_Unbounded_Sequence_TAO_IIOPEndpointSequence::get_buffer void    const
 

Definition at line 164 of file iiop_endpoints.i.

00165   {
00166     return ACE_reinterpret_cast(const TAO_IIOP_Endpoint_Info * ACE_CAST_CONST, this->buffer_);
00167   }

ACE_INLINE TAO_IIOP_Endpoint_Info * _TAO_Unbounded_Sequence_TAO_IIOPEndpointSequence::get_buffer CORBA::Boolean    orphan = 0
 

Definition at line 130 of file iiop_endpoints.i.

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

00131   {
00132     TAO_IIOP_Endpoint_Info *result = 0;
00133     if (orphan == 0)
00134     {
00135       // We retain ownership.
00136       if (this->buffer_ == 0)
00137       {
00138         result = _TAO_Unbounded_Sequence_TAO_IIOPEndpointSequence::allocbuf (this->length_);
00139         this->buffer_ = result;
00140         this->release_ = 1;
00141       }
00142       else
00143       {
00144         result = ACE_reinterpret_cast (TAO_IIOP_Endpoint_Info*, this->buffer_);
00145       }
00146     }
00147     else // if (orphan == 1)
00148     {
00149       if (this->release_ != 0)
00150       {
00151         // We set the state back to default and relinquish
00152         // ownership.
00153         result = ACE_reinterpret_cast(TAO_IIOP_Endpoint_Info*,this->buffer_);
00154         this->maximum_ = 0;
00155         this->length_ = 0;
00156         this->buffer_ = 0;
00157         this->release_ = 0;
00158       }
00159     }
00160     return result;
00161   }

ACE_INLINE _TAO_Unbounded_Sequence_TAO_IIOPEndpointSequence & _TAO_Unbounded_Sequence_TAO_IIOPEndpointSequence::operator= const _TAO_Unbounded_Sequence_TAO_IIOPEndpointSequence &    rhs
 

Definition at line 78 of file iiop_endpoints.i.

References allocbuf, freebuf, and TAO_Base_Sequence::operator=.

00080   {
00081     if (this == &rhs)
00082       return *this;
00083     
00084     if (this->release_)
00085     {
00086       if (this->maximum_ < rhs.maximum_)
00087       {
00088         // free the old buffer
00089         TAO_IIOP_Endpoint_Info *tmp = ACE_reinterpret_cast (TAO_IIOP_Endpoint_Info *, this->buffer_);
00090         _TAO_Unbounded_Sequence_TAO_IIOPEndpointSequence::freebuf (tmp);
00091         this->buffer_ = _TAO_Unbounded_Sequence_TAO_IIOPEndpointSequence::allocbuf (rhs.maximum_);
00092       }
00093     }
00094     else
00095       this->buffer_ = _TAO_Unbounded_Sequence_TAO_IIOPEndpointSequence::allocbuf (rhs.maximum_);
00096     
00097     TAO_Unbounded_Base_Sequence::operator= (rhs);
00098     
00099     TAO_IIOP_Endpoint_Info *tmp1 = ACE_reinterpret_cast (TAO_IIOP_Endpoint_Info *, this->buffer_);
00100     TAO_IIOP_Endpoint_Info * const tmp2 = ACE_reinterpret_cast (TAO_IIOP_Endpoint_Info * ACE_CAST_CONST, rhs.buffer_);
00101     
00102     for (CORBA::ULong i = 0; i < this->length_; ++i)
00103       tmp1[i] = tmp2[i];
00104     
00105     return *this;
00106   }

ACE_INLINE const TAO_IIOP_Endpoint_Info & _TAO_Unbounded_Sequence_TAO_IIOPEndpointSequence::operator[] CORBA::ULong    i const
 

Definition at line 119 of file iiop_endpoints.i.

References ACE_ASSERT.

00121   {
00122     ACE_ASSERT (i < this->maximum_);
00123     TAO_IIOP_Endpoint_Info * const tmp = ACE_reinterpret_cast (TAO_IIOP_Endpoint_Info* ACE_CAST_CONST, this->buffer_);
00124     return tmp[i];
00125   }

ACE_INLINE TAO_IIOP_Endpoint_Info & _TAO_Unbounded_Sequence_TAO_IIOPEndpointSequence::operator[] CORBA::ULong    i
 

Definition at line 110 of file iiop_endpoints.i.

References ACE_ASSERT.

00112   {
00113     ACE_ASSERT (i < this->maximum_);
00114     TAO_IIOP_Endpoint_Info* tmp = ACE_reinterpret_cast(TAO_IIOP_Endpoint_Info*,this->buffer_);
00115     return tmp[i];
00116   }

ACE_INLINE void _TAO_Unbounded_Sequence_TAO_IIOPEndpointSequence::replace CORBA::ULong    max,
CORBA::ULong    length,
TAO_IIOP_Endpoint_Info   data,
CORBA::Boolean    release
 

Definition at line 170 of file iiop_endpoints.i.

References TAO_Base_Sequence::buffer_, freebuf, TAO_Unbounded_Base_Sequence::length, TAO_Base_Sequence::length_, TAO_Base_Sequence::maximum_, TAO_Base_Sequence::release, and TAO_Base_Sequence::release_.

00174   {
00175     this->maximum_ = max;
00176     this->length_ = length;
00177     if (this->buffer_ && this->release_ == 1)
00178     {
00179       TAO_IIOP_Endpoint_Info *tmp = ACE_reinterpret_cast(TAO_IIOP_Endpoint_Info*,this->buffer_);
00180       _TAO_Unbounded_Sequence_TAO_IIOPEndpointSequence::freebuf (tmp);
00181     }
00182     this->buffer_ = data;
00183     this->release_ = release;
00184   }


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