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

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 Methods

 TAO_MProfile (CORBA::ULong sz=0)
 TAO_MProfile (const TAO_MProfile &mprofiles)
TAO_MProfile & operator= (const TAO_MProfile &mprofiles)
 Assigment operator. More...

 ~TAO_MProfile (void)
 Destructor: decrements reference count on all references profiles! More...

int set (CORBA::ULong sz)
 Inits MProfile to hold sz TAO_Profiles. NOT THREAD SAFE. More...

int set (const TAO_MProfile &mprofile)
int grow (CORBA::ULong sz)
 increase the number of profiles this object can hold. NOT THREAD SAFE. More...

TAO_Profileget_cnext (void)
 Treat as a circular list. More...

TAO_Profileget_next (void)
 Get next profile in list, return 0 at end of list. More...

TAO_Profileget_cprev (void)
 Assume a circular list of profiles. More...

TAO_Profileget_prev (void)
 Get previous profile, stop at beginning of list and return 0. More...

TAO_Profileget_current_profile (void)
 Return a pointer to the current profile, will not increment reference pointer. More...

TAO_Profileget_profile (TAO_PHandle handle)
 Return a pointer to the profile referenced by handle void. More...

TAO_PHandle get_current_handle (void)
 Returns the index for the current profile. More...

TAO_PHandle get_current_handle (void) const
 Returns the index for the current profile. More...

CORBA::ULong profile_count (void) const
 Returns the number of profiles stored in the list (last_+1). More...

CORBA::ULong size (void) const
 return the maximum number of profiles that can be stored in this container, (size_+1). More...

const TAO_Profileget_profile (CORBA::ULong slot) const
 Return the profile at position <slot>. If <slot> is out of range it returns 0. More...

void rewind (void)
 Sets the current slot back to 0. More...

int 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! More...

int give_profile (TAO_Profile *pfile)
 Return the index of this entry or -1 if it can not be added. this object assumes ownership of this profile!! More...

int add_profiles (TAO_MProfile *pfiles)
 append the profiles in pfiles to this object. The count will be incremented on the individual profile objects. More...

int remove_profile (const TAO_Profile *pfile)
 remove from this MProfile any profiles which also appear in pfiles. More...

int remove_profiles (const TAO_MProfile *pfiles)
 remove from this MProfile any profiles which also appear in pfiles. More...

void 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. More...

TAO_MProfile * forward_from (void)
 Returns a pointer to the profile which was forwarded. More...

CORBA::Boolean is_equivalent (const TAO_MProfile *rhs)
CORBA::ULong hash (CORBA::ULong max ACE_ENV_ARG_DECL)
void policy_list (CORBA::PolicyList *policy_list)
 Sets the policies list associated with the profiles owned by the TAO_MProfile. More...

CORBA::PolicyListpolicy_list (ACE_ENV_SINGLE_ARG_DECL)
 Gets the policies list associated with the profiles owned by the TAO_MProfile. More...


Protected Methods

void create_policy_list (ACE_ENV_SINGLE_ARG_DECL)
 This method handle the dynamic allocation of the data member <policy_list_>. More...

void init_policy_list (ACE_ENV_SINGLE_ARG_DECL)
 Initialize the policy list, demarsharling the policy. More...

TAO_Profile ** pfiles (void) const
 return the complete list of profiles, this object retains ownership! More...


Protected Attributes

CORBA::PolicyListpolicy_list_
CORBA::Boolean is_policy_list_initialized_
TAO_SYNCH_RECURSIVE_MUTEX mutex_
 Mutex used to make sure that only one policy list is created. More...


Private Methods

void cleanup (void)
 Helper method to implement the destructor. More...


Private Attributes

TAO_MProfile * forward_from_
TAO_Profile ** pfiles_
 Actual list of profiles. More...

TAO_PHandle current_
 Points to the next profile to be used. 0 ... size_. More...

TAO_PHandle size_
 Max size of array. More...

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


Friends

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


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 46 of file MProfile.h.


Constructor & Destructor Documentation

ACE_INLINE TAO_MProfile::TAO_MProfile CORBA::ULong    sz = 0
 

Definition at line 7 of file MProfile.i.

References set.

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

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 20 of file MProfile.i.

References set.

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

TAO_MProfile::~TAO_MProfile void   
 

Destructor: decrements reference count on all references profiles!

Definition at line 18 of file MProfile.cpp.

References ACE_CATCHANY, ACE_DECLARE_NEW_CORBA_ENV, ACE_ENDTRY, ACE_ENV_SINGLE_ARG_PARAMETER, ACE_TRY, ACE_TRY_CHECK, cleanup, TAO_Unbounded_Base_Sequence::length, and policy_list_.

00019 {
00020   if (this->policy_list_ != 0)
00021     {
00022       ACE_DECLARE_NEW_CORBA_ENV;
00023       const CORBA::ULong len = this->policy_list_->length ();
00024       for (CORBA::ULong i = 0; i < len; ++i)
00025         {
00026           ACE_TRY
00027             {
00028               (*this->policy_list_)[i]->destroy (ACE_ENV_SINGLE_ARG_PARAMETER);
00029               ACE_TRY_CHECK;
00030             }
00031           ACE_CATCHANY
00032             {
00033               // Ignore all exceptions to allow other policies to be
00034               // destroyed.
00035             }
00036           ACE_ENDTRY;
00037         }
00038 
00039       delete this->policy_list_;
00040     }
00041 
00042   this->cleanup ();
00043 }


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 175 of file MProfile.cpp.

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

Referenced by add_profiles.

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

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 196 of file MProfile.cpp.

References add_profile, grow, last_, pfiles_, size_, and TAO_PHandle.

Referenced by TAO_CORBALOC_Parser::parse_string_mprofile_helper.

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

void TAO_MProfile::cleanup void    [private]
 

Helper method to implement the destructor.

Definition at line 46 of file MProfile.cpp.

References TAO_Profile::_decr_refcnt, current_, last_, pfiles_, size_, and TAO_PHandle.

Referenced by set, and ~TAO_MProfile.

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

ACE_INLINE void TAO_MProfile::create_policy_list ACE_ENV_SINGLE_ARG_DECL    [protected]
 

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

Definition at line 195 of file MProfile.i.

References ACE_ENV_SINGLE_ARG_DECL, ACE_NEW_THROW_EX, and TAO_DEFAULT_MINOR_CODE.

Referenced by policy_list.

00196 {
00197   ACE_NEW_THROW_EX (this->policy_list_,
00198                     CORBA::PolicyList,
00199                     CORBA::NO_MEMORY (TAO_DEFAULT_MINOR_CODE,
00200                                       CORBA::COMPLETED_NO)
00201                     );
00202 }

ACE_INLINE TAO_MProfile * TAO_MProfile::forward_from void   
 

Returns a pointer to the profile which was forwarded.

Definition at line 163 of file MProfile.i.

References forward_from_.

00164 {
00165   return this->forward_from_;
00166 }

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 156 of file MProfile.i.

References forward_from_.

Referenced by TAO_Stub::add_forward_profiles, and TAO_Stub::forward_back_one.

00157 {
00158   this->forward_from_ = from;
00159 }

ACE_INLINE TAO_Profile * TAO_MProfile::get_cnext void   
 

Treat as a circular list.

Definition at line 45 of file MProfile.i.

References current_, last_, and pfiles_.

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

ACE_INLINE TAO_Profile * TAO_MProfile::get_cprev void   
 

Assume a circular list of profiles.

Definition at line 70 of file MProfile.i.

References current_, last_, and pfiles_.

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

ACE_INLINE TAO_PHandle TAO_MProfile::get_current_handle void    const
 

Returns the index for the current profile.

Definition at line 129 of file MProfile.i.

References current_.

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

ACE_INLINE TAO_PHandle TAO_MProfile::get_current_handle void   
 

Returns the index for the current profile.

Definition at line 120 of file MProfile.i.

References current_.

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

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 108 of file MProfile.i.

References current_, last_, and pfiles_.

Referenced by TAO_Stub::forward_back_one, and init_policy_list.

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

ACE_INLINE TAO_Profile * TAO_MProfile::get_next void   
 

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

Definition at line 60 of file MProfile.i.

References current_, last_, and pfiles_.

Referenced by TAO_Stub::next_forward_profile, TAO_Stub::next_profile_i, and TAO_Stub::reset_base.

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

ACE_INLINE TAO_Profile * TAO_MProfile::get_prev void   
 

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

Definition at line 85 of file MProfile.i.

References current_, last_, and pfiles_.

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

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 181 of file MProfile.i.

References last_, and pfiles_.

00182 {
00183   if (slot >= this->last_)
00184     return 0;
00185   return this->pfiles_[slot];
00186 }

ACE_INLINE TAO_Profile * TAO_MProfile::get_profile TAO_PHandle    handle
 

Return a pointer to the profile referenced by handle void.

Definition at line 99 of file MProfile.i.

References last_, pfiles_, and TAO_PHandle.

Referenced by TAO_IIOP_Acceptor::create_shared_profile, TAO_ORB_Core::create_stub_object, TAO_Acceptor_Registry::is_collocated, CORBA_ORB::object_to_string, operator<<, and TAO_Stub::TAO_Stub.

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

ACE_INLINE int TAO_MProfile::give_profile TAO_Profile   pfile
 

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

Definition at line 143 of file MProfile.i.

References last_, pfiles_, and size_.

Referenced by TAO_IIOP_Acceptor::create_new_profile, TAO_IIOP_Acceptor::create_shared_profile, and operator>>.

00144 {
00145   // skip by the used slots
00146   if (last_ == size_) // full!
00147     return -1;
00148 
00149   pfiles_[last_++] = pfile;
00150 
00151   return last_ - 1;
00152 }

int TAO_MProfile::grow CORBA::ULong    sz
 

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

Definition at line 147 of file MProfile.cpp.

References ACE_NEW_RETURN, pfiles_, size_, and TAO_PHandle.

Referenced by add_profile, add_profiles, and TAO_IIOP_Acceptor::create_new_profile.

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

CORBA::ULong TAO_MProfile::hash CORBA::ULong max    ACE_ENV_ARG_DECL
 

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

Definition at line 285 of file MProfile.cpp.

References ACE_CHECK_RETURN, ACE_ENV_ARG_DECL, ACE_ENV_ARG_PARAMETER, TAO_Profile::hash, last_, pfiles_, and TAO_PHandle.

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

void TAO_MProfile::init_policy_list ACE_ENV_SINGLE_ARG_DECL    [protected]
 

Initialize the policy list, demarsharling the policy.

Definition at line 308 of file MProfile.cpp.

References ACE_CHECK, ACE_ENV_SINGLE_ARG_DECL, ACE_ENV_SINGLE_ARG_PARAMETER, get_current_profile, is_policy_list_initialized_, and TAO_Profile::policies.

Referenced by policy_list.

00309 {
00310   // The first time this method is called
00311   // it causes the initialization of the policies
00312   // for the current profile.
00313 
00314   this->get_current_profile ()->policies (ACE_ENV_SINGLE_ARG_PARAMETER);
00315   ACE_CHECK;
00316 
00317   this->is_policy_list_initialized_ = 1;
00318 }

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 271 of file MProfile.cpp.

References TAO_Profile::is_equivalent, last_, pfiles_, and TAO_PHandle.

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

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

Assigment operator.

Definition at line 33 of file MProfile.i.

References set.

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

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

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

Definition at line 189 of file MProfile.i.

References pfiles_.

00190 {
00191   return this->pfiles_;
00192 }

CORBA::PolicyList * TAO_MProfile::policy_list ACE_ENV_SINGLE_ARG_DECL   
 

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

Definition at line 321 of file MProfile.cpp.

References ACE_CHECK_RETURN, ACE_ENV_SINGLE_ARG_DECL, ACE_ENV_SINGLE_ARG_PARAMETER, ACE_GUARD_RETURN, ACE_NEW_THROW_EX, create_policy_list, init_policy_list, is_policy_list_initialized_, policy_list_, TAO_DEFAULT_MINOR_CODE, and TAO_SYNCH_RECURSIVE_MUTEX.

00322 {
00323   if (!this->is_policy_list_initialized_)
00324     {
00325       ACE_GUARD_RETURN (TAO_SYNCH_RECURSIVE_MUTEX,
00326                         guard,
00327                         this->mutex_,
00328                         0);
00329 
00330       if (this->policy_list_ == 0)
00331         {
00332           this->create_policy_list (ACE_ENV_SINGLE_ARG_PARAMETER);
00333           ACE_CHECK_RETURN (0);
00334 
00335           this->init_policy_list (ACE_ENV_SINGLE_ARG_PARAMETER);
00336           ACE_CHECK_RETURN (0);
00337         }
00338     }
00339   CORBA::PolicyList *ret_val = 0;
00340   ACE_NEW_THROW_EX (ret_val,
00341                     CORBA::PolicyList (*this->policy_list_),
00342                     CORBA::NO_MEMORY (TAO_DEFAULT_MINOR_CODE,
00343                                       CORBA::COMPLETED_NO));
00344   ACE_CHECK_RETURN (0);
00345 
00346   return ret_val;
00347 }

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 206 of file MProfile.i.

References policy_list_.

Referenced by TAO_ORB_Core::create_stub_object.

00207 {
00208   this->policy_list_ = policy_list;
00209 }

ACE_INLINE CORBA::ULong TAO_MProfile::profile_count void    const
 

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

Definition at line 169 of file MProfile.i.

References last_.

Referenced by TAO_IIOP_Acceptor::create_new_profile, TAO_IIOP_Acceptor::create_shared_profile, TAO_ORB_Core::create_stub_object, TAO_Acceptor_Registry::is_collocated, CORBA_ORB::object_to_string, operator<<, operator>>, and TAO_Stub::TAO_Stub.

00170 {
00171   return this->last_;
00172 }

int TAO_MProfile::remove_profile const TAO_Profile   pfile
 

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

Definition at line 231 of file MProfile.cpp.

References TAO_Profile::_decr_refcnt, TAO_Profile::is_equivalent, last_, pfiles_, and TAO_PHandle.

Referenced by remove_profiles.

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

int TAO_MProfile::remove_profiles const TAO_MProfile *    pfiles
 

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

Definition at line 260 of file MProfile.cpp.

References last_, pfiles_, remove_profile, and TAO_PHandle.

00261 {
00262   for (TAO_PHandle h = 0; h < pfiles->last_; ++h)
00263     {
00264       if (this->remove_profile (pfiles->pfiles_[h]) < 0)
00265         return -1;
00266     }
00267   return 0;
00268 }

ACE_INLINE void TAO_MProfile::rewind void   
 

Sets the current slot back to 0.

Definition at line 138 of file MProfile.i.

References current_.

Referenced by TAO_Stub::add_forward_profiles, and TAO_Stub::reset_base.

00139 {
00140   current_ = 0;
00141 }

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 118 of file MProfile.cpp.

References TAO_Profile::_incr_refcnt, last_, pfiles_, set, size_, and TAO_PHandle.

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

int TAO_MProfile::set CORBA::ULong    sz
 

Inits MProfile to hold sz TAO_Profiles. NOT THREAD SAFE.

Definition at line 63 of file MProfile.cpp.

References TAO_Profile::_decr_refcnt, ACE_NEW_RETURN, cleanup, current_, last_, pfiles_, size_, and TAO_PHandle.

Referenced by TAO_Stub::base_profiles, operator=, set, and TAO_MProfile.

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

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 175 of file MProfile.i.

References size_.

Referenced by TAO_IIOP_Acceptor::create_new_profile.

00176 {
00177   return this->size_;
00178 }


Friends And Related Function Documentation

friend class TAO_Profile [friend]
 

Stores the policy list for the profile of this MProfile.

Definition at line 189 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 224 of file MProfile.h.

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

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 218 of file MProfile.h.

Referenced by forward_from.

CORBA::Boolean TAO_MProfile::is_policy_list_initialized_ [protected]
 

Definition at line 192 of file MProfile.h.

Referenced by init_policy_list, and policy_list.

TAO_PHandle TAO_MProfile::last_ [private]
 

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

Definition at line 230 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, hash, is_equivalent, profile_count, remove_profile, remove_profiles, 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 196 of file MProfile.h.

TAO_Profile** TAO_MProfile::pfiles_ [private]
 

Actual list of profiles.

Definition at line 221 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, grow, hash, is_equivalent, pfiles, remove_profile, remove_profiles, and set.

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

Definition at line 190 of file MProfile.h.

Referenced by TAO_Profile::policies, policy_list, and ~TAO_MProfile.

TAO_PHandle TAO_MProfile::size_ [private]
 

Max size of array.

Definition at line 227 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 Mon Jun 16 15:28:57 2003 for TAO by doxygen1.2.14 written by Dimitri van Heesch, © 1997-2002