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

Atomic_Op_T.i

Go to the documentation of this file.
00001 // -*- C++ -*-
00002 // $Id: Atomic_Op_T.i,v 1.1.1.1 2003/02/21 18:36:32 chad Exp $
00003 
00004 //
00005 // ACE_Atomic_Op_Ex inline functions
00006 //
00007 
00008 template <class ACE_LOCK, class TYPE> ACE_INLINE TYPE
00009 ACE_Atomic_Op_Ex<ACE_LOCK, TYPE>::operator++ (void)
00010 {
00011 // ACE_TRACE ("ACE_Atomic_Op_Ex<ACE_LOCK, TYPE>::operator++");
00012   ACE_GUARD_RETURN (ACE_LOCK, ace_mon, this->mutex_, this->value_);
00013   return ++this->value_;
00014 }
00015 
00016 template <class ACE_LOCK, class TYPE> ACE_INLINE TYPE
00017 ACE_Atomic_Op_Ex<ACE_LOCK, TYPE>::operator+= (const TYPE &rhs)
00018 {
00019 // ACE_TRACE ("ACE_Atomic_Op_Ex<ACE_LOCK, TYPE>::operator+=");
00020   ACE_GUARD_RETURN (ACE_LOCK, ace_mon, this->mutex_, this->value_);
00021   return this->value_ += rhs;
00022 }
00023 
00024 template <class ACE_LOCK, class TYPE> ACE_INLINE TYPE
00025 ACE_Atomic_Op_Ex<ACE_LOCK, TYPE>::operator-- (void)
00026 {
00027 // ACE_TRACE ("ACE_Atomic_Op_Ex<ACE_LOCK, TYPE>::operator--");
00028   ACE_GUARD_RETURN (ACE_LOCK, ace_mon, this->mutex_, this->value_);
00029   return --this->value_;
00030 }
00031 
00032 template <class ACE_LOCK, class TYPE> ACE_INLINE TYPE
00033 ACE_Atomic_Op_Ex<ACE_LOCK, TYPE>::operator-= (const TYPE &rhs)
00034 {
00035 // ACE_TRACE ("ACE_Atomic_Op_Ex<ACE_LOCK, TYPE>::operator-=");
00036   ACE_GUARD_RETURN (ACE_LOCK, ace_mon, this->mutex_, this->value_);
00037   return this->value_ -= rhs;
00038 }
00039 
00040 template <class ACE_LOCK, class TYPE> ACE_INLINE
00041 ACE_Atomic_Op_Ex<ACE_LOCK, TYPE>::ACE_Atomic_Op_Ex (const ACE_Atomic_Op_Ex<ACE_LOCK, TYPE> &rhs)
00042   : mutex_ (rhs.mutex_)
00043 {
00044 // ACE_TRACE ("ACE_Atomic_Op_Ex<ACE_LOCK, TYPE>::ACE_Atomic_Op_Ex");
00045   *this = rhs; // Invoke the assignment operator.
00046 }
00047 
00048 template <class ACE_LOCK, class TYPE> ACE_INLINE TYPE
00049 ACE_Atomic_Op_Ex<ACE_LOCK, TYPE>::operator++ (int)
00050 {
00051 // ACE_TRACE ("ACE_Atomic_Op_Ex<ACE_LOCK, TYPE>::operator++");
00052   ACE_GUARD_RETURN (ACE_LOCK, ace_mon, this->mutex_, this->value_);
00053   return this->value_++;
00054 }
00055 
00056 template <class ACE_LOCK, class TYPE> ACE_INLINE TYPE
00057 ACE_Atomic_Op_Ex<ACE_LOCK, TYPE>::operator-- (int)
00058 {
00059 // ACE_TRACE ("ACE_Atomic_Op_Ex<ACE_LOCK, TYPE>::operator--");
00060   ACE_GUARD_RETURN (ACE_LOCK, ace_mon, this->mutex_, this->value_);
00061   return this->value_--;
00062 }
00063 
00064 template <class ACE_LOCK, class TYPE> ACE_INLINE int
00065 ACE_Atomic_Op_Ex<ACE_LOCK, TYPE>::operator== (const TYPE &rhs) const
00066 {
00067 // ACE_TRACE ("ACE_Atomic_Op_Ex<ACE_LOCK, TYPE>::operator==");
00068   ACE_GUARD_RETURN (ACE_LOCK, ace_mon, (ACE_LOCK &) this->mutex_, 0);
00069   return this->value_ == rhs;
00070 }
00071 
00072 template <class ACE_LOCK, class TYPE> ACE_INLINE int
00073 ACE_Atomic_Op_Ex<ACE_LOCK, TYPE>::operator!= (const TYPE &rhs) const
00074 {
00075 // ACE_TRACE ("ACE_Atomic_Op_Ex<ACE_LOCK, TYPE>::operator!=");
00076   return !(*this == rhs);
00077 }
00078 
00079 template <class ACE_LOCK, class TYPE> ACE_INLINE int
00080 ACE_Atomic_Op_Ex<ACE_LOCK, TYPE>::operator>= (const TYPE &rhs) const
00081 {
00082 // ACE_TRACE ("ACE_Atomic_Op_Ex<ACE_LOCK, TYPE>::operator>=");
00083   ACE_GUARD_RETURN (ACE_LOCK, ace_mon, (ACE_LOCK &) this->mutex_, 0);
00084   return this->value_ >= rhs;
00085 }
00086 
00087 template <class ACE_LOCK, class TYPE> ACE_INLINE int
00088 ACE_Atomic_Op_Ex<ACE_LOCK, TYPE>::operator> (const TYPE &rhs) const
00089 {
00090 // ACE_TRACE ("ACE_Atomic_Op_Ex<ACE_LOCK, TYPE>::operator>");
00091   ACE_GUARD_RETURN (ACE_LOCK, ace_mon, (ACE_LOCK &) this->mutex_, 0);
00092   return this->value_ > rhs;
00093 }
00094 
00095 template <class ACE_LOCK, class TYPE> ACE_INLINE int
00096 ACE_Atomic_Op_Ex<ACE_LOCK, TYPE>::operator<= (const TYPE &rhs) const
00097 {
00098 // ACE_TRACE ("ACE_Atomic_Op_Ex<ACE_LOCK, TYPE>::operator<=");
00099   ACE_GUARD_RETURN (ACE_LOCK, ace_mon, (ACE_LOCK &) this->mutex_, 0);
00100   return this->value_ <= rhs;
00101 }
00102 
00103 template <class ACE_LOCK, class TYPE> ACE_INLINE int
00104 ACE_Atomic_Op_Ex<ACE_LOCK, TYPE>::operator< (const TYPE &rhs) const
00105 {
00106 // ACE_TRACE ("ACE_Atomic_Op_Ex<ACE_LOCK, TYPE>::operator<");
00107   ACE_GUARD_RETURN (ACE_LOCK, ace_mon, (ACE_LOCK &) this->mutex_, 0);
00108   return this->value_ < rhs;
00109 }
00110 
00111 template <class ACE_LOCK, class TYPE> ACE_INLINE void
00112 ACE_Atomic_Op_Ex<ACE_LOCK, TYPE>::operator= (const ACE_Atomic_Op_Ex<ACE_LOCK, TYPE> &rhs)
00113 {
00114 // ACE_TRACE ("ACE_Atomic_Op_Ex<ACE_LOCK, TYPE>::operator=");
00115   if (&rhs == this)
00116     return; // Avoid deadlock...
00117   ACE_GUARD (ACE_LOCK, ace_mon, this->mutex_);
00118   // This will call ACE_Atomic_Op_Ex::TYPE(), which will ensure the value
00119   // of <rhs> is acquired atomically.
00120 
00121   this->value_ = rhs.value ();
00122 }
00123 
00124 template <class ACE_LOCK, class TYPE> ACE_INLINE TYPE
00125 ACE_Atomic_Op_Ex<ACE_LOCK, TYPE>::value (void) const
00126 {
00127 // ACE_TRACE ("ACE_Atomic_Op_Ex<ACE_LOCK, TYPE>::value");
00128   ACE_GUARD_RETURN (ACE_LOCK, ace_mon, (ACE_LOCK &) this->mutex_, this->value_);
00129   return this->value_;
00130 }
00131 
00132 template <class ACE_LOCK, class TYPE> ACE_INLINE TYPE &
00133 ACE_Atomic_Op_Ex<ACE_LOCK, TYPE>::value_i (void)
00134 {
00135   // Explicitly return <value_> (by reference).  This gives the user
00136   // full, unrestricted access to the underlying value.  This method
00137   // will usually be used in conjunction with explicit access to the
00138   // lock.  Use with care ;-)
00139   return this->value_;
00140 }
00141 
00142 template <class ACE_LOCK, class TYPE> ACE_INLINE void
00143 ACE_Atomic_Op_Ex<ACE_LOCK, TYPE>::operator= (const TYPE &rhs)
00144 {
00145 // ACE_TRACE ("ACE_Atomic_Op_Ex<ACE_LOCK, TYPE>::operator=");
00146   ACE_GUARD (ACE_LOCK, ace_mon, (ACE_LOCK &) this->mutex_);
00147   this->value_ = rhs;
00148 }
00149 
00150 //
00151 // ACE_Atomic_Op inline functions
00152 //
00153 
00154 template <class ACE_LOCK, class TYPE> ACE_INLINE void
00155 ACE_Atomic_Op<ACE_LOCK, TYPE>::operator= (const TYPE &i)
00156 {
00157   this->impl_ = i;
00158 }
00159 
00160 template <class ACE_LOCK, class TYPE> ACE_INLINE void
00161 ACE_Atomic_Op<ACE_LOCK, TYPE>::operator= (const ACE_Atomic_Op<ACE_LOCK, TYPE> &rhs)
00162 {
00163   this->impl_ = rhs.impl_;
00164 }
00165 
00166 template <class ACE_LOCK, class TYPE> ACE_INLINE TYPE
00167 ACE_Atomic_Op<ACE_LOCK, TYPE>::operator++ (void)
00168 {
00169   return ++this->impl_;
00170 }
00171 
00172 template <class ACE_LOCK, class TYPE> ACE_INLINE TYPE
00173 ACE_Atomic_Op<ACE_LOCK, TYPE>::operator++ (int)
00174 {
00175   return this->impl_++;
00176 }
00177 
00178 template <class ACE_LOCK, class TYPE> ACE_INLINE TYPE
00179 ACE_Atomic_Op<ACE_LOCK, TYPE>::operator+= (const TYPE &rhs)
00180 {
00181   return this->impl_ += rhs;
00182 }
00183 
00184 template <class ACE_LOCK, class TYPE> ACE_INLINE TYPE
00185 ACE_Atomic_Op<ACE_LOCK, TYPE>::operator-- (void)
00186 {
00187   return --this->impl_;
00188 }
00189 
00190 template <class ACE_LOCK, class TYPE> ACE_INLINE TYPE
00191 ACE_Atomic_Op<ACE_LOCK, TYPE>::operator-- (int)
00192 {
00193   return this->impl_--;
00194 }
00195 
00196 template <class ACE_LOCK, class TYPE> ACE_INLINE TYPE
00197 ACE_Atomic_Op<ACE_LOCK, TYPE>::operator-= (const TYPE &rhs)
00198 {
00199   return this->impl_ -= rhs;
00200 }
00201 
00202 template <class ACE_LOCK, class TYPE> ACE_INLINE int
00203 ACE_Atomic_Op<ACE_LOCK, TYPE>::operator== (const TYPE &rhs) const
00204 {
00205   return this->impl_ == rhs;
00206 }
00207 
00208 template <class ACE_LOCK, class TYPE> ACE_INLINE int
00209 ACE_Atomic_Op<ACE_LOCK, TYPE>::operator!= (const TYPE &rhs) const
00210 {
00211   return this->impl_ != rhs;
00212 }
00213 
00214 template <class ACE_LOCK, class TYPE> ACE_INLINE int
00215 ACE_Atomic_Op<ACE_LOCK, TYPE>::operator>= (const TYPE &rhs) const
00216 {
00217   return this->impl_ >= rhs;
00218 }
00219 
00220 template <class ACE_LOCK, class TYPE> ACE_INLINE int
00221 ACE_Atomic_Op<ACE_LOCK, TYPE>::operator> (const TYPE &rhs) const
00222 {
00223   return this->impl_ > rhs;
00224 }
00225 
00226 template <class ACE_LOCK, class TYPE> ACE_INLINE int
00227 ACE_Atomic_Op<ACE_LOCK, TYPE>::operator<= (const TYPE &rhs) const
00228 {
00229   return this->impl_ <= rhs;
00230 }
00231 
00232 template <class ACE_LOCK, class TYPE> ACE_INLINE int
00233 ACE_Atomic_Op<ACE_LOCK, TYPE>::operator< (const TYPE &rhs) const
00234 {
00235   return this->impl_ < rhs;
00236 }
00237 
00238 template <class ACE_LOCK, class TYPE> ACE_INLINE TYPE
00239 ACE_Atomic_Op<ACE_LOCK, TYPE>::value (void) const
00240 {
00241   return this->impl_.value ();
00242 }
00243 
00244 template <class ACE_LOCK, class TYPE> ACE_INLINE void
00245 ACE_Atomic_Op<ACE_LOCK, TYPE>::dump (void) const
00246 {
00247   this->impl_.dump ();
00248   return;
00249 }
00250 
00251 template <class ACE_LOCK, class TYPE> ACE_INLINE ACE_LOCK &
00252 ACE_Atomic_Op<ACE_LOCK, TYPE>::mutex (void)
00253 {
00254   return this->own_mutex_;
00255 }
00256 
00257 template <class ACE_LOCK, class TYPE> ACE_INLINE TYPE &
00258 ACE_Atomic_Op<ACE_LOCK, TYPE>::value_i (void)
00259 {
00260   return this->impl_.value_i ();
00261 }

Generated on Mon Jun 16 11:19:11 2003 for ACE by doxygen1.2.14 written by Dimitri van Heesch, © 1997-2002