#include <Based_Pointer_T.h>
Inheritance diagram for ACE_Based_Pointer_Basic:

Public Methods | |
| ACE_Based_Pointer_Basic (void) | |
| ACE_Based_Pointer_Basic (CONCRETE *initial) | |
| ACE_Based_Pointer_Basic (const ACE_Based_Pointer_Basic< CONCRETE > &) | |
| Copy constructor. More... | |
| ACE_Based_Pointer_Basic (const void *base_addr, int o) | |
| Constructor for know base address. <o> is only used to resolve overload ambiguity. More... | |
| void | operator= (CONCRETE *from) |
| Pseudo-assignment operator. More... | |
| void | operator= (const ACE_Based_Pointer_Basic< CONCRETE > &) |
| Pseudo-assignment operator. More... | |
| CONCRETE | operator * (void) const |
| Dereference operator. More... | |
| int | operator< (const ACE_Based_Pointer_Basic< CONCRETE > &) const |
| Less than operator. More... | |
| int | operator<= (const ACE_Based_Pointer_Basic< CONCRETE > &) const |
| Less than or equal operator. More... | |
| int | operator> (const ACE_Based_Pointer_Basic< CONCRETE > &) const |
| Greater than operator. More... | |
| int | operator>= (const ACE_Based_Pointer_Basic< CONCRETE > &) const |
| Greater than or equal operator. More... | |
| int | operator== (const ACE_Based_Pointer_Basic< CONCRETE > &) const |
| Equality operator. More... | |
| int | operator!= (const ACE_Based_Pointer_Basic< CONCRETE > &) const |
| Inequality operator. More... | |
| CONCRETE | operator[] (int index) const |
| Subscript operator. More... | |
| void | operator+= (int index) |
| Increment operator. More... | |
| operator CONCRETE * () const | |
| Returns the underlying memory address of the smart pointer. More... | |
| CONCRETE * | addr (void) const |
| Returns the underlying memory address of the smart pointer. More... | |
| void | dump (void) const |
| Dump the state of the object. More... | |
Public Attributes | |
| ACE_ALLOC_HOOK_DECLARE | |
| Declare the dynamic allocation hooks. More... | |
Protected Attributes | |
| long | target_ |
| long | base_offset_ |
| Keep track of our offset from the base pointer. More... | |
Definition at line 42 of file Based_Pointer_T.h.
|
||||||||||
|
This constructor initializes the <base_offset_> by asking the <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 returns the base address. 2. No suitable address/size pair was found. The repository assumes an address in the regular (not mapped) virtual address space of the process and returns 0. In this case, the based-pointer uses its address as an offset to it's base address 0. Definition at line 49 of file Based_Pointer_T.cpp. References ACE_TRACE, base_offset_, and ACE_Singleton::instance.
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 } |
|
||||||||||
|
Initialize this object using the <initial> pointer. This constructor initializes the <base_offset_> by asking the <ACE_BASED_POINTER_REPOSITORY> Singleton for the base address of the memory region within which it is instantiated. Three 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 returns the base address. 2. No suitable address/size pair was found. The repository assumes an address in the regular (not mapped) virtual address space of the process and returns 0. In this case, the based-pointer uses its address as an offset to its base address 0. 3. If <initial> is 0 then set the value of <target_> to -1, which indicates a "NULL" pointer. Definition at line 74 of file Based_Pointer_T.cpp. References ACE_TRACE, base_offset_, ACE_Singleton::instance, and target_.
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 } |
|
||||||||||
|
Copy constructor.
Definition at line 99 of file Based_Pointer_T.cpp. References ACE_ASSERT, and ACE_TRACE.
00100 {
00101 ACE_TRACE ("ACE_Based_Pointer_Basic<CONCRETE>::ACE_Based_Pointer_Basic");
00102
00103 ACE_ASSERT (0); // not implemented.
00104 }
|
|
||||||||||||||||
|
Constructor for know base address. <o> is only used to resolve overload ambiguity.
Definition at line 65 of file Based_Pointer_T.cpp. References ACE_TRACE, and base_offset_.
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 } |
|
||||||||||
|
Returns the underlying memory address of the smart pointer.
Definition at line 46 of file Based_Pointer_T.i. References ACE_COMPUTE_BASED_POINTER, ACE_TRACE, and target_. Referenced by operator CONCRETE *, ACE_Based_Pointer::operator=, and operator=.
00047 {
00048 ACE_TRACE ("ACE_Based_Pointer_Basic<CONCRETE>::addr");
00049
00050 if (this->target_ == -1)
00051 return 0;
00052 else
00053 return ACE_reinterpret_cast (CONCRETE *,
00054 ACE_COMPUTE_BASED_POINTER (this));
00055 }
|
|
||||||||||
|
Dump the state of the object.
Definition at line 23 of file Based_Pointer_T.cpp. References ACE_BEGIN_DUMP, ACE_COMPUTE_BASED_POINTER, ACE_DEBUG, ACE_END_DUMP, ACE_LIB_TEXT, ACE_TRACE, and LM_DEBUG.
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 }
|
|
||||||||||
|
Dereference operator.
Definition at line 38 of file Based_Pointer_T.i. References ACE_COMPUTE_BASED_POINTER, and ACE_TRACE.
00039 {
00040 ACE_TRACE ("ACE_Based_Pointer_Basic<CONCRETE>::operator *");
00041 return *ACE_reinterpret_cast (CONCRETE *,
00042 ACE_COMPUTE_BASED_POINTER (this));
00043 }
|
|
|||||||||
|
Returns the underlying memory address of the smart pointer.
Definition at line 58 of file Based_Pointer_T.i. References ACE_TRACE, and addr.
|
|
||||||||||
|
Inequality operator.
Definition at line 89 of file Based_Pointer_T.i. References ACE_TRACE.
00090 {
00091 ACE_TRACE ("ACE_Based_Pointer_Basic<CONCRETE>::operator !=");
00092 return !(*this == rhs);
00093 }
|
|
||||||||||
|
Increment operator.
Definition at line 75 of file Based_Pointer_T.i. References ACE_TRACE, and base_offset_.
00076 {
00077 ACE_TRACE ("ACE_Based_Pointer_Basic<CONCRETE>::operator +=");
00078 this->base_offset_ += (index * sizeof (CONCRETE));
00079 }
|
|
||||||||||
|
Less than operator.
Definition at line 96 of file Based_Pointer_T.i. References ACE_COMPUTE_BASED_POINTER, and ACE_TRACE.
00097 {
00098 ACE_TRACE ("ACE_Based_Pointer_Basic<CONCRETE>::operator <");
00099 return ACE_COMPUTE_BASED_POINTER (this) < ACE_COMPUTE_BASED_POINTER (&rhs);
00100 }
|
|
||||||||||
|
Less than or equal operator.
Definition at line 103 of file Based_Pointer_T.i. References ACE_COMPUTE_BASED_POINTER, and ACE_TRACE.
00104 {
00105 ACE_TRACE ("ACE_Based_Pointer_Basic<CONCRETE>::operator <=");
00106 return ACE_COMPUTE_BASED_POINTER (this) <= ACE_COMPUTE_BASED_POINTER (&rhs);
00107 }
|
|
||||||||||
|
Pseudo-assignment operator.
Definition at line 124 of file Based_Pointer_T.i. References ACE_TRACE, and addr.
|
|
||||||||||
|
Pseudo-assignment operator.
Reimplemented in ACE_Based_Pointer. Definition at line 14 of file Based_Pointer_T.i. References ACE_TRACE, base_offset_, and target_.
00015 {
00016 ACE_TRACE ("ACE_Based_Pointer_Basic<CONCRETE>::operator =");
00017 if (rhs == 0)
00018 // Store a value of <target_> that indicate "NULL" pointer.
00019 this->target_ = -1;
00020 else
00021 this->target_ = ((char *) rhs
00022 - ((char *) this - this->base_offset_));
00023 }
|
|
||||||||||
|
Equality operator.
Definition at line 82 of file Based_Pointer_T.i. References ACE_COMPUTE_BASED_POINTER, and ACE_TRACE.
00083 {
00084 ACE_TRACE ("ACE_Based_Pointer_Basic<CONCRETE>::operator ==");
00085 return ACE_COMPUTE_BASED_POINTER (this) == ACE_COMPUTE_BASED_POINTER (&rhs);
00086 }
|
|
||||||||||
|
Greater than operator.
Definition at line 110 of file Based_Pointer_T.i. References ACE_COMPUTE_BASED_POINTER, and ACE_TRACE.
00111 {
00112 ACE_TRACE ("ACE_Based_Pointer_Basic<CONCRETE>::operator >");
00113 return ACE_COMPUTE_BASED_POINTER (this) > ACE_COMPUTE_BASED_POINTER (&rhs);
00114 }
|
|
||||||||||
|
Greater than or equal operator.
Definition at line 117 of file Based_Pointer_T.i. References ACE_COMPUTE_BASED_POINTER, and ACE_TRACE.
00118 {
00119 ACE_TRACE ("ACE_Based_Pointer_Basic<CONCRETE>::operator >=");
00120 return ACE_COMPUTE_BASED_POINTER (this) >= ACE_COMPUTE_BASED_POINTER (&rhs);
00121 }
|
|
||||||||||
|
Subscript operator.
Definition at line 66 of file Based_Pointer_T.i. References ACE_COMPUTE_BASED_POINTER, and ACE_TRACE.
00067 {
00068 ACE_TRACE ("ACE_Based_Pointer_Basic<CONCRETE>::operator []");
00069 CONCRETE *c = ACE_reinterpret_cast (CONCRETE *,
00070 ACE_COMPUTE_BASED_POINTER (this));
00071 return c[index];
00072 }
|
|
|||||
|
Declare the dynamic allocation hooks.
Definition at line 134 of file Based_Pointer_T.h. |
|
|||||
|
Keep track of our offset from the base pointer.
Definition at line 143 of file Based_Pointer_T.h. Referenced by ACE_Based_Pointer_Basic, operator+=, ACE_Based_Pointer::operator=, and operator=. |
|
|||||
|
Definition at line 140 of file Based_Pointer_T.h. Referenced by ACE_Based_Pointer_Basic, addr, ACE_Based_Pointer::operator=, and operator=. |
1.2.14 written by Dimitri van Heesch,
© 1997-2002