3 //=============================================================================
5 * @file Based_Pointer_Repository.h
7 * @author Dietrich Quehl <Dietrich.Quehl@med.siemens.de>
8 * @author Douglas C. Schmidt <schmidt@.cs.wustl.edu>
10 //=============================================================================
12 #ifndef ACE_BASED_POINTER_REPOSITORY_H
13 #define ACE_BASED_POINTER_REPOSITORY_H
15 #include /**/ "ace/pre.h"
17 #include /**/ "ace/ACE_export.h"
19 #if !defined (ACE_LACKS_PRAGMA_ONCE)
21 #endif /* ACE_LACKS_PRAGMA_ONCE */
23 #include "ace/Singleton.h"
24 #include "ace/Synch_Traits.h"
25 #include "ace/os_include/os_stddef.h"
28 ACE_BEGIN_VERSIONED_NAMESPACE_DECL
30 // Forward decl., using the "Cheshire Cat" technique.
31 class ACE_Based_Pointer_Repository_Rep
;
34 * @class ACE_Based_Pointer_Repository
36 * @brief Maps pointers to the base address of the region to which each
39 class ACE_Export ACE_Based_Pointer_Repository
42 // = Use ACE_Null_Mutex to allow locking while iterating.
44 ACE_Based_Pointer_Repository ();
45 ~ACE_Based_Pointer_Repository ();
47 // = Search structure methods.
49 * Return the appropriate @a base_addr region that contains @a addr.
50 * Returns 1 on success and 0 if the @a addr isn't contained in any
51 * @a base_addr region.
56 /// Bind a new entry to the repository or update the size of an
57 /// existing entry. Returns 0 on success and -1 on failure.
61 /// Unbind from the repository the <base_addr> that @a addr is
63 int unbind (void *addr
);
66 /// Use the "Cheshire-Cat" technique to hide the implementation in
67 /// order to avoid circular #include dependencies.
68 ACE_Based_Pointer_Repository_Rep
*rep_
;
71 void operator= (const ACE_Based_Pointer_Repository
&) = delete;
72 ACE_Based_Pointer_Repository (const ACE_Based_Pointer_Repository
&) = delete;
75 // ----------------------------------
77 /// Declare a process wide singleton
78 ACE_SINGLETON_DECLARE (ACE_Singleton
, ACE_Based_Pointer_Repository
, ACE_SYNCH_RW_MUTEX
)
80 /// Provide a Singleton access point to the based pointer repository.
81 typedef ACE_Singleton
<ACE_Based_Pointer_Repository
, ACE_SYNCH_RW_MUTEX
> ACE_BASED_POINTER_REPOSITORY
;
83 ACE_END_VERSIONED_NAMESPACE_DECL
85 #include /**/ "ace/post.h"
87 #endif /* ACE_BASED_POINTER_REPOSITORY_H */