Changes to attempt to silence bcc64x
[ACE_TAO.git] / ACE / ace / Based_Pointer_Repository.h
blobc2a2b5e5ba60b11f47429a59dbf1b1c601a4c575
1 // -*- C++ -*-
3 //=============================================================================
4 /**
5 * @file Based_Pointer_Repository.h
7 * @author Dietrich Quehl <Dietrich.Quehl@med.siemens.de>
8 * @author Douglas C. Schmidt <schmidt@.cs.wustl.edu>
9 */
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)
20 # 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;
33 /**
34 * @class ACE_Based_Pointer_Repository
36 * @brief Maps pointers to the base address of the region to which each
37 * pointer belongs.
39 class ACE_Export ACE_Based_Pointer_Repository
41 public:
42 // = Use ACE_Null_Mutex to allow locking while iterating.
44 ACE_Based_Pointer_Repository ();
45 ~ACE_Based_Pointer_Repository ();
47 // = Search structure methods.
48 /**
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.
53 int find (void *addr,
54 void *&base_addr);
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.
58 int bind (void *addr,
59 size_t size);
61 /// Unbind from the repository the <base_addr> that @a addr is
62 /// contained within.
63 int unbind (void *addr);
65 private:
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_;
70 private:
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 */