diff options
author | schmidt <douglascraigschmidt@users.noreply.github.com> | 1999-07-16 22:05:50 +0000 |
---|---|---|
committer | schmidt <douglascraigschmidt@users.noreply.github.com> | 1999-07-16 22:05:50 +0000 |
commit | 9ee6337357f40e44ebbaa61f8552277f840f7ca4 (patch) | |
tree | 8bad01d8653ad73452988ed6d14aa473af9bdcd3 /ace/Based_Pointer_T.i | |
parent | 3b4d59d72a7e3b9574edbfb540dd44a73fad7731 (diff) | |
download | ATCD-9ee6337357f40e44ebbaa61f8552277f840f7ca4.tar.gz |
.
Diffstat (limited to 'ace/Based_Pointer_T.i')
-rw-r--r-- | ace/Based_Pointer_T.i | 84 |
1 files changed, 57 insertions, 27 deletions
diff --git a/ace/Based_Pointer_T.i b/ace/Based_Pointer_T.i index cb0a3ae5fea..c37d3a894d9 100644 --- a/ace/Based_Pointer_T.i +++ b/ace/Based_Pointer_T.i @@ -1,86 +1,116 @@ /* -*- C++ -*- */ // $Id$ -#define ACE_COMPUTE_BASED_POINTER(P) (((char *) (P) - (P)->base_offset_) + (long) (P)->target_) - -template <class CONCRETE> ACE_INLINE -ACE_Based_Pointer<CONCRETE>::ACE_Based_Pointer (const ACE_Based_Pointer<CONCRETE> &lhs) - : target_ (lhs.target_), - base_offset_ (lhs.base_offset_) -{ -} +#define ACE_COMPUTE_BASED_POINTER(P) (((char *) (P) - (P)->base_offset_) + (P)->target_) template <class CONCRETE> ACE_INLINE CONCRETE * ACE_Based_Pointer<CONCRETE>::operator->(void) { + ACE_TRACEX ("ACE_Based_Pointer<CONCRETE>::operator->"); + this->dump (); return (CONCRETE *)(ACE_COMPUTE_BASED_POINTER (this)); } -template <class CONCRETE> ACE_INLINE CONCRETE * -ACE_Based_Pointer<CONCRETE>::operator =(CONCRETE *from) +template <class CONCRETE> ACE_INLINE void +ACE_Based_Pointer_Basic<CONCRETE>::operator = (CONCRETE *rhs) { - this->target_ = (CONCRETE *)((char *) from - - ((char *) this - this->base_offset_)); - return from; + ACE_TRACEX ("ACE_Based_Pointer_Basic<CONCRETE>::operator="); + if (rhs != 0) + this->target_ = ((char *) rhs + - ((char *) this - this->base_offset_)); + this->dump (); +} + +template <class CONCRETE> ACE_INLINE void +ACE_Based_Pointer<CONCRETE>::operator = (CONCRETE *rhs) +{ + ACE_TRACEX ("ACE_Based_Pointer<CONCRETE>::operator="); + this->target_ = ((char *) rhs + - ((char *) this - this->base_offset_)); + this->dump (); } template <class CONCRETE> ACE_INLINE CONCRETE -ACE_Based_Pointer<CONCRETE>::operator *(void) const +ACE_Based_Pointer_Basic<CONCRETE>::operator *(void) const { - return *(CONCRETE *)(ACE_COMPUTE_BASED_POINTER (this)); + ACE_TRACEX ("ACE_Based_Pointer_Basic<CONCRETE>::operator *"); + this->dump (); + return *ACE_reinterpret_cast (CONCRETE *, + ACE_COMPUTE_BASED_POINTER (this)); } -template <class CONCRETE> ACE_INLINE -ACE_Based_Pointer<CONCRETE>::operator void *() const +template <class CONCRETE> ACE_INLINE CONCRETE * +ACE_Based_Pointer_Basic<CONCRETE>::addr (void) const { - return ACE_reinterpret_cast (void *, + ACE_TRACEX ("ACE_Based_Pointer_Basic<CONCRETE>::addr"); + this->dump (); + return ACE_reinterpret_cast (CONCRETE *, ACE_COMPUTE_BASED_POINTER (this)); } template <class CONCRETE> ACE_INLINE CONCRETE -ACE_Based_Pointer<CONCRETE>::operator [] (long index) const +ACE_Based_Pointer_Basic<CONCRETE>::operator [] (long index) const { - return *((CONCRETE *)(ACE_COMPUTE_BASED_POINTER (this)) + index); + ACE_TRACEX ("ACE_Based_Pointer_Basic<CONCRETE>::operator[]"); + this->dump (); + CONCRETE *c = ACE_reinterpret_cast (CONCRETE *, + ACE_COMPUTE_BASED_POINTER (this)); + return c[index]; } template <class CONCRETE> ACE_INLINE void -ACE_Based_Pointer<CONCRETE>::operator += (long index) +ACE_Based_Pointer_Basic<CONCRETE>::operator += (long index) { + ACE_TRACEX ("ACE_Based_Pointer_Basic<CONCRETE>::operator+="); + this->dump (); this->base_offset_ += (index * sizeof (CONCRETE)); } template <class CONCRETE> ACE_INLINE int -ACE_Based_Pointer<CONCRETE>::operator == (const ACE_Based_Pointer<CONCRETE> &rhs) const +ACE_Based_Pointer_Basic<CONCRETE>::operator == (const ACE_Based_Pointer_Basic<CONCRETE> &rhs) const { + ACE_TRACEX ("ACE_Based_Pointer_Basic<CONCRETE>::operator=="); + this->dump (); return ACE_COMPUTE_BASED_POINTER (this) == ACE_COMPUTE_BASED_POINTER (&rhs); } template <class CONCRETE> ACE_INLINE int -ACE_Based_Pointer<CONCRETE>::operator != (const ACE_Based_Pointer<CONCRETE> &rhs) const +ACE_Based_Pointer_Basic<CONCRETE>::operator != (const ACE_Based_Pointer_Basic<CONCRETE> &rhs) const { + ACE_TRACEX ("ACE_Based_Pointer_Basic<CONCRETE>::operator!="); + this->dump (); return !(*this == rhs); } template <class CONCRETE> ACE_INLINE int -ACE_Based_Pointer<CONCRETE>::operator < (const ACE_Based_Pointer<CONCRETE> &rhs) const +ACE_Based_Pointer_Basic<CONCRETE>::operator < (const ACE_Based_Pointer_Basic<CONCRETE> &rhs) const { + ACE_TRACEX ("ACE_Based_Pointer_Basic<CONCRETE>::operator<"); + this->dump (); return ACE_COMPUTE_BASED_POINTER (this) < ACE_COMPUTE_BASED_POINTER (&rhs); } template <class CONCRETE> ACE_INLINE int -ACE_Based_Pointer<CONCRETE>::operator <= (const ACE_Based_Pointer<CONCRETE> &rhs) const +ACE_Based_Pointer_Basic<CONCRETE>::operator <= (const ACE_Based_Pointer_Basic<CONCRETE> &rhs) const { + ACE_TRACEX ("ACE_Based_Pointer_Basic<CONCRETE>::operator<="); + this->dump (); return ACE_COMPUTE_BASED_POINTER (this) <= ACE_COMPUTE_BASED_POINTER (&rhs); } template <class CONCRETE> ACE_INLINE int -ACE_Based_Pointer<CONCRETE>::operator > (const ACE_Based_Pointer<CONCRETE> &rhs) const +ACE_Based_Pointer_Basic<CONCRETE>::operator > (const ACE_Based_Pointer_Basic<CONCRETE> &rhs) const { + ACE_TRACEX ("ACE_Based_Pointer_Basic<CONCRETE>::operator>"); + this->dump (); return ACE_COMPUTE_BASED_POINTER (this) > ACE_COMPUTE_BASED_POINTER (&rhs); } template <class CONCRETE> ACE_INLINE int -ACE_Based_Pointer<CONCRETE>::operator >= (const ACE_Based_Pointer<CONCRETE> &rhs) const +ACE_Based_Pointer_Basic<CONCRETE>::operator >= (const ACE_Based_Pointer_Basic<CONCRETE> &rhs) const { + ACE_TRACEX ("ACE_Based_Pointer_Basic<CONCRETE>::operator>="); + this->dump (); return ACE_COMPUTE_BASED_POINTER (this) >= ACE_COMPUTE_BASED_POINTER (&rhs); } + |