MProfile.i

Go to the documentation of this file.
00001 // -*- C++ -*-
00002 //
00003 // MProfile.i,v 1.34 2006/04/26 17:12:47 mesnier_p Exp
00004 
00005 
00006 TAO_BEGIN_VERSIONED_NAMESPACE_DECL
00007 
00008 ACE_INLINE
00009 TAO_MProfile::TAO_MProfile (CORBA::ULong sz)
00010   :  policy_list_ (0),
00011      is_policy_list_initialized_ (0),
00012      forward_from_(0),
00013      pfiles_ (0),
00014      current_ (0),
00015      size_ (0),
00016      last_ (0)
00017 {
00018   this->set (sz);
00019 }
00020 
00021 ACE_INLINE
00022 TAO_MProfile::TAO_MProfile (const TAO_MProfile &mprofiles)
00023   :  policy_list_ (0),
00024      is_policy_list_initialized_ (0),
00025      forward_from_(0),
00026      pfiles_ (0),
00027      current_ (0),
00028      size_ (0),
00029      last_ (0)
00030 {
00031   this->set (mprofiles);
00032 }
00033 
00034 ACE_INLINE TAO_MProfile&
00035 TAO_MProfile::operator= (const TAO_MProfile& rhs)
00036 {
00037   if (this == &rhs)
00038     return *this;
00039 
00040   this->set (rhs);
00041   return *this;
00042 }
00043 
00044 // Cyclic get next.  It will simply cycle through the complete list.
00045 
00046 ACE_INLINE TAO_Profile *
00047 TAO_MProfile::get_cnext (void)
00048 {
00049   if (last_ == 0)
00050     return 0;
00051 
00052   if (current_ == last_)
00053     current_ = 0;
00054 
00055   return pfiles_[current_++];
00056 }
00057 
00058 // This will return the next element until either null is found or the
00059 // end of list.  It then continues to return NULL until rewind.
00060 
00061 ACE_INLINE TAO_Profile *
00062 TAO_MProfile::get_next (void)
00063 {
00064   // Nolist or EndOfList
00065   if (last_ == 0 || current_ == last_)
00066     return 0;
00067   else
00068     return pfiles_[current_++];
00069 }
00070 
00071 ACE_INLINE TAO_Profile *
00072 TAO_MProfile::get_cprev (void)
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 }
00085 
00086 ACE_INLINE TAO_Profile *
00087 TAO_MProfile::get_prev (void)
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 }
00097 
00098 // does not affect the current_ setting!
00099 
00100 ACE_INLINE TAO_Profile *
00101 TAO_MProfile::get_profile (TAO_PHandle handle)
00102 {
00103   if (handle < last_)
00104     return pfiles_[handle];
00105   else
00106     return 0;
00107 }
00108 
00109 ACE_INLINE TAO_Profile *
00110 TAO_MProfile::get_current_profile (void)
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 }
00120 
00121 ACE_INLINE TAO_PHandle
00122 TAO_MProfile::get_current_handle (void)
00123 {
00124   if (current_ > 0)
00125     return current_ - 1;
00126   else
00127     return 0;
00128 }
00129 
00130 ACE_INLINE TAO_PHandle
00131 TAO_MProfile::get_current_handle (void) const
00132 {
00133   if (current_ > 0)
00134     return current_ - 1;
00135   else
00136     return 0;
00137 }
00138 
00139 ACE_INLINE void
00140 TAO_MProfile::rewind (void)
00141 {
00142   current_ = 0;
00143 }
00144 ACE_INLINE int
00145 TAO_MProfile::give_profile (TAO_Profile *pfile, int share)
00146 {
00147   if (share)
00148     return this->give_shared_profile(pfile);
00149   // skip by the used slots
00150   if (last_ == size_) // full!
00151     return -1;
00152 
00153   pfiles_[last_++] = pfile;
00154 
00155   return last_ - 1;
00156 }
00157 
00158 ACE_INLINE
00159 void
00160 TAO_MProfile::forward_from (TAO_MProfile *from)
00161 {
00162   this->forward_from_ = from;
00163 }
00164 
00165 ACE_INLINE
00166 TAO_MProfile *
00167 TAO_MProfile::forward_from (void)
00168 {
00169   return this->forward_from_;
00170 }
00171 
00172 ACE_INLINE CORBA::ULong
00173 TAO_MProfile::profile_count (void) const
00174 {
00175   return this->last_;
00176 }
00177 
00178 ACE_INLINE CORBA::ULong
00179 TAO_MProfile::size (void) const
00180 {
00181   return this->size_;
00182 }
00183 
00184 ACE_INLINE const TAO_Profile*
00185 TAO_MProfile::get_profile (CORBA::ULong slot) const
00186 {
00187   if (slot >= this->last_)
00188     return 0;
00189   return this->pfiles_[slot];
00190 }
00191 
00192 ACE_INLINE TAO_Profile **
00193 TAO_MProfile::pfiles (void) const
00194 {
00195   return this->pfiles_;
00196 }
00197 
00198 ACE_INLINE void
00199 TAO_MProfile::policy_list (CORBA::PolicyList *policy_list)
00200 {
00201   this->policy_list_ = policy_list;
00202 }
00203 
00204 TAO_END_VERSIONED_NAMESPACE_DECL

Generated on Thu Nov 9 11:54:16 2006 for TAO by doxygen 1.3.6