Update contrib.
1 // Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
2 // All rights reserved.
3 // This component and the accompanying materials are made available
4 // under the terms of "Eclipse Public License v1.0"
5 // which accompanies this distribution, and is available
6 // at the URL "http://www.eclipse.org/legal/epl-v10.html".
8 // Initial Contributors:
9 // Nokia Corporation - initial contribution.
14 // Hexadecimal trees - declaration
23 Base class that provides the implementation for RHexTree, which is just a thin
26 An instance of this class can have up to eight 16-way prefix trees, with heights
27 from 1 to 8. All the values are stored in the leaves. To find a value from a
28 32-bit key, first the key is decomposed into 8 hexadecimal digits and then the
29 prefix tree with height matching the number of digits in the key (ignoring zeros
30 to the left) is traversed using the sequence of digits in the key as the
31 indexing string. Offsets are internally used instead of pointers to allow
32 instances to be placed in a heap shared between several processes.
37 IMPORT_C void ResetAndDestroy();
39 IMPORT_C RHexTreeBase(RHeap* aHeap);
40 IMPORT_C TInt SetAt(TUint aKey, TAny* aValue);
41 IMPORT_C TAny* At(TUint aKey) const;
43 TInt SetAt(TUint aKey, TAny* aLeaf, TInt aHeight);
44 TInt SetAt(TUint aKey, TAny* aLeaf, TInt aHeight, TAny* aNode, TInt aLevel);
45 TAny* At(TUint aKey, TInt aHeight) const;
46 void ResetAndDestroy(TInt aHeight, TAny* aNode, TInt aLevel);
48 enum { EMaxNumHexDigits = 8 };
51 TInt iRootOffsets[EMaxNumHexDigits];
55 An associative array implementation optimised for the case where the keys are
56 32-bit codes with spatial locality of reference. The values can be of any
57 self-contained data type (that is, without destructor or clean-up functions).
58 It allows multiple-readers, single-writer concurrent access from different
59 processes in an SMP-safe manner without locking, excluding deletion of
60 individual key-value pairs.
63 class RHexTree : public RHexTreeBase
66 inline RHexTree(RHeap* aHeap);
67 inline TInt SetAt(TUint aKey, T* aValue);
68 inline const T* At(TUint aKey) const;
69 inline T* At(TUint aKey);
72 #include <hextree.inl>