diff options
Diffstat (limited to 'ace/Based_Pointer_T.cpp')
-rw-r--r-- | ace/Based_Pointer_T.cpp | 50 |
1 files changed, 27 insertions, 23 deletions
diff --git a/ace/Based_Pointer_T.cpp b/ace/Based_Pointer_T.cpp index 0e97efcee87..fefe3421b32 100644 --- a/ace/Based_Pointer_T.cpp +++ b/ace/Based_Pointer_T.cpp @@ -8,22 +8,21 @@ #include "ace/Based_Pointer_Repository.h" # define ACE_TRACEX(X) ACE_Trace ____ (ASYS_TEXT (X), __LINE__, ASYS_TEXT (__FILE__)) -// # define ACE_TRACEX(X) -// #if !defined (__ACE_INLINE__) +#if !defined (__ACE_INLINE__) #include "ace/Based_Pointer_T.i" -// #endif /* __ACE_INLINE__ */ +#endif /* __ACE_INLINE__ */ template <class CONCRETE> ACE_INLINE ACE_Based_Pointer<CONCRETE>::ACE_Based_Pointer (void) { - ACE_TRACEX ("ACE_Based_Pointer<CONCRETE>::ACE_Based_Pointer"); + ACE_TRACE ("ACE_Based_Pointer<CONCRETE>::ACE_Based_Pointer"); } template <class CONCRETE> void ACE_Based_Pointer_Basic<CONCRETE>::dump (void) const { - ACE_TRACEX ("ACE_Based_Pointer_Basic<CONCRETE>::dump"); + ACE_TRACE ("ACE_Based_Pointer_Basic<CONCRETE>::dump"); ACE_DEBUG ((LM_DEBUG, ACE_BEGIN_DUMP, this)); ACE_DEBUG ((LM_DEBUG, ASYS_TEXT ("\ntarget_ = %d\n"), this->target_)); @@ -36,7 +35,7 @@ template <class CONCRETE> ACE_Based_Pointer<CONCRETE>::ACE_Based_Pointer (CONCRETE *initial) : ACE_Based_Pointer_Basic<CONCRETE> (initial) { - ACE_TRACEX ("ACE_Based_Pointer_Basic<CONCRETE>::ACE_Based_Pointer_Basic"); + ACE_TRACE ("ACE_Based_Pointer_Basic<CONCRETE>::ACE_Based_Pointer_Basic"); } template <class CONCRETE> @@ -44,7 +43,7 @@ ACE_Based_Pointer_Basic<CONCRETE>::ACE_Based_Pointer_Basic (void) : target_ (0), base_offset_ (0) { - ACE_TRACEX ("ACE_Based_Pointer_Basic<CONCRETE>::ACE_Based_Pointer_Basic"); + ACE_TRACE ("ACE_Based_Pointer_Basic<CONCRETE>::ACE_Based_Pointer_Basic"); void *base_addr = 0; // Find the base address associated with our <this> pointer. Note @@ -53,7 +52,6 @@ ACE_Based_Pointer_Basic<CONCRETE>::ACE_Based_Pointer_Basic (void) ACE_BASED_POINTER_REPOSITORY::instance ()->find (this, base_addr); this->base_offset_ = (char *) this - (char *) base_addr; - this->dump (); } template <class CONCRETE> @@ -61,23 +59,30 @@ ACE_Based_Pointer_Basic<CONCRETE>::ACE_Based_Pointer_Basic (CONCRETE *rhs) : target_ (0), base_offset_ (0) { - ACE_TRACEX ("ACE_Based_Pointer_Basic<CONCRETE>::ACE_Based_Pointer_Basic"); - void *base_addr = 0; - - // Find the base address associated with the <addr> pointer. Note - // that it's ok for <find> to return 0, which simply indicates that - // the address is not in memory-mapped virtual address space. - ACE_BASED_POINTER_REPOSITORY::instance ()->find (this, - base_addr); - this->base_offset_ = (char *) this - (char *) base_addr; - this->target_ = ((char *) rhs - (char *) base_addr); - this->dump (); + ACE_TRACE ("ACE_Based_Pointer_Basic<CONCRETE>::ACE_Based_Pointer_Basic"); + + if (rhs == 0) + // Store a value of <target_> that indicate "NULL" pointer. + this->target_ = -1; + else + { + void *base_addr = 0; + + // Find the base address associated with the <addr> pointer. + // Note that it's ok for <find> to return 0, which simply + // indicates that the address is not in memory-mapped virtual + // address space. + ACE_BASED_POINTER_REPOSITORY::instance ()->find (this, + base_addr); + this->base_offset_ = (char *) this - (char *) base_addr; + this->target_ = ((char *) rhs - (char *) base_addr); + } } template <class CONCRETE> ACE_INLINE ACE_Based_Pointer_Basic<CONCRETE>::ACE_Based_Pointer_Basic (const ACE_Based_Pointer_Basic<CONCRETE> &rhs) { - ACE_TRACEX ("ACE_Based_Pointer_Basic<CONCRETE>::ACE_Based_Pointer_Basic"); + ACE_TRACE ("ACE_Based_Pointer_Basic<CONCRETE>::ACE_Based_Pointer_Basic"); ACE_ASSERT (!"not implemented"); void *base_addr = 0; @@ -89,15 +94,14 @@ ACE_Based_Pointer_Basic<CONCRETE>::ACE_Based_Pointer_Basic (const ACE_Based_Poin base_addr); this->base_offset_ = (char *) this - (char *) base_addr; this->target_ = ((char *) &rhs - (char *) base_addr); - this->dump (); } template <class CONCRETE> ACE_INLINE ACE_Based_Pointer<CONCRETE>::ACE_Based_Pointer (const ACE_Based_Pointer<CONCRETE> &rhs) : ACE_Based_Pointer_Basic<CONCRETE> (rhs) { - ACE_TRACEX ("ACE_Based_Pointer<CONCRETE>::ACE_Based_Pointer"); + ACE_TRACE ("ACE_Based_Pointer<CONCRETE>::ACE_Based_Pointer"); ACE_ASSERT (!"not implemented"); } -#endif/* ACE_BASED_POINTER_T_CPP */ +#endif /* ACE_BASED_POINTER_T_CPP */ |