This class makes it possible to transparently use "pointers" in shared memory as easily as programming with pointers to local memory. In particular, we don't need to ensure that the base addresses of all the pointers are mapped into separate processes at the same absolute memory base address.
#include <ace/Based_Pointer_T.h>
template<class CONCRETE> class ACE_Based_Pointer_Basic {
public:
ACE_Based_Pointer_Basic (void);
ACE_Based_Pointer_Basic (CONCRETE *initial);
ACE_Based_Pointer_Basic ( const ACE_Based_Pointer_Basic<CONCRETE> & );
void operator = (CONCRETE *from);
void operator = (const ACE_Based_Pointer_Basic<CONCRETE> &);
CONCRETE operator * (void) const;
int operator < (const ACE_Based_Pointer_Basic<CONCRETE> &) const;
int operator <= (const ACE_Based_Pointer_Basic<CONCRETE> &) const;
int operator > (const ACE_Based_Pointer_Basic<CONCRETE> &) const;
int operator >= (const ACE_Based_Pointer_Basic<CONCRETE> &) const;
int operator == (const ACE_Based_Pointer_Basic<CONCRETE> &) const;
int operator != (const ACE_Based_Pointer_Basic<CONCRETE> &) const;
CONCRETE operator [](int index) const;
void operator+= (int index);
operator CONCRETE *() const;
CONCRETE *addr (void) const;
ACE_ALLOC_HOOK_DECLARE;
void dump (void) const;
protected:
long target_;
long base_offset_;
};
ACE_Based_Pointer_Basic (void);
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.
ACE_Based_Pointer_Basic (CONCRETE *initial);
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. 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.
ACE_Based_Pointer_Basic (const ACE_Based_Pointer_Basic<CONCRETE> &);
void operator = (CONCRETE *from);
void operator = (const ACE_Based_Pointer_Basic<CONCRETE> &);
CONCRETE operator * (void) const;
int operator < (const ACE_Based_Pointer_Basic<CONCRETE> &) const;
int operator <= (const ACE_Based_Pointer_Basic<CONCRETE> &) const;
int operator > (const ACE_Based_Pointer_Basic<CONCRETE> &) const;
int operator >= (const ACE_Based_Pointer_Basic<CONCRETE> &) const;
int operator == (const ACE_Based_Pointer_Basic<CONCRETE> &) const;
int operator != (const ACE_Based_Pointer_Basic<CONCRETE> &) const;
CONCRETE operator [](int index) const;
void operator+= (int index);
operator CONCRETE *() const;
CONCRETE *addr (void) const;
ACE_ALLOC_HOOK_DECLARE;
void dump (void) const;
long target_;
long base_offset_;
Dietrich.Quehl@med.siemens.de
and
Douglas C. Schmidt schmidt@.cs.wustl.edu