Changes to attempt to silence bcc64x
[ACE_TAO.git] / ACE / ace / Hash_Map_With_Allocator_T.h
blobeb8473305d6e4007cf5a788742de072e63786f06
1 // -*- C++ -*-
3 //=============================================================================
4 /**
5 * @file Hash_Map_With_Allocator_T.h
7 * @author Marina Spivak <marina@cs.wustl.edu>
8 * @author Irfan Pyarali <irfan@cs.wustl.edu>
9 */
10 //=============================================================================
12 #ifndef ACE_HASH_MAP_WITH_ALLOCATOR_T_H
13 #define ACE_HASH_MAP_WITH_ALLOCATOR_T_H
14 #include /**/ "ace/pre.h"
16 #include "ace/Hash_Map_Manager_T.h"
17 #include "ace/Null_Mutex.h"
19 #if !defined (ACE_LACKS_PRAGMA_ONCE)
20 # pragma once
21 #endif /* ACE_LACKS_PRAGMA_ONCE */
23 ACE_BEGIN_VERSIONED_NAMESPACE_DECL
25 /**
26 * @class ACE_Hash_Map_With_Allocator
28 * @brief This class is a thin wrapper around ACE_Hash_Map_Manager,
29 * which comes handy when ACE_Hash_Map_Manager is to be used with a
30 * non-nil ACE_Allocator. This wrapper insures that the appropriate
31 * allocator is in place for every operation that accesses or
32 * updates the hash map.
34 * If we use ACE_Hash_Map_Manager with a shared memory allocator
35 * (or memory-mapped file allocator, for example), the allocator
36 * pointer used by ACE_Hash_Map_Manager gets stored with it, in
37 * shared memory (or memory-mapped file). Naturally, this will
38 * cause horrible problems, since only the first process to set
39 * that pointer will be guaranteed the address of the allocator
40 * is meaningful! That is why we need this wrapper, which
41 * insures that appropriate allocator pointer is in place for
42 * each call.
44 * At some point it would be a good idea to update this class to
45 * use the new "two allocator" technique provided by @c
46 * ACE_Hash_Map_Manager_Ex.
48 template <class EXT_ID, class INT_ID>
49 class ACE_Hash_Map_With_Allocator :
50 public ACE_Hash_Map_Manager_Ex<EXT_ID, INT_ID, ACE_Hash<EXT_ID>, ACE_Equal_To<EXT_ID>, ACE_Null_Mutex>
52 public:
53 /// Constructor.
54 ACE_Hash_Map_With_Allocator (ACE_Allocator *alloc);
56 /// Constructor that specifies hash table size.
57 ACE_Hash_Map_With_Allocator (size_t size,
58 ACE_Allocator *alloc);
60 // = The following methods are Proxies to the corresponding methods
61 // in ACE_Hash_Map_Manager. Each method sets the allocator to
62 // the one specified by the invoking entity, and then calls the
63 // corresponding method in ACE_Hash_Map_Manager to do the
64 // actual work.
66 int bind (const EXT_ID &,
67 const INT_ID &,
68 ACE_Allocator *alloc);
70 int unbind (const EXT_ID &,
71 INT_ID &,
72 ACE_Allocator *alloc);
74 int unbind (const EXT_ID &,
75 ACE_Allocator *alloc);
77 int rebind (const EXT_ID &,
78 const INT_ID &,
79 EXT_ID &,
80 INT_ID &,
81 ACE_Allocator *alloc);
83 int find (const EXT_ID &,
84 INT_ID &,
85 ACE_Allocator *alloc);
87 /// Returns 0 if the @a ext_id is in the mapping, otherwise -1.
88 int find (const EXT_ID &ext_id,
89 ACE_Allocator *alloc);
91 int close (ACE_Allocator *alloc);
94 ACE_END_VERSIONED_NAMESPACE_DECL
96 #if defined (__ACE_INLINE__)
97 #include "ace/Hash_Map_With_Allocator_T.inl"
98 #endif /* __ACE_INLINE__ */
100 #include "ace/Hash_Map_With_Allocator_T.cpp"
102 #include /**/ "ace/post.h"
103 #endif /* ACE_HASH_MAP_WITH_ALLOCATOR_T_H */