---
name: "ACE_Hash_Map_With_Allocator"
section: "3"
platform: "linux"
package: "libace-doc"
version: "5.0.7-4"
release: "Debian 2.2 (Potato)"
platforms: ["linux"]
url: "https://new.carta.tech/ACE_Hash_Map_With_Allocator"
---

# ACE\_Hash\_Map\_With\_Allocator(3)

This class is a thin wrapper around ACE\_Hash\_Map\_Manager, which comes handy when ACE\_Hash\_Map\_Manager is to be used with a non-nil ACE\_Allocator. This wrapper insures that the appropriate allocator is in place for every operation that accesses or updates the hash map.

## NAME

ACE\_Hash\_Map\_With\_Allocator -  This class is a thin wrapper around ACE\_Hash\_Map\_Manager, which comes handy when ACE\_Hash\_Map\_Manager is to be used with a non-nil ACE\_Allocator.  This wrapper insures that the appropriate allocator is in place for every operation that accesses or updates the hash map.

## SYNOPSIS

```
template<class EXT_ID, class INT_ID>
class ACE_Hash_Map_With_Allocator :
  public ACE_Hash_Map_Manager<EXT_ID, INT_ID, ACE_Null_Mutex>
{
  public:
    ACE_Hash_Map_With_Allocator (ACE_Allocator *alloc);
    ACE_Hash_Map_With_Allocator (size_t size, ACE_Allocator *alloc);
    int bind (const EXT_ID &, const INT_ID &, ACE_Allocator *alloc);
    int unbind (const EXT_ID &, INT_ID &, ACE_Allocator *alloc);
    int unbind (const EXT_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 find (const EXT_ID &, ACE_Allocator *alloc);
    int close (ACE_Allocator *alloc);
};
```

## DESCRIPTION

If we use ACE\_Hash\_Map\_Manager with a shared memory allocator (or memory-mapped file allocator, for example), the allocator pointer used by ACE\_Hash\_Map\_Manager gets stored with it, in shared memory (or memory-mapped file).  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!  That is why we need this wrapper, which insures that appropriate allocator pointer is in place for each call.

## The following methods are Proxies to the corresponding methods

in ACE\_Hash\_Map\_Manager.  Each method sets the allocator to the one specified by the invoking entity, and then calls the corresponding method in ACE\_Hash\_Map\_Manager to do the actual work.

```
int bind (const EXT_ID &, const INT_ID &, ACE_Allocator *alloc);
```

```
int unbind (const EXT_ID &, INT_ID &, ACE_Allocator *alloc);
```

```
int unbind (const EXT_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 find (const EXT_ID &, ACE_Allocator *alloc);
```

Returns 0 if the ext\_id is in the mapping, otherwise -1.

```
int close (ACE_Allocator *alloc);
```
