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

TAO_SeqElem_String_Manager Class Reference

TAO_SeqElem_String_Manager. More...

#include <Managed_Types.h>

List of all members.

Public Methods

 TAO_SeqElem_String_Manager (const TAO_SeqElem_String_Manager &)
 copy constructor. More...

 TAO_SeqElem_String_Manager (char **buffer, CORBA::Boolean release)
 constructor from address of an element. More...

 ~TAO_SeqElem_String_Manager (void)
 destructor. More...

TAO_SeqElem_String_Manager & operator= (const TAO_SeqElem_String_Manager &)
 assignment from another managed type. More...

TAO_SeqElem_String_Manager & operator= (const CORBA::String_var &)
 assignment from var type will make a copy. More...

TAO_SeqElem_String_Manager & operator= (const char *)
 assignment from a constant char* will make a copy. More...

TAO_SeqElem_String_Manager & operator= (char *)
 assignment from char* will not make a copy. The SeqElem_String_Manager will now own the string. More...

 operator const char * () const
 cast (read-only). More...

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

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

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

char * _retn (void)
 for string of return type. More...


Private Methods

 TAO_SeqElem_String_Manager (void)
 default ctor. More...


Private Attributes

char ** ptr_
 Address of string element from the parent's buffer. More...

CORBA::Boolean release_
 control memory managment semantics. More...


Friends

class TAO_Unbounded_String_Sequence


Detailed Description

TAO_SeqElem_String_Manager.

Manager for strings that are the element type of sequences. Similar to the mapping for sequences of objects (and other pseudo objects) the mapping for sequences of strings requires an auxiliar class or <Manager> to handle the allocation and deallocation of the string. The main difference with respect to String_var classes is that automatic release is not controlled on a per-item basis, but for the sequence as a whole. The difference wrt Object_Manager is that strings are duplicated using CORBA::string_dup () as opposed to T::_duplicate(), and released using CORBA::string_free() instead of CORBA::release() This class implements the generic string manager and is used to instantiate the proper sequence types. This class will have the same semantics as the string manager classes defined earlier with respect to the various assignment operators. However, the freeing of old storage will be dependent on the "release" value of the parent sequence class.

Definition at line 109 of file Managed_Types.h.


Constructor & Destructor Documentation

ACE_INLINE TAO_SeqElem_String_Manager::TAO_SeqElem_String_Manager const TAO_SeqElem_String_Manager &   
 

copy constructor.

Definition at line 109 of file Managed_Types.i.

00110   :  ptr_ (rhs.ptr_),
00111      release_ (rhs.release_)
00112 {
00113 }

ACE_INLINE TAO_SeqElem_String_Manager::TAO_SeqElem_String_Manager char **    buffer,
CORBA::Boolean    release
 

constructor from address of an element.

Definition at line 116 of file Managed_Types.i.

00118   :  ptr_ (buffer),
00119      release_ (release)
00120 {
00121 }

ACE_INLINE TAO_SeqElem_String_Manager::~TAO_SeqElem_String_Manager void   
 

destructor.

Definition at line 124 of file Managed_Types.i.

00125 {
00126 }

TAO_SeqElem_String_Manager::TAO_SeqElem_String_Manager void    [private]
 

default ctor.


Member Function Documentation

ACE_INLINE char * TAO_SeqElem_String_Manager::_retn void   
 

for string of return type.

Definition at line 188 of file Managed_Types.i.

References ptr_.

00189 {
00190   char *temp = *this->ptr_;
00191   *this->ptr_ = 0;
00192   return temp;
00193 }

ACE_INLINE const char * TAO_SeqElem_String_Manager::in void    const
 

for in parameter.

Definition at line 168 of file Managed_Types.i.

References ptr_.

00169 {
00170   return *this->ptr_;
00171 }

ACE_INLINE char *& TAO_SeqElem_String_Manager::inout void   
 

for inout parameter.

Definition at line 174 of file Managed_Types.i.

References ptr_.

00175 {
00176   return *this->ptr_;
00177 }

ACE_INLINE TAO_SeqElem_String_Manager::operator const char *   const
 

cast (read-only).

Definition at line 162 of file Managed_Types.i.

References ptr_.

00163 {
00164   return *this->ptr_;
00165 }

ACE_INLINE TAO_SeqElem_String_Manager & TAO_SeqElem_String_Manager::operator= char *   
 

assignment from char* will not make a copy. The SeqElem_String_Manager will now own the string.

Definition at line 153 of file Managed_Types.i.

References ptr_, release_, and CORBA::string_free.

00154 {
00155   if (this->release_)
00156     CORBA::string_free (*this->ptr_);
00157   *this->ptr_ = p;
00158   return *this;
00159 }

ACE_INLINE TAO_SeqElem_String_Manager & TAO_SeqElem_String_Manager::operator= const char *   
 

assignment from a constant char* will make a copy.

Definition at line 143 of file Managed_Types.i.

References ptr_, release_, CORBA::string_dup, and CORBA::string_free.

00144 {
00145   if (this->release_)
00146     CORBA::string_free (*this->ptr_);
00147   *this->ptr_ = CORBA::string_dup (p);
00148   return *this;
00149 }

TAO_SeqElem_String_Manager & TAO_SeqElem_String_Manager::operator= const CORBA::String_var  
 

assignment from var type will make a copy.

Definition at line 24 of file Managed_Types.cpp.

References ptr_, release_, CORBA::string_dup, and CORBA::string_free.

00025 {
00026   if (this->release_)
00027     CORBA::string_free (*this->ptr_);
00028   *this->ptr_ = CORBA::string_dup (var.in ());
00029   return *this;
00030 }

ACE_INLINE TAO_SeqElem_String_Manager & TAO_SeqElem_String_Manager::operator= const TAO_SeqElem_String_Manager &   
 

assignment from another managed type.

Definition at line 130 of file Managed_Types.i.

References ptr_, release_, CORBA::string_dup, and CORBA::string_free.

00131 {
00132   if (this == &rhs)
00133     return *this;
00134 
00135   if (this->release_)
00136     CORBA::string_free (*this->ptr_);
00137   *this->ptr_ = CORBA::string_dup (*rhs.ptr_);
00138   return *this;
00139 }

ACE_INLINE char *& TAO_SeqElem_String_Manager::out void   
 

for out parameter.

Definition at line 180 of file Managed_Types.i.

References ptr_, and CORBA::string_free.

00181 {
00182   CORBA::string_free (*this->ptr_);
00183   *this->ptr_ = 0;
00184   return *this->ptr_;
00185 }


Friends And Related Function Documentation

friend class TAO_Unbounded_String_Sequence [friend]
 

Definition at line 112 of file Managed_Types.h.


Member Data Documentation

char** TAO_SeqElem_String_Manager::ptr_ [private]
 

Address of string element from the parent's buffer.

Definition at line 158 of file Managed_Types.h.

Referenced by _retn, in, inout, operator const char *, operator=, and out.

CORBA::Boolean TAO_SeqElem_String_Manager::release_ [private]
 

control memory managment semantics.

Definition at line 161 of file Managed_Types.h.

Referenced by operator=.


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