Main Page   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members   File Members   Related Pages  

Based_Pointer_T.cpp

Go to the documentation of this file.
00001 // $Id: Based_Pointer_T.cpp,v 1.1.1.3 2001/12/04 14:32:59 chad 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.i"
00014 #endif /* __ACE_INLINE__ */
00015 
00016 template <class CONCRETE>
00017 ACE_Based_Pointer<CONCRETE>::ACE_Based_Pointer (void)
00018 {
00019   ACE_TRACE ("ACE_Based_Pointer<CONCRETE>::ACE_Based_Pointer");
00020 }
00021 
00022 template <class CONCRETE> void
00023 ACE_Based_Pointer_Basic<CONCRETE>::dump (void) const
00024 {
00025   ACE_TRACE ("ACE_Based_Pointer_Basic<CONCRETE>::dump");
00026 
00027   ACE_DEBUG ((LM_DEBUG, ACE_BEGIN_DUMP, this));
00028   ACE_DEBUG ((LM_DEBUG, ACE_LIB_TEXT ("\ntarget_ = %d\n"), this->target_));
00029   ACE_DEBUG ((LM_DEBUG, ACE_LIB_TEXT ("base_offset_ = %d\n"), this->base_offset_));
00030   ACE_DEBUG ((LM_DEBUG, ACE_LIB_TEXT ("computed pointer = %x\n"), (CONCRETE *)(ACE_COMPUTE_BASED_POINTER (this))));
00031   ACE_DEBUG ((LM_DEBUG, ACE_END_DUMP));
00032 }
00033 
00034 template <class CONCRETE>
00035 ACE_Based_Pointer<CONCRETE>::ACE_Based_Pointer (CONCRETE *initial)
00036   : ACE_Based_Pointer_Basic<CONCRETE> (initial)
00037 {
00038   ACE_TRACE ("ACE_Based_Pointer_Basic<CONCRETE>::ACE_Based_Pointer_Basic");
00039 }
00040 
00041 template <class CONCRETE>
00042 ACE_Based_Pointer<CONCRETE>::ACE_Based_Pointer (const void* base_addr, int)
00043   : ACE_Based_Pointer_Basic<CONCRETE> (base_addr, 0)
00044 {
00045   ACE_TRACE ("ACE_Based_Pointer_Basic<CONCRETE>::ACE_Based_Pointer_Basic");
00046 }
00047 
00048 template <class CONCRETE>
00049 ACE_Based_Pointer_Basic<CONCRETE>::ACE_Based_Pointer_Basic (void)
00050   : target_ (0),
00051     base_offset_ (0)
00052 {
00053   ACE_TRACE ("ACE_Based_Pointer_Basic<CONCRETE>::ACE_Based_Pointer_Basic");
00054   void *base_addr = 0;
00055 
00056   // Find the base address associated with our <this> pointer.  Note
00057   // that it's ok for <find> to return 0, which simply indicates that
00058   // the address is not in memory-mapped virtual address space.
00059   ACE_BASED_POINTER_REPOSITORY::instance ()->find (this,
00060                                                    base_addr);
00061   this->base_offset_ = (char *) this - (char *) base_addr;
00062 }
00063 
00064 template <class CONCRETE>
00065 ACE_Based_Pointer_Basic<CONCRETE>::ACE_Based_Pointer_Basic (const void *base_addr, int)
00066   : target_ (0),
00067     base_offset_ (0)
00068 {
00069   ACE_TRACE ("ACE_Based_Pointer_Basic<CONCRETE>::ACE_Based_Pointer_Basic");
00070   this->base_offset_ = (char *) this - (char *) base_addr;
00071 }
00072 
00073 template <class CONCRETE>
00074 ACE_Based_Pointer_Basic<CONCRETE>::ACE_Based_Pointer_Basic (CONCRETE *rhs)
00075   : target_ (0),
00076     base_offset_ (0)
00077 {
00078   ACE_TRACE ("ACE_Based_Pointer_Basic<CONCRETE>::ACE_Based_Pointer_Basic");
00079 
00080   if (rhs == 0)
00081     // Store a value of <target_> that indicate "NULL" pointer.
00082     this->target_ = -1;
00083   else
00084     {
00085       void *base_addr = 0;
00086 
00087       // Find the base address associated with the <addr> pointer.
00088       // Note that it's ok for <find> to return 0, which simply
00089       // indicates that the address is not in memory-mapped virtual
00090       // address space.
00091       ACE_BASED_POINTER_REPOSITORY::instance ()->find (this,
00092                                                        base_addr);
00093       this->base_offset_ = (char *) this - (char *) base_addr;
00094       this->target_ = ((char *) rhs - (char *) base_addr);
00095     }
00096 }
00097 
00098 template <class CONCRETE>
00099 ACE_Based_Pointer_Basic<CONCRETE>::ACE_Based_Pointer_Basic (const ACE_Based_Pointer_Basic<CONCRETE> &)
00100 {
00101   ACE_TRACE ("ACE_Based_Pointer_Basic<CONCRETE>::ACE_Based_Pointer_Basic");
00102 
00103   ACE_ASSERT (0); // not implemented.
00104 }
00105 
00106 template <class CONCRETE>
00107 ACE_Based_Pointer<CONCRETE>::ACE_Based_Pointer (const ACE_Based_Pointer<CONCRETE> &rhs)
00108   : ACE_Based_Pointer_Basic<CONCRETE> (rhs)
00109 {
00110   ACE_TRACE ("ACE_Based_Pointer<CONCRETE>::ACE_Based_Pointer");
00111   ACE_ASSERT (0); // not implemented.
00112 }
00113 
00114 #endif /* ACE_BASED_POINTER_T_CPP */

Generated on Mon Jun 16 11:19:12 2003 for ACE by doxygen1.2.14 written by Dimitri van Heesch, © 1997-2002