/* -*- C++ -*- */ // Based_Pointer_T.i,v 4.7 2003/07/30 21:15:58 dhinton Exp #define ACE_COMPUTE_BASED_POINTER(P) (((char *) (P) - (P)->base_offset_) + (P)->target_) #include "ace/Global_Macros.h" template ACE_INLINE CONCRETE * ACE_Based_Pointer::operator->(void) { ACE_TRACE ("ACE_Based_Pointer::operator->"); return (CONCRETE *)(ACE_COMPUTE_BASED_POINTER (this)); } template ACE_INLINE void ACE_Based_Pointer_Basic::operator = (CONCRETE *rhs) { ACE_TRACE ("ACE_Based_Pointer_Basic::operator ="); if (rhs == 0) // Store a value of that indicate "NULL" pointer. this->target_ = -1; else this->target_ = ((char *) rhs - ((char *) this - this->base_offset_)); } template ACE_INLINE void ACE_Based_Pointer::operator = (CONCRETE *rhs) { ACE_TRACE ("ACE_Based_Pointer::operator ="); if (rhs == 0) // Store a value of that indicate "NULL" pointer. this->target_ = -1; else this->target_ = ((char *) rhs - ((char *) this - this->base_offset_)); } template ACE_INLINE CONCRETE ACE_Based_Pointer_Basic::operator *(void) const { ACE_TRACE ("ACE_Based_Pointer_Basic::operator *"); return *ACE_reinterpret_cast (CONCRETE *, ACE_COMPUTE_BASED_POINTER (this)); } template ACE_INLINE CONCRETE * ACE_Based_Pointer_Basic::addr (void) const { ACE_TRACE ("ACE_Based_Pointer_Basic::addr"); if (this->target_ == -1) return 0; else return ACE_reinterpret_cast (CONCRETE *, ACE_COMPUTE_BASED_POINTER (this)); } template ACE_INLINE ACE_Based_Pointer_Basic::operator CONCRETE *() const { ACE_TRACE ("ACE_Based_Pointer_Basic::operator CONCRETE *()"); return this->addr (); } template ACE_INLINE CONCRETE ACE_Based_Pointer_Basic::operator [] (int index) const { ACE_TRACE ("ACE_Based_Pointer_Basic::operator []"); CONCRETE *c = ACE_reinterpret_cast (CONCRETE *, ACE_COMPUTE_BASED_POINTER (this)); return c[index]; } template ACE_INLINE void ACE_Based_Pointer_Basic::operator += (int index) { ACE_TRACE ("ACE_Based_Pointer_Basic::operator +="); this->base_offset_ += (index * sizeof (CONCRETE)); } template ACE_INLINE int ACE_Based_Pointer_Basic::operator == (const ACE_Based_Pointer_Basic &rhs) const { ACE_TRACE ("ACE_Based_Pointer_Basic::operator =="); return ACE_COMPUTE_BASED_POINTER (this) == ACE_COMPUTE_BASED_POINTER (&rhs); } template ACE_INLINE int ACE_Based_Pointer_Basic::operator != (const ACE_Based_Pointer_Basic &rhs) const { ACE_TRACE ("ACE_Based_Pointer_Basic::operator !="); return !(*this == rhs); } template ACE_INLINE int ACE_Based_Pointer_Basic::operator < (const ACE_Based_Pointer_Basic &rhs) const { ACE_TRACE ("ACE_Based_Pointer_Basic::operator <"); return ACE_COMPUTE_BASED_POINTER (this) < ACE_COMPUTE_BASED_POINTER (&rhs); } template ACE_INLINE int ACE_Based_Pointer_Basic::operator <= (const ACE_Based_Pointer_Basic &rhs) const { ACE_TRACE ("ACE_Based_Pointer_Basic::operator <="); return ACE_COMPUTE_BASED_POINTER (this) <= ACE_COMPUTE_BASED_POINTER (&rhs); } template ACE_INLINE int ACE_Based_Pointer_Basic::operator > (const ACE_Based_Pointer_Basic &rhs) const { ACE_TRACE ("ACE_Based_Pointer_Basic::operator >"); return ACE_COMPUTE_BASED_POINTER (this) > ACE_COMPUTE_BASED_POINTER (&rhs); } template ACE_INLINE int ACE_Based_Pointer_Basic::operator >= (const ACE_Based_Pointer_Basic &rhs) const { ACE_TRACE ("ACE_Based_Pointer_Basic::operator >="); return ACE_COMPUTE_BASED_POINTER (this) >= ACE_COMPUTE_BASED_POINTER (&rhs); } template ACE_INLINE void ACE_Based_Pointer_Basic::operator= (const ACE_Based_Pointer_Basic &rhs) { ACE_TRACE ("ACE_Based_Pointer_Basic::operator="); *this = rhs.addr (); } template ACE_INLINE void ACE_Based_Pointer::operator= (const ACE_Based_Pointer &rhs) { ACE_TRACE ("ACE_Based_Pointer::operator="); *this = rhs.addr (); }