GitHub Actions: Try MSVC builds with /std:c++17 and 20
[ACE_TAO.git] / ACE / ace / Based_Pointer_Repository.h
blob8139a8edbfb71a5a981cecbb4fd19ea9afeb4bbe
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 (void);
45 ~ACE_Based_Pointer_Repository (void);
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 ACE_UNIMPLEMENTED_FUNC (void operator= (const ACE_Based_Pointer_Repository &))
72 ACE_UNIMPLEMENTED_FUNC (ACE_Based_Pointer_Repository (const ACE_Based_Pointer_Repository &))
75 // ----------------------------------
77 /// Declare a process wide singleton
78 ACE_SINGLETON_DECLARE (ACE_Singleton,
79 ACE_Based_Pointer_Repository,
80 ACE_SYNCH_RW_MUTEX)
82 /// Provide a Singleton access point to the based pointer repository.
83 typedef ACE_Singleton<ACE_Based_Pointer_Repository, ACE_SYNCH_RW_MUTEX>
84 ACE_BASED_POINTER_REPOSITORY;
86 ACE_END_VERSIONED_NAMESPACE_DECL
88 #include /**/ "ace/post.h"
90 #endif /* ACE_BASED_POINTER_REPOSITORY_H */