graphicsdeviceinterface/gdi/inc/hextree.inl
changeset 183 6a1564a2f3e6
parent 168 2bd88482bfe5
child 194 18f84489a694
equal deleted inserted replaced
168:2bd88482bfe5 183:6a1564a2f3e6
     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".
       
     7 //
       
     8 // Initial Contributors:
       
     9 // Nokia Corporation - initial contribution.
       
    10 //
       
    11 // Contributors:
       
    12 //
       
    13 // Description:
       
    14 // Hexadecimal trees - inline functions
       
    15 //
       
    16 
       
    17 #ifndef HEXTREE_INL
       
    18 #define HEXTREE_INL
       
    19 
       
    20 /**
       
    21 Constructor. It constructs an associative array with no key-value pairs.
       
    22 
       
    23 @param aHeap A pointer to the heap to be used by the associative array
       
    24        implementation to allocate memory for internal data structures. This
       
    25        heap can be shared between several processes.
       
    26 */
       
    27 template<class T>
       
    28 inline RHexTree<T>::RHexTree(RHeap* aHeap)
       
    29     : RHexTreeBase(aHeap)
       
    30     {
       
    31     }
       
    32 
       
    33 /**
       
    34 Adds a key-value pair to this associative array.
       
    35 
       
    36 @param aKey The 32-bit key to add to this associative array.
       
    37 @param aValue A pointer to the value to associate with aKey. It must have been
       
    38        allocated on the same heap as the one used by the associative array
       
    39        implementation to allocate memory for internal data structures. Ownership
       
    40        is transferred to this associative array.
       
    41 @return KErrNone if the key-value pair was added successfully. KErrNoMemory if
       
    42         there was not enough memory in the heap for internal data structures.
       
    43         KErrAlreadyExists if an attempt was made to add a duplicate key.
       
    44 */
       
    45 template<class T>
       
    46 inline TInt RHexTree<T>::SetAt(TUint aKey, T* aValue)
       
    47     {
       
    48     return RHexTreeBase::SetAt(aKey, aValue);
       
    49     }
       
    50 
       
    51 /**
       
    52 Looks up a given key in this associative array and returns a pointer to the
       
    53 corresponding value.
       
    54 
       
    55 @param aKey The 32-bit key to look up.
       
    56 @return A pointer to the corresponding value in this associative array, if the
       
    57         given key was found. The value may not be modified via this pointer.
       
    58         NULL if the given key was not found.
       
    59 */
       
    60 template<class T>
       
    61 inline const T* RHexTree<T>::At(TUint aKey) const
       
    62     {
       
    63     return static_cast<T*>(RHexTreeBase::At(aKey));
       
    64     }
       
    65 
       
    66 /**
       
    67 Looks up a given key in this associative array and returns a pointer to the
       
    68 corresponding value. Note that if values are modified after being added to an
       
    69 associative array, then the user is responsible for synchronisation when
       
    70 concurrent access is needed.
       
    71 
       
    72 @param aKey The 32-bit key to look up.
       
    73 @return A pointer to the corresponding value in this associative array, if the
       
    74         given key was found. The value may be modified via this pointer.
       
    75         NULL if the given key was not found.
       
    76 */
       
    77 template<class T>
       
    78 inline T* RHexTree<T>::At(TUint aKey)
       
    79     {
       
    80     return static_cast<T*>(RHexTreeBase::At(aKey));
       
    81     }
       
    82 
       
    83 #endif // HEXTREE_INL