diff options
Diffstat (limited to 'TAO/orbsvcs/orbsvcs/Naming/Shared_Hash_Map_T.h')
-rw-r--r-- | TAO/orbsvcs/orbsvcs/Naming/Shared_Hash_Map_T.h | 77 |
1 files changed, 77 insertions, 0 deletions
diff --git a/TAO/orbsvcs/orbsvcs/Naming/Shared_Hash_Map_T.h b/TAO/orbsvcs/orbsvcs/Naming/Shared_Hash_Map_T.h new file mode 100644 index 00000000000..f7617026f2e --- /dev/null +++ b/TAO/orbsvcs/orbsvcs/Naming/Shared_Hash_Map_T.h @@ -0,0 +1,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 */ |