1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
|
/* -*- C++ -*- */
// $Id$
// ============================================================================
//
// = LIBRARY
// cos
//
// = FILENAME
// Shared_Hash_Map_T.h
//
// = AUTHOR
// Marina Spivak <marina@cs.wustl.edu>
//
// ============================================================================
#ifndef ACE_SHARED_HASH_MAP_T_H
#define ACE_SHARED_HASH_MAP_T_H
#include "ace/Hash_Map_Manager.h"
template <class EXT_ID, class INT_ID>
class ACE_Shared_Hash_Map : public ACE_Hash_Map_Manager<EXT_ID, INT_ID, ACE_Null_Mutex>
{
// = TITLE
// This class serves as a Proxy that ensures our process always
// has the appropriate allocator in place for every operation
// that accesses or updates the Map Manager.
//
// = DESCRIPTION
// We need this class because otherwise the ALLOCATOR
// pointer will be stored in the Map_Manager that resides within
// shared memory. Naturally, this will cause horrible problems
// since only the first process to set that pointer will be
// guaranteed the address of the ALLOCATOR is meaningful!
public:
ACE_Shared_Hash_Map (ACE_Allocator *alloc);
// Constructor.
ACE_Shared_Hash_Map (size_t size,
ACE_Allocator *alloc);
// Constructor.
// = The following methods are Proxies to the underlying methods
// provided by <ACE_Hash_Map_Manager>. When they are called, they
// acquire the lock, set the allocator to the one specific to this
// process, and then call down to perform the intended operation.
int bind (const EXT_ID &,
const INT_ID &,
ACE_Allocator *alloc);
int unbind (const EXT_ID &,
INT_ID &,
ACE_Allocator *alloc);
int rebind (const EXT_ID &,
const INT_ID &,
EXT_ID &,
INT_ID &,
ACE_Allocator *alloc);
int find (const EXT_ID &,
INT_ID &,
ACE_Allocator *alloc);
int close (ACE_Allocator *alloc);
};
#if defined (ACE_TEMPLATES_REQUIRE_SOURCE)
#include "Shared_Hash_Map_T.cpp"
#endif /* ACE_TEMPLATES_REQUIRE_SOURCE */
#if defined (ACE_TEMPLATES_REQUIRE_PRAGMA)
#pragma implementation ("Shared_Hash_Map_T.cpp")
#endif /* ACE_TEMPLATES_REQUIRE_PRAGMA */
#endif /* ACE_SHARED_HASH_MAP_T_H */
|