diff options
author | coryan <coryan@ae88bc3d-4319-0410-8dbf-d08b4c9d3795> | 2000-11-01 22:17:39 +0000 |
---|---|---|
committer | coryan <coryan@ae88bc3d-4319-0410-8dbf-d08b4c9d3795> | 2000-11-01 22:17:39 +0000 |
commit | 53284e215e3d3351a7d7e9c4b68f14b427fb4377 (patch) | |
tree | 97236ece363cff48fd287c780db4290da39b02cb /ace/Based_Pointer_T.h | |
parent | 7b7c52ad2abd228138ba1a948d5e28bf6dc3b880 (diff) | |
download | ATCD-53284e215e3d3351a7d7e9c4b68f14b427fb4377.tar.gz |
ChangeLogTag:Wed Nov 1 14:11:48 2000 Carlos O'Ryan <coryan@uci.edu>
Diffstat (limited to 'ace/Based_Pointer_T.h')
-rw-r--r-- | ace/Based_Pointer_T.h | 187 |
1 files changed, 96 insertions, 91 deletions
diff --git a/ace/Based_Pointer_T.h b/ace/Based_Pointer_T.h index 3ae2f0cc833..e06f6b3b692 100644 --- a/ace/Based_Pointer_T.h +++ b/ace/Based_Pointer_T.h @@ -1,19 +1,16 @@ /* -*- C++ -*- */ -// $Id$ - -// ============================================================================ -// -// = LIBRARY -// ace -// -// = FILENAME -// Based_Pointer_T.h -// -// = AUTHOR -// Dietrich Quehl <Dietrich.Quehl@med.siemens.de> and -// Douglas C. Schmidt <schmidt@.cs.wustl.edu> -// -// ============================================================================ + +//============================================================================= +/** + * @file Based_Pointer_T.h + * + * $Id$ + * + * @author Dietrich Quehl <Dietrich.Quehl@med.siemens.de> + * @author Douglas C. Schmidt <schmidt@.cs.wustl.edu> + */ +//============================================================================= + #ifndef ACE_BASED_POINTER_T_H #define ACE_BASED_POINTER_T_H @@ -29,148 +26,156 @@ #pragma warning(disable: 4284) #endif /* _MSC_VER */ +/** + * @class ACE_Based_Pointer_Basic + * + * @brief A proxy that keeps track of the relative offset of a "pointer" + * from its base address. + * 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. + */ 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. - // - // 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. public: + /** + * 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 (void); - // 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. + /** + * 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. 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); - // 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. 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. + /// Copy constructor. ACE_Based_Pointer_Basic (const ACE_Based_Pointer_Basic<CONCRETE> &); - // Copy constructor. + /// Constructor for know base address. <o> is only used to + /// resolve overload ambiguity. ACE_Based_Pointer_Basic (const void *base_addr, int o); - // Constructor for know base address. <o> is only used to - // resolve overload ambiguity. + /// Pseudo-assignment operator. void operator = (CONCRETE *from); - // Pseudo-assignment operator. + /// Pseudo-assignment operator. void operator = (const ACE_Based_Pointer_Basic<CONCRETE> &); - // Pseudo-assignment operator. + /// Dereference operator. CONCRETE operator * (void) const; - // Dereference operator. + /// Less than operator. int operator < (const ACE_Based_Pointer_Basic<CONCRETE> &) const; - // Less than operator. + /// Less than or equal operator. int operator <= (const ACE_Based_Pointer_Basic<CONCRETE> &) const; - // Less than or equal operator. + /// Greater than operator. int operator > (const ACE_Based_Pointer_Basic<CONCRETE> &) const; - // Greater than operator. + /// Greater than or equal operator. int operator >= (const ACE_Based_Pointer_Basic<CONCRETE> &) const; - // Greater than or equal operator. + /// Equality operator. int operator == (const ACE_Based_Pointer_Basic<CONCRETE> &) const; - // Equality operator. + /// Inequality operator. int operator != (const ACE_Based_Pointer_Basic<CONCRETE> &) const; - // Inequality operator. + /// Subscript operator. CONCRETE operator [](int index) const; - // Subscript operator. + /// Increment operator. void operator+= (int index); - // Increment operator. + /// Returns the underlying memory address of the smart pointer. operator CONCRETE *() const; - // Returns the underlying memory address of the smart pointer. + /// Returns the underlying memory address of the smart pointer. CONCRETE *addr (void) const; - // Returns the underlying memory address of the smart pointer. + /// Declare the dynamic allocation hooks. ACE_ALLOC_HOOK_DECLARE; - // Declare the dynamic allocation hooks. + /// Dump the state of the object. void dump (void) const; - // Dump the state of the object. protected: long target_; + /// Keep track of our offset from the base pointer. long base_offset_; - // Keep track of our offset from the base pointer. }; +/** + * @class ACE_Based_Pointer + * + * @brief A smart proxy that keeps track of the relative offset of a + * "pointer" from its base address. + * + * This class makes it possible to transparently use "pointers" in + * shared memory as easily as programming with pointers to local + * memory by overloading the C++ delegation operator ->(). + */ template <class CONCRETE> class ACE_Based_Pointer : public ACE_Based_Pointer_Basic<CONCRETE> { - // = TITLE - // A smart proxy that keeps track of the relative offset of a - // "pointer" from its base address. - // - // = DESCRIPTION - // This class makes it possible to transparently use "pointers" in - // shared memory as easily as programming with pointers to local - // memory by overloading the C++ delegation operator ->(). public: // = Initialization method. + /// Constructor. See constructor for <ACE_Based_Pointer_Basic> for + /// details. ACE_Based_Pointer (void); - // Constructor. See constructor for <ACE_Based_Pointer_Basic> for - // details. + /// Initialize this object using the <initial> pointer. ACE_Based_Pointer (CONCRETE *initial); - // Initialize this object using the <initial> pointer. + /// Initialize this object with known <base_addr>. <o> is + /// only used to resolve overload ambiguity. ACE_Based_Pointer (const void *base_addr, int o); - // Initialize this object with known <base_addr>. <o> is - // only used to resolve overload ambiguity. + /// Copy constructor (not implemented yet). ACE_Based_Pointer (const ACE_Based_Pointer<CONCRETE> &); - // Copy constructor (not implemented yet). + /// Assignment operator. void operator = (const ACE_Based_Pointer<CONCRETE> &); - // Assignment operator. + /// Pseudo-assignment operator. void operator = (CONCRETE *from); - // Pseudo-assignment operator. + /// The C++ "delegation operator". CONCRETE *operator-> (void); - // The C++ "delegation operator". }; #if defined (__ACE_INLINE__) |