1 #ifndef ACE_BASED_POINTER_T_CPP
2 #define ACE_BASED_POINTER_T_CPP
4 #include "ace/Based_Pointer_T.h"
5 #include "ace/Based_Pointer_Repository.h"
6 #include "ace/Log_Category.h"
8 # define ACE_TRACEX(X) ACE_Trace ____ (ACE_TEXT (X), __LINE__, ACE_TEXT (__FILE__))
10 #if !defined (__ACE_INLINE__)
11 #include "ace/Based_Pointer_T.inl"
12 #endif /* __ACE_INLINE__ */
14 ACE_BEGIN_VERSIONED_NAMESPACE_DECL
16 ACE_ALLOC_HOOK_DEFINE_Tc(ACE_Based_Pointer_Basic
)
18 template <class CONCRETE
>
19 ACE_Based_Pointer
<CONCRETE
>::ACE_Based_Pointer ()
21 ACE_TRACE ("ACE_Based_Pointer<CONCRETE>::ACE_Based_Pointer");
24 template <class CONCRETE
> void
25 ACE_Based_Pointer_Basic
<CONCRETE
>::dump () const
27 #if defined (ACE_HAS_DUMP)
28 ACE_TRACE ("ACE_Based_Pointer_Basic<CONCRETE>::dump");
30 ACELIB_DEBUG ((LM_DEBUG
, ACE_BEGIN_DUMP
, this));
31 ACELIB_DEBUG ((LM_DEBUG
, ACE_TEXT ("\ntarget_ = %d\n"), this->target_
));
32 ACELIB_DEBUG ((LM_DEBUG
, ACE_TEXT ("base_offset_ = %d\n"), this->base_offset_
));
33 ACELIB_DEBUG ((LM_DEBUG
, ACE_TEXT ("computed pointer = %x\n"),
34 (CONCRETE
*)(ACE_COMPUTE_BASED_POINTER (this))));
35 ACELIB_DEBUG ((LM_DEBUG
, ACE_END_DUMP
));
36 #endif /* ACE_HAS_DUMP */
39 template <class CONCRETE
>
40 ACE_Based_Pointer
<CONCRETE
>::ACE_Based_Pointer (CONCRETE
*initial
)
41 : ACE_Based_Pointer_Basic
<CONCRETE
> (initial
)
43 ACE_TRACE ("ACE_Based_Pointer_Basic<CONCRETE>::ACE_Based_Pointer_Basic");
46 template <class CONCRETE
>
47 ACE_Based_Pointer
<CONCRETE
>::ACE_Based_Pointer (const void *base_addr
, int)
48 : ACE_Based_Pointer_Basic
<CONCRETE
> (base_addr
, 0)
50 ACE_TRACE ("ACE_Based_Pointer_Basic<CONCRETE>::ACE_Based_Pointer_Basic");
53 template <class CONCRETE
>
54 ACE_Based_Pointer_Basic
<CONCRETE
>::ACE_Based_Pointer_Basic ()
58 ACE_TRACE ("ACE_Based_Pointer_Basic<CONCRETE>::ACE_Based_Pointer_Basic");
61 // Find the base address associated with our <this> pointer. Note
62 // that it's ok for <find> to return 0, which simply indicates that
63 // the address is not in memory-mapped virtual address space.
64 ACE_BASED_POINTER_REPOSITORY::instance ()->find (this,
66 this->base_offset_
= (char *) this - (char *) base_addr
;
69 template <class CONCRETE
>
70 ACE_Based_Pointer_Basic
<CONCRETE
>::ACE_Based_Pointer_Basic (const void *base_addr
, int)
74 ACE_TRACE ("ACE_Based_Pointer_Basic<CONCRETE>::ACE_Based_Pointer_Basic");
75 this->base_offset_
= (char *) this - (char *) base_addr
;
78 template <class CONCRETE
>
79 ACE_Based_Pointer_Basic
<CONCRETE
>::ACE_Based_Pointer_Basic (CONCRETE
*rhs
)
83 ACE_TRACE ("ACE_Based_Pointer_Basic<CONCRETE>::ACE_Based_Pointer_Basic");
86 // Store a value of <target_> that indicate "NULL" pointer.
92 // Find the base address associated with the <addr> pointer.
93 // Note that it's ok for <find> to return 0, which simply
94 // indicates that the address is not in memory-mapped virtual
96 ACE_BASED_POINTER_REPOSITORY::instance ()->find (this,
98 this->base_offset_
= (char *) this - (char *) base_addr
;
99 this->target_
= ((char *) rhs
- (char *) base_addr
);
103 ACE_END_VERSIONED_NAMESPACE_DECL
105 #endif /* ACE_BASED_POINTER_T_CPP */