diff options
author | nanbor <nanbor@ae88bc3d-4319-0410-8dbf-d08b4c9d3795> | 1999-12-07 19:31:58 +0000 |
---|---|---|
committer | nanbor <nanbor@ae88bc3d-4319-0410-8dbf-d08b4c9d3795> | 1999-12-07 19:31:58 +0000 |
commit | 2faef6c298e890a2f5507c8778cbad6097f04fc2 (patch) | |
tree | cdc6b2f54e266ac7f61a0325c41e37bf9f33fe34 | |
parent | 06f6a947c2e517dbc19cfcee591ca5eabdb80ad6 (diff) | |
download | ATCD-2faef6c298e890a2f5507c8778cbad6097f04fc2.tar.gz |
ChangeLogTag:Tue Dec 07 13:25:53 1999 Nanbor Wang <nanbor@cs.wustl.edu>
-rw-r--r-- | ace/Based_Pointer_T.cpp | 20 | ||||
-rw-r--r-- | ace/Based_Pointer_T.h | 22 | ||||
-rw-r--r-- | ace/Malloc_T.i | 2 |
3 files changed, 34 insertions, 10 deletions
diff --git a/ace/Based_Pointer_T.cpp b/ace/Based_Pointer_T.cpp index 06529e8f02a..9f5408386f9 100644 --- a/ace/Based_Pointer_T.cpp +++ b/ace/Based_Pointer_T.cpp @@ -13,7 +13,7 @@ #include "ace/Based_Pointer_T.i" #endif /* __ACE_INLINE__ */ -template <class CONCRETE> +template <class CONCRETE> ACE_Based_Pointer<CONCRETE>::ACE_Based_Pointer (void) { ACE_TRACE ("ACE_Based_Pointer<CONCRETE>::ACE_Based_Pointer"); @@ -39,6 +39,13 @@ ACE_Based_Pointer<CONCRETE>::ACE_Based_Pointer (CONCRETE *initial) } template <class CONCRETE> +ACE_Based_Pointer<CONCRETE>::ACE_Based_Pointer (const void* base_addr, int) + : ACE_Based_Pointer_Basic<CONCRETE> (base_addr, 0) +{ + ACE_TRACE ("ACE_Based_Pointer_Basic<CONCRETE>::ACE_Based_Pointer_Basic"); +} + +template <class CONCRETE> ACE_Based_Pointer_Basic<CONCRETE>::ACE_Based_Pointer_Basic (void) : target_ (0), base_offset_ (0) @@ -49,12 +56,21 @@ ACE_Based_Pointer_Basic<CONCRETE>::ACE_Based_Pointer_Basic (void) // Find the base address associated with our <this> 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, + ACE_BASED_POINTER_REPOSITORY::instance ()->find (this, base_addr); this->base_offset_ = (char *) this - (char *) base_addr; } template <class CONCRETE> +ACE_Based_Pointer_Basic<CONCRETE>::ACE_Based_Pointer_Basic (const void *base_addr, int) + : target_ (0), + base_offset_ (0) +{ + ACE_TRACE ("ACE_Based_Pointer_Basic<CONCRETE>::ACE_Based_Pointer_Basic"); + this->base_offset_ = (char *) this - (char *) base_addr; +} + +template <class CONCRETE> ACE_Based_Pointer_Basic<CONCRETE>::ACE_Based_Pointer_Basic (CONCRETE *rhs) : target_ (0), base_offset_ (0) diff --git a/ace/Based_Pointer_T.h b/ace/Based_Pointer_T.h index c25bacb69a3..4ff94632542 100644 --- a/ace/Based_Pointer_T.h +++ b/ace/Based_Pointer_T.h @@ -25,15 +25,15 @@ // 'ACE_Based_Pointer<long>::operator ->' is 'long *' (i.e., not a UDT // or reference to a UDT. Will produce errors if applied using infix // notation)" -#pragma warning(disable: 4284) +#pragma warning(disable: 4284) #endif /* _MSC_VER */ -template <class CONCRETE> +template <class CONCRETE> class ACE_Based_Pointer_Basic { // = TITLE // A proxy that keeps track of the relative offset of a "pointer" - // from its base address. + // from its base address. // // This class makes it possible to transparently use "pointers" in // shared memory as easily as programming with pointers to local @@ -46,7 +46,7 @@ public: // <ACE_BASED_POINTER_REPOSITORY> Singleton for the base address of // the memory region within which it is instantiated. Two results // are possible: - // + // // 1. An <ACE_*_Memory_Pool> has stored a base address/size pair and the // new based-pointer instance is located between the base address and // the base address + size - 1. In this case, the repository @@ -64,7 +64,7 @@ public: // <ACE_BASED_POINTER_REPOSITORY> Singleton for the base address of // the memory region within which it is instantiated. Two results // are possible: - // + // // 1. An <ACE_*_Memory_Pool> has stored a base address/size pair and the // new based-pointer instance is located between the base address and // the base address + size - 1. In this case, the repository @@ -79,6 +79,10 @@ public: ACE_Based_Pointer_Basic (const ACE_Based_Pointer_Basic<CONCRETE> &); // Copy constructor. + ACE_Based_Pointer_Basic (const void *base_addr, int overload); + // Constructor for know base address. <overload> is only used to + // resolve overload ambiguity. + void operator = (CONCRETE *from); // Pseudo-assignment operator. @@ -131,7 +135,7 @@ protected: // Keep track of our offset from the base pointer. }; -template <class CONCRETE> +template <class CONCRETE> class ACE_Based_Pointer : public ACE_Based_Pointer_Basic<CONCRETE> { // = TITLE @@ -149,7 +153,11 @@ public: // details. ACE_Based_Pointer (CONCRETE *initial); - // Initialize this object using the <initial> pointer. + // Initialize this object using the <initial> pointer. + + ACE_Based_Pointer (const void *base_addr, int overload); + // Initialize this object with known <base_addr>. <overload> is + // only used to resolve overload ambiguity. ACE_Based_Pointer (const ACE_Based_Pointer<CONCRETE> &); // Copy constructor (not implemented yet). diff --git a/ace/Malloc_T.i b/ace/Malloc_T.i index e878330e250..8f13b7dc39d 100644 --- a/ace/Malloc_T.i +++ b/ace/Malloc_T.i @@ -203,7 +203,7 @@ template <ACE_MEM_POOL_1, class ACE_LOCK> ACE_INLINE void ACE_Malloc<ACE_MEM_POOL_2, ACE_LOCK>::init_malloc_header_ptr (void* ptr) { #if defined (ACE_HAS_POSITION_INDEPENDENT_MALLOC) - new (ptr) ACE_MALLOC_HEADER_PTR; + new (ptr) ACE_MALLOC_HEADER_PTR (this->cb_ptr_, 0); #else ACE_UNUSED_ARG (ptr); #endif /* ACE_HAS_POSITION_INDEPENDENT_MALLOC */ |