Map class template to store values of a certain type. Manages a mapping from K to V, leaving the hash function implementation to the subclass (abstract BucketSet.toHash()).
HashMap class template to store the raw data of values of a certain size. Manages a mapping from K to ubyteV, leaving the hash function implementation to the subclass (abstract BucketSet.toHash()). Since static arrays cannot be returned, the access methods return a void[] slice to the value.
StandardKeyHashingMap class template. Manages a mapping from K to V, using a standard way of hash calculation:
StandardKeyHashingMap class template. Manages a mapping from K to ubyteV, using a standard way of hash calculation:
Test key types smaller than size_t (or even equals) don't screw up the alignment and makes impossible to the GC to scan pointers in the value.
Test key types smaller than size_t (or even equals) don't screw up the alignment and makes impossible to the GC to scan pointers in the value.
Boost Software License Version 1.0. See LICENSE_BOOST.txt for details. Alternatively, this file may be distributed under the terms of the Tango 3-Clause BSD License (see LICENSE_BSD.txt for details).
Copyright (c) 2009-2016 dunnhumby Germany GmbH. All rights reserved.
Template for a class implementing a mapping from a user-specified type to a user-specified type.
The interface of the class has been kept deliberately simple, purely handling the management of the mapping. The handling of the mapping values is left entirely up to the user -- all methods simply return a pointer to the mapping value which the user can do what they like with. (This is an intentional design decision, in order to reduce the complexity of the template.)
The HashMap is designed as a replacement for ocean.core.ArrayMap. It has several advantages: 1. Memory safety. As the ArrayMap's buckets are implemented as dynamic arrays, each bucket will theoretically grow continually in size over extended periods of use. Even when clear()ed, the buffers allocated for the buckets will not reduce in size. The HashMap, on the other hand, uses a pool of elements, meaning that the memory allocated for each bucket is truly variable. 2. Code simplicity via removing optional advanced features such as thread safety and value array copying. 3. Extensibility. Functionality is split into several modules, including a base class for easier reuse of components.
Usage example with various types stored in mapping: