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

Based_Pointer_T.i

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

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