2 #define ACE_COMPUTE_BASED_POINTER(P) (((char *) (P) - (P)->base_offset_) + (P)->target_)
3 #include "ace/Global_Macros.h"
5 ACE_BEGIN_VERSIONED_NAMESPACE_DECL
7 template <class CONCRETE> ACE_INLINE CONCRETE *
8 ACE_Based_Pointer<CONCRETE>::operator-> ()
10 ACE_TRACE ("ACE_Based_Pointer<CONCRETE>::operator->");
11 return reinterpret_cast<CONCRETE *> (ACE_COMPUTE_BASED_POINTER (this));
14 template <class CONCRETE> ACE_INLINE void
15 ACE_Based_Pointer_Basic<CONCRETE>::operator= (CONCRETE *rhs)
17 ACE_TRACE ("ACE_Based_Pointer_Basic<CONCRETE>::operator=");
19 // Store a value of <target_> that indicate "NULL" pointer.
22 this->target_ = ((char *) rhs
23 - ((char *) this - this->base_offset_));
26 template <class CONCRETE> ACE_INLINE void
27 ACE_Based_Pointer<CONCRETE>::operator= (CONCRETE *rhs)
29 ACE_TRACE ("ACE_Based_Pointer<CONCRETE>::operator=");
31 // Store a value of <target_> that indicate "NULL" pointer.
34 this->target_ = ((char *) rhs
35 - ((char *) this - this->base_offset_));
38 template <class CONCRETE> ACE_INLINE CONCRETE
39 ACE_Based_Pointer_Basic<CONCRETE>::operator * () const
41 ACE_TRACE ("ACE_Based_Pointer_Basic<CONCRETE>::operator *");
42 return *reinterpret_cast<CONCRETE *> (ACE_COMPUTE_BASED_POINTER (this));
45 template <class CONCRETE> ACE_INLINE CONCRETE *
46 ACE_Based_Pointer_Basic<CONCRETE>::addr () const
48 ACE_TRACE ("ACE_Based_Pointer_Basic<CONCRETE>::addr");
50 if (this->target_ == -1)
53 return reinterpret_cast<CONCRETE *> (ACE_COMPUTE_BASED_POINTER (this));
56 template <class CONCRETE> ACE_INLINE
57 ACE_Based_Pointer_Basic<CONCRETE>::operator CONCRETE * () const
59 ACE_TRACE ("ACE_Based_Pointer_Basic<CONCRETE>::operator CONCRETE *()");
64 template <class CONCRETE> ACE_INLINE CONCRETE
65 ACE_Based_Pointer_Basic<CONCRETE>::operator[] (int index) const
67 ACE_TRACE ("ACE_Based_Pointer_Basic<CONCRETE>::operator[]");
69 reinterpret_cast<CONCRETE *> (ACE_COMPUTE_BASED_POINTER (this));
73 template <class CONCRETE> ACE_INLINE void
74 ACE_Based_Pointer_Basic<CONCRETE>::operator+= (int index)
76 ACE_TRACE ("ACE_Based_Pointer_Basic<CONCRETE>::operator+=");
77 this->base_offset_ += (index * sizeof (CONCRETE));
80 template <class CONCRETE> ACE_INLINE bool
81 ACE_Based_Pointer_Basic<CONCRETE>::operator== (const ACE_Based_Pointer_Basic &rhs) const
83 ACE_TRACE ("ACE_Based_Pointer_Basic<CONCRETE>::operator==");
84 return ACE_COMPUTE_BASED_POINTER (this) == ACE_COMPUTE_BASED_POINTER (&rhs);
87 template <class CONCRETE> ACE_INLINE bool
88 ACE_Based_Pointer_Basic<CONCRETE>::operator!= (const ACE_Based_Pointer_Basic &rhs) const
90 ACE_TRACE ("ACE_Based_Pointer_Basic<CONCRETE>::operator!=");
91 return !(*this == rhs);
94 template <class CONCRETE> ACE_INLINE bool
95 ACE_Based_Pointer_Basic<CONCRETE>::operator< (const ACE_Based_Pointer_Basic &rhs) const
97 ACE_TRACE ("ACE_Based_Pointer_Basic<CONCRETE>::operator<");
98 return ACE_COMPUTE_BASED_POINTER (this) < ACE_COMPUTE_BASED_POINTER (&rhs);
101 template <class CONCRETE> ACE_INLINE bool
102 ACE_Based_Pointer_Basic<CONCRETE>::operator<= (const ACE_Based_Pointer_Basic &rhs) const
104 ACE_TRACE ("ACE_Based_Pointer_Basic<CONCRETE>::operator<=");
105 return ACE_COMPUTE_BASED_POINTER (this) <= ACE_COMPUTE_BASED_POINTER (&rhs);
108 template <class CONCRETE> ACE_INLINE bool
109 ACE_Based_Pointer_Basic<CONCRETE>::operator> (const ACE_Based_Pointer_Basic &rhs) const
111 ACE_TRACE ("ACE_Based_Pointer_Basic<CONCRETE>::operator>");
112 return ACE_COMPUTE_BASED_POINTER (this) > ACE_COMPUTE_BASED_POINTER (&rhs);
115 template <class CONCRETE> ACE_INLINE bool
116 ACE_Based_Pointer_Basic<CONCRETE>::operator>= (const ACE_Based_Pointer_Basic &rhs) const
118 ACE_TRACE ("ACE_Based_Pointer_Basic<CONCRETE>::operator>=");
119 return ACE_COMPUTE_BASED_POINTER (this) >= ACE_COMPUTE_BASED_POINTER (&rhs);
122 template <class CONCRETE> ACE_INLINE void
123 ACE_Based_Pointer_Basic<CONCRETE>::operator= (const ACE_Based_Pointer_Basic &rhs)
125 ACE_TRACE ("ACE_Based_Pointer_Basic<CONCRETE>::operator=");
129 template <class CONCRETE> ACE_INLINE void
130 ACE_Based_Pointer<CONCRETE>::operator= (const ACE_Based_Pointer &rhs)
132 ACE_TRACE ("ACE_Based_Pointer<CONCRETE>::operator=");
136 ACE_END_VERSIONED_NAMESPACE_DECL