Based_Pointer_T.cpp

Go to the documentation of this file.
00001 // Based_Pointer_T.cpp,v 4.16 2005/10/28 16:14:51 ossama Exp
00002 
00003 #ifndef ACE_BASED_POINTER_T_CPP
00004 #define ACE_BASED_POINTER_T_CPP
00005 
00006 #include "ace/Based_Pointer_T.h"
00007 #include "ace/Based_Pointer_Repository.h"
00008 #include "ace/Log_Msg.h"
00009 
00010 #   define ACE_TRACEX(X) ACE_Trace ____ (ACE_LIB_TEXT (X), __LINE__, ACE_LIB_TEXT (__FILE__))
00011 
00012 #if !defined (__ACE_INLINE__)
00013 #include "ace/Based_Pointer_T.inl"
00014 #endif /* __ACE_INLINE__ */
00015 
00016 ACE_BEGIN_VERSIONED_NAMESPACE_DECL
00017 
00018 template <class CONCRETE>
00019 ACE_Based_Pointer<CONCRETE>::ACE_Based_Pointer (void)
00020 {
00021   ACE_TRACE ("ACE_Based_Pointer<CONCRETE>::ACE_Based_Pointer");
00022 }
00023 
00024 template <class CONCRETE> void
00025 ACE_Based_Pointer_Basic<CONCRETE>::dump (void) const
00026 {
00027 #if defined (ACE_HAS_DUMP)
00028   ACE_TRACE ("ACE_Based_Pointer_Basic<CONCRETE>::dump");
00029 
00030   ACE_DEBUG ((LM_DEBUG, ACE_BEGIN_DUMP, this));
00031   ACE_DEBUG ((LM_DEBUG, ACE_LIB_TEXT ("\ntarget_ = %d\n"), this->target_));
00032   ACE_DEBUG ((LM_DEBUG, ACE_LIB_TEXT ("base_offset_ = %d\n"), this->base_offset_));
00033   ACE_DEBUG ((LM_DEBUG, ACE_LIB_TEXT ("computed pointer = %x\n"),
00034               (CONCRETE *)(ACE_COMPUTE_BASED_POINTER (this))));
00035   ACE_DEBUG ((LM_DEBUG, ACE_END_DUMP));
00036 #endif /* ACE_HAS_DUMP */
00037 }
00038 
00039 template <class CONCRETE>
00040 ACE_Based_Pointer<CONCRETE>::ACE_Based_Pointer (CONCRETE *initial)
00041   : ACE_Based_Pointer_Basic<CONCRETE> (initial)
00042 {
00043   ACE_TRACE ("ACE_Based_Pointer_Basic<CONCRETE>::ACE_Based_Pointer_Basic");
00044 }
00045 
00046 template <class CONCRETE>
00047 ACE_Based_Pointer<CONCRETE>::ACE_Based_Pointer (const void* base_addr, int)
00048   : ACE_Based_Pointer_Basic<CONCRETE> (base_addr, 0)
00049 {
00050   ACE_TRACE ("ACE_Based_Pointer_Basic<CONCRETE>::ACE_Based_Pointer_Basic");
00051 }
00052 
00053 template <class CONCRETE>
00054 ACE_Based_Pointer_Basic<CONCRETE>::ACE_Based_Pointer_Basic (void)
00055   : target_ (0),
00056     base_offset_ (0)
00057 {
00058   ACE_TRACE ("ACE_Based_Pointer_Basic<CONCRETE>::ACE_Based_Pointer_Basic");
00059   void *base_addr = 0;
00060 
00061   // Find the base address associated with our <this> pointer.  Note
00062   // that it's ok for <find> to return 0, which simply indicates that
00063   // the address is not in memory-mapped virtual address space.
00064   ACE_BASED_POINTER_REPOSITORY::instance ()->find (this,
00065                                                    base_addr);
00066   this->base_offset_ = (char *) this - (char *) base_addr;
00067 }
00068 
00069 template <class CONCRETE>
00070 ACE_Based_Pointer_Basic<CONCRETE>::ACE_Based_Pointer_Basic (const void *base_addr, int)
00071   : target_ (0),
00072     base_offset_ (0)
00073 {
00074   ACE_TRACE ("ACE_Based_Pointer_Basic<CONCRETE>::ACE_Based_Pointer_Basic");
00075   this->base_offset_ = (char *) this - (char *) base_addr;
00076 }
00077 
00078 template <class CONCRETE>
00079 ACE_Based_Pointer_Basic<CONCRETE>::ACE_Based_Pointer_Basic (CONCRETE *rhs)
00080   : target_ (0),
00081     base_offset_ (0)
00082 {
00083   ACE_TRACE ("ACE_Based_Pointer_Basic<CONCRETE>::ACE_Based_Pointer_Basic");
00084 
00085   if (rhs == 0)
00086     // Store a value of <target_> that indicate "NULL" pointer.
00087     this->target_ = -1;
00088   else
00089     {
00090       void *base_addr = 0;
00091 
00092       // Find the base address associated with the <addr> pointer.
00093       // Note that it's ok for <find> to return 0, which simply
00094       // indicates that the address is not in memory-mapped virtual
00095       // address space.
00096       ACE_BASED_POINTER_REPOSITORY::instance ()->find (this,
00097                                                        base_addr);
00098       this->base_offset_ = (char *) this - (char *) base_addr;
00099       this->target_ = ((char *) rhs - (char *) base_addr);
00100     }
00101 }
00102 
00103 template <class CONCRETE>
00104 ACE_Based_Pointer_Basic<CONCRETE>::ACE_Based_Pointer_Basic (const ACE_Based_Pointer_Basic<CONCRETE> &)
00105 {
00106   ACE_TRACE ("ACE_Based_Pointer_Basic<CONCRETE>::ACE_Based_Pointer_Basic");
00107 
00108   ACE_ASSERT (0); // not implemented.
00109 }
00110 
00111 template <class CONCRETE>
00112 ACE_Based_Pointer<CONCRETE>::ACE_Based_Pointer (const ACE_Based_Pointer<CONCRETE> &rhs)
00113   : ACE_Based_Pointer_Basic<CONCRETE> (rhs)
00114 {
00115   ACE_TRACE ("ACE_Based_Pointer<CONCRETE>::ACE_Based_Pointer");
00116   ACE_ASSERT (0); // not implemented.
00117 }
00118 
00119 ACE_END_VERSIONED_NAMESPACE_DECL
00120 
00121 #endif /* ACE_BASED_POINTER_T_CPP */

Generated on Thu Nov 9 09:41:47 2006 for ACE by doxygen 1.3.6