TAO_MProfile Class Reference

This class implements the basic interface for supporting multiple profiles. More...

#include <MProfile.h>

Collaboration diagram for TAO_MProfile:

Collaboration graph
[legend]
List of all members.

Public Member Functions

 TAO_MProfile (CORBA::ULong sz=0)
 TAO_MProfile (const TAO_MProfile &mprofiles)
TAO_MProfileoperator= (const TAO_MProfile &mprofiles)
 Assigment operator.
 ~TAO_MProfile (void)
int set (CORBA::ULong sz)
int set (const TAO_MProfile &mprofile)
int grow (CORBA::ULong sz)
TAO_Profileget_cnext (void)
 Treat as a circular list.
TAO_Profileget_next (void)
 Get next profile in list, return 0 at end of list.
TAO_Profileget_cprev (void)
 Assume a circular list of profiles.
TAO_Profileget_prev (void)
 Get previous profile, stop at beginning of list and return 0.
TAO_Profileget_current_profile (void)
TAO_Profileget_profile (TAO_PHandle handle)
 Return a pointer to the profile referenced by handle void.
TAO_PHandle get_current_handle (void)
 Returns the index for the current profile.
TAO_PHandle get_current_handle (void) const
 Returns the index for the current profile.
CORBA::ULong profile_count (void) const
 Returns the number of profiles stored in the list (last_+1).
CORBA::ULong size (void) const
const TAO_Profileget_profile (CORBA::ULong slot) const
void rewind (void)
 Sets the current slot back to 0.
int add_profile (TAO_Profile *pfile)
int give_profile (TAO_Profile *pfile, int share=0)
int add_profiles (TAO_MProfile *pfiles)
int remove_profile (const TAO_Profile *pfile)
 remove from this MProfile any profiles which also appear in pfiles.
int remove_profiles (const TAO_MProfile *pfiles)
 remove from this MProfile any profiles which also appear in pfiles.
void forward_from (TAO_MProfile *mprofiles)
TAO_MProfileforward_from (void)
 Returns a pointer to the profile which was forwarded.
CORBA::Boolean is_equivalent (const TAO_MProfile *rhs)
CORBA::ULong hash (CORBA::ULong max)
void policy_list (CORBA::PolicyList *policy_list)
CORBA::PolicyList * policy_list (void)

Protected Member Functions

void create_policy_list (void)
void init_policy_list (void)
 Initialize the policy list, demarsharling the policy.
TAO_Profile ** pfiles (void) const

Protected Attributes

CORBA::PolicyList * policy_list_
CORBA::Boolean is_policy_list_initialized_
TAO_SYNCH_RECURSIVE_MUTEX mutex_

Private Member Functions

void cleanup (void)
 Helper method to implement the destructor.
int give_shared_profile (TAO_Profile *pfile)

Private Attributes

TAO_MProfileforward_from_
TAO_Profile ** pfiles_
 Actual list of profiles.
TAO_PHandle current_
 Points to the next profile to be used. 0 ... size_.
TAO_PHandle size_
 Max size of array.
TAO_PHandle last_
 Index plus 1 of last valid entry! May be < size_.

Friends

class TAO_Profile
 Stores the policy list for the profile of this MProfile.

Detailed Description

This class implements the basic interface for supporting multiple profiles.

Multiple profiles can be treated either as a circular queue or a linear array of profiles. It is assumed that locking will only be required when a profile list is associated with a TAO_Stub. Thus when the TAO_Stub accepts ownership of an MProfile it also assumes responsibility for controling access (i.e. locking).

Definition at line 55 of file MProfile.h.


Constructor & Destructor Documentation

TAO_BEGIN_VERSIONED_NAMESPACE_DECL ACE_INLINE TAO_MProfile::TAO_MProfile ( CORBA::ULong  sz = 0  ) 

Definition at line 9 of file MProfile.inl.

References set().

00010   :  policy_list_ (0),
00011      is_policy_list_initialized_ (false),
00012      forward_from_(0),
00013      pfiles_ (0),
00014      current_ (0),
00015      size_ (0),
00016      last_ (0)
00017 {
00018   this->set (sz);
00019 }

ACE_INLINE TAO_MProfile::TAO_MProfile ( const TAO_MProfile mprofiles  ) 

**NOTE: IF mprofiles->last_ > 0, THEN this->size_ will be set to mprofiles->last_. Otherwise this->size_ - mprofiles->size_. Furthermore, current_ is set back to 0! i.e. rewound. The reference count on any profiles in mprofiles is increment when their references (i.e. pointers) are copied.

Definition at line 22 of file MProfile.inl.

References set().

00023   :  policy_list_ (0),
00024      is_policy_list_initialized_ (false),
00025      forward_from_(0),
00026      pfiles_ (0),
00027      current_ (0),
00028      size_ (0),
00029      last_ (0)
00030 {
00031   this->set (mprofiles);
00032 }

TAO_BEGIN_VERSIONED_NAMESPACE_DECL TAO_MProfile::~TAO_MProfile ( void   ) 

Destructor: decrements reference count on all references profiles!

Definition at line 24 of file MProfile.cpp.

References cleanup(), and policy_list_.

00025 {
00026   if (this->policy_list_ != 0)
00027     {
00028       CORBA::ULong const len = this->policy_list_->length ();
00029       for (CORBA::ULong i = 0; i < len; ++i)
00030         {
00031           try
00032             {
00033               CORBA::Policy_ptr policy = (*this->policy_list_)[i];
00034               policy->destroy ();
00035             }
00036           catch (const ::CORBA::Exception&)
00037             {
00038               // Ignore all exceptions to allow other policies to be
00039               // destroyed.
00040             }
00041         }
00042 
00043       delete this->policy_list_;
00044     }
00045 
00046   this->cleanup ();
00047 }


Member Function Documentation

int TAO_MProfile::add_profile ( TAO_Profile pfile  ) 

Return the index of this entry or -1 if it can not be added. reference count on profile in incremented!

Definition at line 179 of file MProfile.cpp.

References TAO_Profile::_incr_refcnt(), ACE_ERROR_RETURN, ACE_TEXT, last_, LM_ERROR, pfiles_, and size_.

Referenced by TAO_ORB_Core::is_collocation_enabled().

00180 {
00181   // skip by the used slots
00182   if (last_ == size_) // full!
00183     {
00184       if (this->grow (this->size_ + 1) < 0)
00185         return -1;
00186     }
00187 
00188   pfiles_[last_++] = pfile;
00189 
00190   if (pfile && pfile->_incr_refcnt () == 0)
00191     ACE_ERROR_RETURN ((LM_ERROR,
00192                        ACE_TEXT ("(%P|%t) Unable to increment reference ")
00193                        ACE_TEXT ("count in add_profile!\n")),
00194                       -1);
00195 
00196   return last_ - 1;
00197 }

int TAO_MProfile::add_profiles ( TAO_MProfile pfiles  ) 

append the profiles in pfiles to this object. The count will be incremented on the individual profile objects.

Definition at line 200 of file MProfile.cpp.

References last_, pfiles(), and size_.

00201 {
00202   // this->size_ == total number of profiles we can hold
00203   // this->last_ == the index of the last profile
00204   CORBA::ULong space = this->size_ - this->last_;
00205 
00206   if (space < pfiles->last_)
00207     {
00208       // we need to grow!
00209      if (this->grow (this->last_ + pfiles->last_) < 0)
00210        return -1;
00211     }
00212 
00213   // copy over profiles
00214   for (TAO_PHandle h = 0; h < pfiles->last_; ++h)
00215     {
00216       if (this->add_profile (pfiles->pfiles_[h]) < 0)
00217         return -1;
00218     }
00219   return 0;
00220 }

void TAO_MProfile::cleanup ( void   )  [private]

Helper method to implement the destructor.

Definition at line 50 of file MProfile.cpp.

References current_, last_, pfiles_, and size_.

Referenced by set(), and ~TAO_MProfile().

00051 {
00052   if (this->pfiles_ != 0)
00053     {
00054       for (TAO_PHandle i = 0; i < this->last_; ++i)
00055         if (this->pfiles_[i])
00056           this->pfiles_[i]->_decr_refcnt ();
00057       delete [] this->pfiles_;
00058       this->pfiles_ = 0;
00059     }
00060 
00061   this->current_ = 0;
00062   this->size_ = 0;
00063   this->last_ = 0;
00064 }

void TAO_MProfile::create_policy_list ( void   )  [protected]

This method handle the dynamic allocation of the data member <policy_list_>.

Definition at line 309 of file MProfile.cpp.

References ACE_NEW_THROW_EX, and CORBA::COMPLETED_NO.

Referenced by policy_list().

00310 {
00311   ACE_NEW_THROW_EX (this->policy_list_,
00312                     CORBA::PolicyList,
00313                     CORBA::NO_MEMORY (0,
00314                                       CORBA::COMPLETED_NO)
00315                     );
00316 }

ACE_INLINE TAO_MProfile * TAO_MProfile::forward_from ( void   ) 

Returns a pointer to the profile which was forwarded.

Definition at line 168 of file MProfile.inl.

References forward_from_.

00169 {
00170   return this->forward_from_;
00171 }

ACE_INLINE void TAO_MProfile::forward_from ( TAO_MProfile mprofiles  ) 

Set a pointer to the MProfile whose 'current' TAO_Profile was forwarded This object is the set of forwarding profiles.

Definition at line 161 of file MProfile.inl.

References forward_from_.

00162 {
00163   this->forward_from_ = from;
00164 }

ACE_INLINE TAO_Profile * TAO_MProfile::get_cnext ( void   ) 

Treat as a circular list.

Definition at line 47 of file MProfile.inl.

References current_, last_, and pfiles_.

00048 {
00049   if (last_ == 0)
00050     return 0;
00051 
00052   if (current_ == last_)
00053     current_ = 0;
00054 
00055   return pfiles_[current_++];
00056 }

ACE_INLINE TAO_Profile * TAO_MProfile::get_cprev ( void   ) 

Assume a circular list of profiles.

Definition at line 72 of file MProfile.inl.

References current_, last_, and pfiles_.

00073 {
00074   if (last_ == 0)
00075     return 0;
00076   else if (last_ == 1)
00077     current_=1;
00078   else if (current_ > 1)
00079     --current_;
00080   else // current_ == 0 or 1, 0 => list never read before and == 1
00081     current_ = last_;
00082 
00083   return pfiles_[current_ - 1];
00084 }

ACE_INLINE TAO_PHandle TAO_MProfile::get_current_handle ( void   )  const

Returns the index for the current profile.

Definition at line 131 of file MProfile.inl.

References current_.

00132 {
00133   if (current_ > 0)
00134     return current_ - 1;
00135   else
00136     return 0;
00137 }

ACE_INLINE TAO_PHandle TAO_MProfile::get_current_handle ( void   ) 

Returns the index for the current profile.

Definition at line 122 of file MProfile.inl.

References current_.

00123 {
00124   if (current_ > 0)
00125     return current_ - 1;
00126   else
00127     return 0;
00128 }

ACE_INLINE TAO_Profile * TAO_MProfile::get_current_profile ( void   ) 

Return a pointer to the current profile, will not increment reference pointer.

Definition at line 110 of file MProfile.inl.

References current_, last_, and pfiles_.

Referenced by TAO_Stub::forward_back_one(), and init_policy_list().

00111 {
00112   if (last_ == 0)
00113     return 0;
00114   if (current_ == 0)
00115     // means list has not been read before.
00116     current_ = 1;
00117 
00118   return pfiles_[current_ - 1];
00119 }

ACE_INLINE TAO_Profile * TAO_MProfile::get_next ( void   ) 

Get next profile in list, return 0 at end of list.

Definition at line 62 of file MProfile.inl.

References current_, last_, and pfiles_.

Referenced by TAO_Stub::next_profile_i(), and TAO_Stub::reset_base().

00063 {
00064   // Nolist or EndOfList
00065   if (last_ == 0 || current_ == last_)
00066     return 0;
00067   else
00068     return pfiles_[current_++];
00069 }

ACE_INLINE TAO_Profile * TAO_MProfile::get_prev ( void   ) 

Get previous profile, stop at beginning of list and return 0.

Definition at line 87 of file MProfile.inl.

References current_, last_, and pfiles_.

00088 {
00089   if (last_ == 0 || current_ <= 1)
00090     // No List of BeginningOfList
00091     return 0;
00092   if (current_ > 1)
00093     --current_;
00094 
00095   return pfiles_[current_ - 1];
00096 }

ACE_INLINE const TAO_Profile * TAO_MProfile::get_profile ( CORBA::ULong  slot  )  const

Return the profile at position <slot>. If <slot> is out of range it returns 0.

Definition at line 186 of file MProfile.inl.

References pfiles_.

00187 {
00188   if (slot >= this->last_)
00189     return 0;
00190   return this->pfiles_[slot];
00191 }

ACE_INLINE TAO_Profile * TAO_MProfile::get_profile ( TAO_PHandle  handle  ) 

Return a pointer to the profile referenced by handle void.

Definition at line 101 of file MProfile.inl.

References last_, and pfiles_.

Referenced by TAO_IIOP_Acceptor::create_shared_profile(), TAO_ORB_Core::create_stub_object(), TAO_Stub::get_profile_ior_info(), TAO_Acceptor_Registry::is_collocated(), TAO_Stub::marshal(), TAO_Stub::object_key(), and CORBA::ORB::object_to_string().

00102 {
00103   if (handle < last_)
00104     return pfiles_[handle];
00105   else
00106     return 0;
00107 }

ACE_INLINE int TAO_MProfile::give_profile ( TAO_Profile pfile,
int  share = 0 
)

Return the index of this entry or -1 if it can not be added. this object assumes ownership of this profile!!

Definition at line 146 of file MProfile.inl.

References give_shared_profile(), last_, pfiles_, and size_.

Referenced by TAO_IIOP_Acceptor::create_new_profile(), TAO_IIOP_Acceptor::create_shared_profile(), give_shared_profile(), TAO_Connector::make_mprofile(), operator>>(), and CORBA::Object::tao_object_initialize().

00147 {
00148   if (share)
00149     return this->give_shared_profile(pfile);
00150   // skip by the used slots
00151   if (last_ == size_) // full!
00152     return -1;
00153 
00154   pfiles_[last_++] = pfile;
00155 
00156   return last_ - 1;
00157 }

int TAO_MProfile::give_shared_profile ( TAO_Profile pfile  )  [private]

A helper to give_profile to be used when share is true. This method is used primarily to help the corbaloc parser create a single profile with multiple endpoints rather than constructing multiple profiles with 1 endpoint per.

Definition at line 357 of file MProfile.cpp.

References TAO_Profile::_decr_refcnt(), TAO_Profile::compare_key(), TAO_Profile::endpoint(), give_profile(), last_, pfiles_, and TAO_Profile::tag().

Referenced by give_profile().

00358 {
00359   for (unsigned i = 0; i < this->last_; i++)
00360     if (pfile->tag() == this->pfiles_[i]->tag() &&
00361         pfile->compare_key(this->pfiles_[i]))
00362       {
00363         this->pfiles_[i]->add_generic_endpoint(pfile->endpoint());
00364         pfile->_decr_refcnt();
00365         return i;
00366       }
00367   return this->give_profile(pfile,0);
00368 }

int TAO_MProfile::grow ( CORBA::ULong  sz  ) 

increase the number of profiles this object can hold. NOT THREAD SAFE

Definition at line 150 of file MProfile.cpp.

References ACE_NEW_RETURN, pfiles_, and size_.

Referenced by TAO_IIOP_Acceptor::create_new_profile().

00151 {
00152   if (sz <= this->size_)
00153     return 0;
00154 
00155   // get the additional space
00156   TAO_Profile **new_pfiles = 0;
00157   TAO_Profile **old_pfiles = 0;
00158   ACE_NEW_RETURN (new_pfiles,
00159                   TAO_Profile *[sz],
00160                   -1);
00161 
00162   old_pfiles = this->pfiles_;
00163 
00164   // got it, now copy profiles
00165   for (TAO_PHandle h = 0; h < this->size_; ++h)
00166     {
00167       new_pfiles[h] = old_pfiles[h];
00168       old_pfiles[h] = 0;
00169     }
00170 
00171   this->pfiles_ = new_pfiles;
00172   this->size_ = sz;
00173   delete [] old_pfiles;
00174 
00175   return 0;
00176 }

CORBA::ULong TAO_MProfile::hash ( CORBA::ULong  max  ) 

use all registered profiles. The hash() method is called on each profile and the results are averaged together. NON-THREAD SAFE.

Definition at line 289 of file MProfile.cpp.

References last_, and pfiles_.

Referenced by TAO_Stub::hash().

00290 {
00291   CORBA::ULong hashval = 0;
00292 
00293   if (this->last_ == 0)
00294     return 0;
00295 
00296   for (TAO_PHandle h = 0; h < this->last_ ; ++h)
00297     {
00298       hashval += pfiles_[h]->hash (max);
00299     }
00300 
00301   // The above hash function return an ULong between 0 and max here we
00302   // simply take the average value and round.
00303   //return hashval / this->last_;
00304   // Changed to a mod value instead of an average.
00305   return hashval % max;
00306 }

void TAO_MProfile::init_policy_list ( void   )  [protected]

Initialize the policy list, demarsharling the policy.

Definition at line 319 of file MProfile.cpp.

References get_current_profile(), TAO_Profile::get_policies(), and is_policy_list_initialized_.

Referenced by policy_list().

00320 {
00321   // The first time this method is called
00322   // it causes the initialization of the policies
00323   // for the current profile.
00324 
00325   this->get_current_profile ()->get_policies (*this->policy_list_);
00326 
00327   this->is_policy_list_initialized_ = true;
00328 }

CORBA::Boolean TAO_MProfile::is_equivalent ( const TAO_MProfile rhs  ) 

Returns true of there is at least one profile in first which is_equivalent with at least one profile in second. NON-THREAD SAFE, relies on some other entity to guarentee the profiles will not change during the call.

Definition at line 275 of file MProfile.cpp.

References last_, and pfiles_.

00276 {
00277   // Two profile lists are equivalent iff at least one of the profiles
00278   // from the first list is_equivalent to at least one of the profiles
00279   // from the second list!!
00280   for (TAO_PHandle h1 = 0; h1 < this->last_; ++h1)
00281     for (TAO_PHandle h2 = 0; h2 < rhs->last_; ++h2)
00282       if (this->pfiles_[h1]->is_equivalent (rhs->pfiles_[h2]))
00283         return 1;
00284 
00285   return 0;
00286 }

ACE_INLINE TAO_MProfile & TAO_MProfile::operator= ( const TAO_MProfile mprofiles  ) 

Assigment operator.

Definition at line 35 of file MProfile.inl.

References set().

00036 {
00037   if (this == &rhs)
00038     return *this;
00039 
00040   this->set (rhs);
00041   return *this;
00042 }

ACE_INLINE TAO_Profile ** TAO_MProfile::pfiles ( void   )  const [protected]

Return the complete list of profiles, this object retains ownership!

Definition at line 194 of file MProfile.inl.

References pfiles_.

Referenced by add_profiles(), and remove_profiles().

00195 {
00196   return this->pfiles_;
00197 }

CORBA::PolicyList * TAO_MProfile::policy_list ( void   ) 

Gets the policies list associated with the profiles owned by the TAO_MProfile.

Definition at line 331 of file MProfile.cpp.

References ACE_GUARD_RETURN, ACE_NEW_THROW_EX, CORBA::COMPLETED_NO, create_policy_list(), init_policy_list(), and TAO_SYNCH_RECURSIVE_MUTEX.

00332 {
00333   if (!this->is_policy_list_initialized_)
00334     {
00335       ACE_GUARD_RETURN (TAO_SYNCH_RECURSIVE_MUTEX,
00336                         guard,
00337                         this->mutex_,
00338                         0);
00339 
00340       if (this->policy_list_ == 0)
00341         {
00342           this->create_policy_list ();
00343 
00344           this->init_policy_list ();
00345         }
00346     }
00347   CORBA::PolicyList *ret_val = 0;
00348   ACE_NEW_THROW_EX (ret_val,
00349                     CORBA::PolicyList (*this->policy_list_),
00350                     CORBA::NO_MEMORY (0,
00351                                       CORBA::COMPLETED_NO));
00352 
00353   return ret_val;
00354 }

ACE_INLINE void TAO_MProfile::policy_list ( CORBA::PolicyList *  policy_list  ) 

Sets the policies list associated with the profiles owned by the TAO_MProfile.

Definition at line 200 of file MProfile.inl.

References policy_list_.

Referenced by TAO_ORB_Core::create_stub_object().

00201 {
00202   this->policy_list_ = policy_list;
00203 }

ACE_INLINE CORBA::ULong TAO_MProfile::profile_count ( void   )  const

Returns the number of profiles stored in the list (last_+1).

Definition at line 174 of file MProfile.inl.

References last_.

Referenced by TAO_Stub::create_ior_info(), TAO_IIOP_Acceptor::create_new_profile(), TAO_IIOP_Acceptor::create_shared_profile(), TAO_ORB_Core::create_stub_object(), TAO_Stub::get_profile_ior_info(), TAO_Acceptor_Registry::is_collocated(), TAO_Stub::marshal(), CORBA::ORB::object_to_string(), operator>>(), and CORBA::Object::tao_object_initialize().

00175 {
00176   return this->last_;
00177 }

int TAO_MProfile::remove_profile ( const TAO_Profile pfile  ) 

remove from this MProfile any profiles which also appear in pfiles.

Definition at line 235 of file MProfile.cpp.

References last_.

00236 {
00237   TAO_PHandle h;
00238   int found = 0;
00239   for (h = 0; h < this->last_; ++h)
00240     {
00241       if (this->pfiles_[h]->is_equivalent (pfile))
00242         { // remove it!
00243           TAO_Profile *old = this->pfiles_[h];
00244           this->pfiles_[h] = 0;
00245           old->_decr_refcnt ();
00246           // shift other profiles up one
00247           // note, if h == last_ - 1 then do nothing.
00248           for (TAO_PHandle inner = h; inner < this->last_ - 1; ++inner)
00249             {
00250               this->pfiles_[inner] = this->pfiles_[inner + 1];
00251             }
00252           // subtract 1 from last_ to indicate we have one fewer profiles
00253           this->last_--;
00254           found = 1;
00255           break;
00256         }
00257     }
00258   if ( found == 0)
00259     return -1; // profile not found.
00260   return 0;
00261 }

int TAO_MProfile::remove_profiles ( const TAO_MProfile pfiles  ) 

remove from this MProfile any profiles which also appear in pfiles.

Definition at line 264 of file MProfile.cpp.

References pfiles().

00265 {
00266   for (TAO_PHandle h = 0; h < pfiles->last_; ++h)
00267     {
00268       if (this->remove_profile (pfiles->pfiles_[h]) < 0)
00269         return -1;
00270     }
00271   return 0;
00272 }

ACE_INLINE void TAO_MProfile::rewind ( void   ) 

Sets the current slot back to 0.

Definition at line 140 of file MProfile.inl.

References current_.

Referenced by TAO_Stub::next_profile_i(), TAO_Stub::reset_base(), and TAO_Stub::reset_profiles_i().

00141 {
00142   current_ = 0;
00143 }

int TAO_MProfile::set ( const TAO_MProfile mprofile  ) 

Inits this to the values of mprofile. NOTE: We use mprofile->last_ instead of mprofile->size_ to set this->size_. This is so we can use set () to trim a profile list!! NOT THREAD SAFE

Definition at line 122 of file MProfile.cpp.

References TAO_Profile::_incr_refcnt(), last_, pfiles_, and set().

00123 {
00124   // NOTE: We use mprofile->last_ instead of mprofile->size_ to set
00125   // this->size_.  This is so we can use set () to trim a profile
00126   // list!!
00127 
00128   this->set (mprofile.last_);
00129 
00130   // set indexes ...
00131   this->last_ = mprofile.last_;
00132 
00133   // These are set in set (ULong);
00134   // this->current_ = 0;
00135   // this->forward_from_ = 0;
00136 
00137   // Now reference all profiles.
00138   for (TAO_PHandle h = 0; h < this->last_; ++h)
00139     {
00140       this->pfiles_[h] = mprofile.pfiles_[h];
00141       if (this->pfiles_[h] != 0)
00142         this->pfiles_[h]->_incr_refcnt ();
00143     }
00144 
00145   return 1;
00146 }

int TAO_MProfile::set ( CORBA::ULong  sz  ) 

Inits MProfile to hold sz TAO_Profiles. NOT THREAD SAFE

Definition at line 67 of file MProfile.cpp.

References ACE_NEW_RETURN, cleanup(), pfiles_, and size_.

Referenced by TAO_Stub::base_profiles(), TAO_Connector::make_mprofile(), operator=(), set(), and TAO_MProfile().

00068 {
00069   if (sz == 0)
00070     {
00071       this->cleanup ();
00072       return 0;
00073     }
00074 
00075   // See if we already have an existing profile list or if we need to
00076   // get ridof what we have.
00077   if (this->size_ != 0)
00078     {
00079       // Release all of our profiles.
00080 
00081       for (TAO_PHandle h = 0;
00082            h < this->size_;
00083            ++h)
00084         if (this->pfiles_[h])
00085           {
00086             this->pfiles_[h]->_decr_refcnt ();
00087             this->pfiles_[h] = 0;
00088           }
00089 
00090       // Next see if we can reuse our profile list memory
00091       if (this->size_ < sz)
00092         {
00093           // we cant reuse memory since the current array is too small!
00094           delete [] this->pfiles_;
00095 
00096           ACE_NEW_RETURN (this->pfiles_,
00097                           TAO_Profile *[sz],
00098                           -1);
00099           this->size_ = sz;
00100         }
00101       // else , leave this->size and this->pfiles alone!
00102     }
00103   else
00104     {
00105       // first time, initialize!
00106       ACE_NEW_RETURN (this->pfiles_,
00107                       TAO_Profile *[sz],
00108                       -1);
00109       this->size_ = sz;
00110     }
00111 
00112   this->last_ = 0;
00113   this->current_ = 0;
00114 
00115   for (TAO_PHandle i = 0; i != this->size_; ++i)
00116     this->pfiles_[i] = 0;
00117 
00118   return this->size_;
00119 }

ACE_INLINE CORBA::ULong TAO_MProfile::size ( void   )  const

return the maximum number of profiles that can be stored in this container, (size_+1)

Definition at line 180 of file MProfile.inl.

References size_.

Referenced by TAO_IIOP_Acceptor::create_new_profile(), TAO::LocateRequest_Invocation_Adapter::object_forwarded(), and TAO::Invocation_Adapter::object_forwarded().

00181 {
00182   return this->size_;
00183 }


Friends And Related Function Documentation

friend class TAO_Profile [friend]

Stores the policy list for the profile of this MProfile.

Definition at line 197 of file MProfile.h.


Member Data Documentation

TAO_PHandle TAO_MProfile::current_ [private]

Points to the next profile to be used. 0 ... size_.

Definition at line 238 of file MProfile.h.

Referenced by cleanup(), get_cnext(), get_cprev(), get_current_handle(), get_current_profile(), get_next(), get_prev(), and rewind().

TAO_MProfile* TAO_MProfile::forward_from_ [private]

Used for chaning references when the current profile is forwarded. Note, this will only be valid for an MProfile which contains a list of forward_profiles for some initial or base profile. This is a backward reference to the profile list which received the relocate message. The actual profile what was forwarded will be forward_from_->get_current_profile ()

Definition at line 232 of file MProfile.h.

Referenced by forward_from().

CORBA::Boolean TAO_MProfile::is_policy_list_initialized_ [protected]

Definition at line 200 of file MProfile.h.

Referenced by init_policy_list().

TAO_PHandle TAO_MProfile::last_ [private]

Index plus 1 of last valid entry! May be < size_.

Definition at line 244 of file MProfile.h.

Referenced by add_profile(), add_profiles(), cleanup(), get_cnext(), get_cprev(), get_current_profile(), get_next(), get_prev(), get_profile(), give_profile(), give_shared_profile(), hash(), is_equivalent(), profile_count(), remove_profile(), and set().

TAO_SYNCH_RECURSIVE_MUTEX TAO_MProfile::mutex_ [protected]

Mutex used to make sure that only one policy list is created.

Definition at line 204 of file MProfile.h.

TAO_Profile** TAO_MProfile::pfiles_ [private]

Actual list of profiles.

Definition at line 235 of file MProfile.h.

Referenced by add_profile(), cleanup(), get_cnext(), get_cprev(), get_current_profile(), get_next(), get_prev(), get_profile(), give_profile(), give_shared_profile(), grow(), hash(), is_equivalent(), pfiles(), and set().

CORBA::PolicyList* TAO_MProfile::policy_list_ [protected]

Definition at line 198 of file MProfile.h.

Referenced by policy_list(), and ~TAO_MProfile().

TAO_PHandle TAO_MProfile::size_ [private]

Max size of array.

Definition at line 241 of file MProfile.h.

Referenced by add_profile(), add_profiles(), cleanup(), give_profile(), grow(), set(), and size().


The documentation for this class was generated from the following files:
Generated on Tue Feb 2 17:39:37 2010 for TAO by  doxygen 1.4.7