Based_Pointer_T.inl

Go to the documentation of this file.
00001 // -*- C++ -*-
00002 //
00003 // Based_Pointer_T.inl,v 4.3 2005/10/28 16:14:51 ossama Exp
00004 
00005 #define ACE_COMPUTE_BASED_POINTER(P) (((char *) (P) - (P)->base_offset_) + (P)->target_)
00006 #include "ace/Global_Macros.h"
00007 
00008 ACE_BEGIN_VERSIONED_NAMESPACE_DECL
00009 
00010 template <class CONCRETE> ACE_INLINE CONCRETE *
00011 ACE_Based_Pointer<CONCRETE>::operator->(void)
00012 {
00013   ACE_TRACE ("ACE_Based_Pointer<CONCRETE>::operator->");
00014   return reinterpret_cast<CONCRETE *> (ACE_COMPUTE_BASED_POINTER (this));
00015 }
00016 
00017 template <class CONCRETE> ACE_INLINE void
00018 ACE_Based_Pointer_Basic<CONCRETE>::operator = (CONCRETE *rhs)
00019 {
00020   ACE_TRACE ("ACE_Based_Pointer_Basic<CONCRETE>::operator =");
00021   if (rhs == 0)
00022     // Store a value of <target_> that indicate "NULL" pointer.
00023     this->target_ = -1;
00024   else
00025     this->target_ = ((char *) rhs
00026                      - ((char *) this - this->base_offset_));
00027 }
00028 
00029 template <class CONCRETE> ACE_INLINE void
00030 ACE_Based_Pointer<CONCRETE>::operator = (CONCRETE *rhs)
00031 {
00032   ACE_TRACE ("ACE_Based_Pointer<CONCRETE>::operator =");
00033   if (rhs == 0)
00034     // Store a value of <target_> that indicate "NULL" pointer.
00035     this->target_ = -1;
00036   else
00037     this->target_ = ((char *) rhs
00038                      - ((char *) this - this->base_offset_));
00039 }
00040 
00041 template <class CONCRETE> ACE_INLINE CONCRETE
00042 ACE_Based_Pointer_Basic<CONCRETE>::operator *(void) const
00043 {
00044   ACE_TRACE ("ACE_Based_Pointer_Basic<CONCRETE>::operator *");
00045   return *reinterpret_cast<CONCRETE *> (ACE_COMPUTE_BASED_POINTER (this));
00046 }
00047 
00048 template <class CONCRETE> ACE_INLINE CONCRETE *
00049 ACE_Based_Pointer_Basic<CONCRETE>::addr (void) const
00050 {
00051   ACE_TRACE ("ACE_Based_Pointer_Basic<CONCRETE>::addr");
00052 
00053   if (this->target_ == -1)
00054     return 0;
00055   else
00056     return reinterpret_cast<CONCRETE *> (ACE_COMPUTE_BASED_POINTER (this));
00057 }
00058 
00059 template <class CONCRETE> ACE_INLINE
00060 ACE_Based_Pointer_Basic<CONCRETE>::operator CONCRETE *() const
00061 {
00062   ACE_TRACE ("ACE_Based_Pointer_Basic<CONCRETE>::operator CONCRETE *()");
00063 
00064   return this->addr ();
00065 }
00066 
00067 template <class CONCRETE> ACE_INLINE CONCRETE
00068 ACE_Based_Pointer_Basic<CONCRETE>::operator [] (int index) const
00069 {
00070   ACE_TRACE ("ACE_Based_Pointer_Basic<CONCRETE>::operator []");
00071   CONCRETE *c =
00072     reinterpret_cast<CONCRETE *> (ACE_COMPUTE_BASED_POINTER (this));
00073   return c[index];
00074 }
00075 
00076 template <class CONCRETE> ACE_INLINE void
00077 ACE_Based_Pointer_Basic<CONCRETE>::operator += (int index)
00078 {
00079   ACE_TRACE ("ACE_Based_Pointer_Basic<CONCRETE>::operator +=");
00080   this->base_offset_ += (index * sizeof (CONCRETE));
00081 }
00082 
00083 template <class CONCRETE> ACE_INLINE bool
00084 ACE_Based_Pointer_Basic<CONCRETE>::operator == (const ACE_Based_Pointer_Basic<CONCRETE> &rhs) const
00085 {
00086   ACE_TRACE ("ACE_Based_Pointer_Basic<CONCRETE>::operator ==");
00087   return ACE_COMPUTE_BASED_POINTER (this) == ACE_COMPUTE_BASED_POINTER (&rhs);
00088 }
00089 
00090 template <class CONCRETE> ACE_INLINE bool
00091 ACE_Based_Pointer_Basic<CONCRETE>::operator != (const ACE_Based_Pointer_Basic<CONCRETE> &rhs) const
00092 {
00093   ACE_TRACE ("ACE_Based_Pointer_Basic<CONCRETE>::operator !=");
00094   return !(*this == rhs);
00095 }
00096 
00097 template <class CONCRETE> ACE_INLINE bool
00098 ACE_Based_Pointer_Basic<CONCRETE>::operator < (const ACE_Based_Pointer_Basic<CONCRETE> &rhs) const
00099 {
00100   ACE_TRACE ("ACE_Based_Pointer_Basic<CONCRETE>::operator <");
00101   return ACE_COMPUTE_BASED_POINTER (this) < ACE_COMPUTE_BASED_POINTER (&rhs);
00102 }
00103 
00104 template <class CONCRETE> ACE_INLINE bool
00105 ACE_Based_Pointer_Basic<CONCRETE>::operator <= (const ACE_Based_Pointer_Basic<CONCRETE> &rhs) const
00106 {
00107   ACE_TRACE ("ACE_Based_Pointer_Basic<CONCRETE>::operator <=");
00108   return ACE_COMPUTE_BASED_POINTER (this) <= ACE_COMPUTE_BASED_POINTER (&rhs);
00109 }
00110 
00111 template <class CONCRETE> ACE_INLINE bool
00112 ACE_Based_Pointer_Basic<CONCRETE>::operator > (const ACE_Based_Pointer_Basic<CONCRETE> &rhs) const
00113 {
00114   ACE_TRACE ("ACE_Based_Pointer_Basic<CONCRETE>::operator >");
00115   return ACE_COMPUTE_BASED_POINTER (this) > ACE_COMPUTE_BASED_POINTER (&rhs);
00116 }
00117 
00118 template <class CONCRETE> ACE_INLINE bool
00119 ACE_Based_Pointer_Basic<CONCRETE>::operator >= (const ACE_Based_Pointer_Basic<CONCRETE> &rhs) const
00120 {
00121   ACE_TRACE ("ACE_Based_Pointer_Basic<CONCRETE>::operator >=");
00122   return ACE_COMPUTE_BASED_POINTER (this) >= ACE_COMPUTE_BASED_POINTER (&rhs);
00123 }
00124 
00125 template <class CONCRETE> ACE_INLINE void
00126 ACE_Based_Pointer_Basic<CONCRETE>::operator= (const ACE_Based_Pointer_Basic<CONCRETE> &rhs)
00127 {
00128   ACE_TRACE ("ACE_Based_Pointer_Basic<CONCRETE>::operator=");
00129   *this = rhs.addr ();
00130 }
00131 
00132 template <class CONCRETE> ACE_INLINE void
00133 ACE_Based_Pointer<CONCRETE>::operator= (const ACE_Based_Pointer<CONCRETE> &rhs)
00134 {
00135   ACE_TRACE ("ACE_Based_Pointer<CONCRETE>::operator=");
00136   *this = rhs.addr ();
00137 }
00138 
00139 ACE_END_VERSIONED_NAMESPACE_DECL

Generated on Thu Nov 9 09:41:47 2006 for ACE by doxygen 1.3.6