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

TAO_Valuetype_Manager Class Template Reference

Manager for valuetypes. More...

#include <Sequence_T.h>

Collaboration diagram for TAO_Valuetype_Manager:

Collaboration graph
[legend]
List of all members.

Public Methods

 TAO_Valuetype_Manager (const TAO_Valuetype_Manager< T, T_var > &rhs)
 TAO_Valuetype_Manager (T **, CORBA::Boolean release)
 ~TAO_Valuetype_Manager (void)
 Destructor, only releases the object if <release_> is true. More...

TAO_Valuetype_Manager< T,
T_var > & 
operator= (const TAO_Valuetype_Manager< T, T_var > &rhs)
TAO_Valuetype_Manager< T,
T_var > & 
operator= (T *)
 Assignment from T *. More...

TAO_Valuetype_Manager< T,
T_var > & 
operator= (const T_var &)
 Assignment from T_var. More...

T * operator-> (void) const
 Return pointer. More...

 operator const T * () const
 Cast (read-only). More...

 operator T *& ()
 Cast. More...

 operator const T_var () const
 Cast (read-only) so that assignment from a structured type to a T_var will make a copy. More...

T * in (void) const
 for in parameter. More...

T *& inout (void)
 for inout parameter. More...

T *& out (void)
 for out parameter. More...

T * _retn (void)
 for return type. More...


Private Attributes

T ** ptr_
 data member, notice that it is a pointer, to implement the reference behavior for assignment. More...

CORBA::Boolean release_
 release flag based on parent's flag. More...


Friends

class TAO_Unbounded_Valuetype_Sequence< T, T_var >

Detailed Description

template<class T, class T_var>
class TAO_Valuetype_Manager< T, T_var >

Manager for valuetypes.

According to the spec., valuetypes are handled similarly to object references, so a manager class is needed.

See also:
TAO_Object_Manager

Definition at line 448 of file Sequence_T.h.


Constructor & Destructor Documentation

template<class T, class T_var>
ACE_INLINE TAO_Valuetype_Manager< T, T_var >::TAO_Valuetype_Manager const TAO_Valuetype_Manager< T, T_var > &    rhs
 

Copy constructor, the semantics are non-trivial: + The referenced element is duplicated or not according to the release value on the <rhs>. + In any case a new reference to the same object is created.

Definition at line 351 of file Sequence_T.i.

00354   : ptr_ (rhs.ptr_),
00355     release_ (rhs.release_)
00356 {
00357 }

template<class T, class T_var>
ACE_INLINE TAO_Valuetype_Manager< T, T_var >::TAO_Valuetype_Manager T **   ,
CORBA::Boolean    release
 

Constructor from address of an element, it should be private and only TAO_*_Object_Sequence would use it, but we have some problems with friendship and templates.

Definition at line 360 of file Sequence_T.i.

00363   : ptr_ (buffer),
00364     release_ (release)
00365 {
00366 }

template<class T, class T_var>
ACE_INLINE TAO_Valuetype_Manager< T, T_var >::~TAO_Valuetype_Manager void   
 

Destructor, only releases the object if <release_> is true.

Definition at line 346 of file Sequence_T.i.

00347 {
00348 }


Member Function Documentation

template<class T, class T_var>
ACE_INLINE T * TAO_Valuetype_Manager< T, T_var >::_retn void   
 

for return type.

Definition at line 414 of file Sequence_T.i.

References ptr_.

00415 {
00416   T *temp = *this->ptr_;
00417   *this->ptr_ = 0;
00418   return temp;
00419 }

template<class T, class T_var>
ACE_INLINE T * TAO_Valuetype_Manager< T, T_var >::in void    const
 

for in parameter.

Definition at line 394 of file Sequence_T.i.

References ptr_.

00395 {
00396   return *this->ptr_;
00397 }

template<class T, class T_var>
ACE_INLINE T *& TAO_Valuetype_Manager< T, T_var >::inout void   
 

for inout parameter.

Definition at line 400 of file Sequence_T.i.

References ptr_.

00401 {
00402   return *this->ptr_;
00403 }

template<class T, class T_var>
ACE_INLINE TAO_Valuetype_Manager< T, T_var >::operator const T *   const
 

Cast (read-only).

Definition at line 382 of file Sequence_T.i.

00383 {
00384   return *this->ptr_;
00385 }

template<class T, class T_var>
ACE_INLINE TAO_Valuetype_Manager< T, T_var >::operator const T_var   const
 

Cast (read-only) so that assignment from a structured type to a T_var will make a copy.

Definition at line 375 of file Sequence_T.i.

References ptr_.

00376 {
00377   T_var::tao_add_ref (*this->ptr_);
00378   return *this->ptr_;
00379 }

template<class T, class T_var>
ACE_INLINE TAO_Valuetype_Manager< T, T_var >::operator T *&  
 

Cast.

Definition at line 388 of file Sequence_T.i.

00389 {
00390   return *this->ptr_;
00391 }

template<class T, class T_var>
ACE_INLINE T * TAO_Valuetype_Manager< T, T_var >::operator-> void    const
 

Return pointer.

Definition at line 369 of file Sequence_T.i.

References ptr_.

00370 {
00371   return *this->ptr_;
00372 }

template<class T, class T_var>
TAO_Valuetype_Manager< T, T_var > & TAO_Valuetype_Manager< T, T_var >::operator= const T_var &   
 

Assignment from T_var.

Definition at line 456 of file Sequence_T.cpp.

References ptr_, and release_.

00457 {
00458   if (this->release_)
00459     {
00460       // The semantics of the elements of a sequence are the same as
00461       // that of a var variable.  Therefore we duplicate p's
00462       // pointer before assigning it to the internal
00463       // variable.
00464       if (*this->ptr_ != 0)
00465         {
00466           (*this->ptr_)->_remove_ref ();
00467         }
00468 
00469       T_var::tao_remove_ref (*this->ptr_);
00470       *this->ptr_ = p.in ();
00471       T_var::tao_add_ref (*this->ptr_);
00472     }
00473   else
00474     {
00475       *this->ptr_ = p.in ();
00476     }
00477 
00478   return *this;
00479 }

template<class T, class T_var>
TAO_Valuetype_Manager< T, T_var > & TAO_Valuetype_Manager< T, T_var >::operator= T *   
 

Assignment from T *.

Definition at line 435 of file Sequence_T.cpp.

References ptr_, and release_.

00436 {
00437   if (this->release_)
00438     {
00439       // The semantics of the elements of a sequence are the same as
00440       // that of a var variable.  Therefore we will not duplicate the
00441       // user provided pointer before assigning it to the internal
00442       // variable.
00443       T_var::tao_remove_ref (*this->ptr_);
00444       *this->ptr_ = p;
00445     }
00446   else
00447     {
00448       *this->ptr_ = p;
00449     }
00450 
00451   return *this;
00452 }

template<class T, class T_var>
TAO_Valuetype_Manager< T, T_var > & TAO_Valuetype_Manager< T, T_var >::operator= const TAO_Valuetype_Manager< T, T_var > &    rhs
 

Assignment from another managed type, only release if <this->release_> is true. @ TODO what happens if rhs.release_ is true an this->relase_ is false?

Definition at line 410 of file Sequence_T.cpp.

References ptr_, and release_.

00413 {
00414   if (this == &rhs)
00415     {
00416       return *this;
00417     }
00418 
00419   if (this->release_)
00420     {
00421       T_var::tao_remove_ref (*this->ptr_);
00422       *this->ptr_ = *rhs.ptr_;
00423       T_var::tao_add_ref (*this->ptr_);
00424     }
00425   else
00426     {
00427       *this->ptr_ = *rhs.ptr_;
00428     }
00429 
00430   return *this;
00431 }

template<class T, class T_var>
ACE_INLINE T *& TAO_Valuetype_Manager< T, T_var >::out void   
 

for out parameter.

Definition at line 406 of file Sequence_T.i.

References ptr_.

00407 {
00408   T_var::tao_remove_ref (*this->ptr_);
00409   *this->ptr_ = 0;
00410   return *this->ptr_;
00411 }


Friends And Related Function Documentation

template<class T, class T_var>
friend class TAO_Unbounded_Valuetype_Sequence< T, T_var > [friend]
 

Definition at line 450 of file Sequence_T.h.


Member Data Documentation

template<class T, class T_var>
T** TAO_Valuetype_Manager::ptr_ [private]
 

data member, notice that it is a pointer, to implement the reference behavior for assignment.

Definition at line 519 of file Sequence_T.h.

Referenced by _retn, in, inout, operator const T_var, operator->, operator=, and out.

template<class T, class T_var>
CORBA::Boolean TAO_Valuetype_Manager::release_ [private]
 

release flag based on parent's flag.

Definition at line 522 of file Sequence_T.h.

Referenced by operator=.


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