sl@0: // Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
sl@0: // All rights reserved.
sl@0: // This component and the accompanying materials are made available
sl@0: // under the terms of "Eclipse Public License v1.0"
sl@0: // which accompanies this distribution, and is available
sl@0: // at the URL "http://www.eclipse.org/legal/epl-v10.html".
sl@0: //
sl@0: // Initial Contributors:
sl@0: // Nokia Corporation - initial contribution.
sl@0: //
sl@0: // Contributors:
sl@0: //
sl@0: // Description:
sl@0: // Hexadecimal trees - inline functions
sl@0: //
sl@0: 
sl@0: #ifndef HEXTREE_INL
sl@0: #define HEXTREE_INL
sl@0: 
sl@0: /**
sl@0: Constructor. It constructs an associative array with no key-value pairs.
sl@0: 
sl@0: @param aHeap A pointer to the heap to be used by the associative array
sl@0:        implementation to allocate memory for internal data structures. This
sl@0:        heap can be shared between several processes.
sl@0: */
sl@0: template<class T>
sl@0: inline RHexTree<T>::RHexTree(RHeap* aHeap)
sl@0:     : RHexTreeBase(aHeap)
sl@0:     {
sl@0:     }
sl@0: 
sl@0: /**
sl@0: Adds a key-value pair to this associative array.
sl@0: 
sl@0: @param aKey The 32-bit key to add to this associative array.
sl@0: @param aValue A pointer to the value to associate with aKey. It must have been
sl@0:        allocated on the same heap as the one used by the associative array
sl@0:        implementation to allocate memory for internal data structures. Ownership
sl@0:        is transferred to this associative array.
sl@0: @return KErrNone if the key-value pair was added successfully. KErrNoMemory if
sl@0:         there was not enough memory in the heap for internal data structures.
sl@0:         KErrAlreadyExists if an attempt was made to add a duplicate key.
sl@0: */
sl@0: template<class T>
sl@0: inline TInt RHexTree<T>::SetAt(TUint aKey, T* aValue)
sl@0:     {
sl@0:     return RHexTreeBase::SetAt(aKey, aValue);
sl@0:     }
sl@0: 
sl@0: /**
sl@0: Looks up a given key in this associative array and returns a pointer to the
sl@0: corresponding value.
sl@0: 
sl@0: @param aKey The 32-bit key to look up.
sl@0: @return A pointer to the corresponding value in this associative array, if the
sl@0:         given key was found. The value may not be modified via this pointer.
sl@0:         NULL if the given key was not found.
sl@0: */
sl@0: template<class T>
sl@0: inline const T* RHexTree<T>::At(TUint aKey) const
sl@0:     {
sl@0:     return static_cast<T*>(RHexTreeBase::At(aKey));
sl@0:     }
sl@0: 
sl@0: /**
sl@0: Looks up a given key in this associative array and returns a pointer to the
sl@0: corresponding value. Note that if values are modified after being added to an
sl@0: associative array, then the user is responsible for synchronisation when
sl@0: concurrent access is needed.
sl@0: 
sl@0: @param aKey The 32-bit key to look up.
sl@0: @return A pointer to the corresponding value in this associative array, if the
sl@0:         given key was found. The value may be modified via this pointer.
sl@0:         NULL if the given key was not found.
sl@0: */
sl@0: template<class T>
sl@0: inline T* RHexTree<T>::At(TUint aKey)
sl@0:     {
sl@0:     return static_cast<T*>(RHexTreeBase::At(aKey));
sl@0:     }
sl@0: 
sl@0: #endif // HEXTREE_INL