graphicsdeviceinterface/gdi/inc/hextree.inl
author hgs
Tue, 22 Jun 2010 15:21:29 +0300
changeset 103 2717213c588a
permissions -rw-r--r--
201024
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
103
hgs
parents:
diff changeset
     1
// Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
hgs
parents:
diff changeset
     2
// All rights reserved.
hgs
parents:
diff changeset
     3
// This component and the accompanying materials are made available
hgs
parents:
diff changeset
     4
// under the terms of "Eclipse Public License v1.0"
hgs
parents:
diff changeset
     5
// which accompanies this distribution, and is available
hgs
parents:
diff changeset
     6
// at the URL "http://www.eclipse.org/legal/epl-v10.html".
hgs
parents:
diff changeset
     7
//
hgs
parents:
diff changeset
     8
// Initial Contributors:
hgs
parents:
diff changeset
     9
// Nokia Corporation - initial contribution.
hgs
parents:
diff changeset
    10
//
hgs
parents:
diff changeset
    11
// Contributors:
hgs
parents:
diff changeset
    12
//
hgs
parents:
diff changeset
    13
// Description:
hgs
parents:
diff changeset
    14
// Hexadecimal trees - inline functions
hgs
parents:
diff changeset
    15
//
hgs
parents:
diff changeset
    16
hgs
parents:
diff changeset
    17
#ifndef HEXTREE_INL
hgs
parents:
diff changeset
    18
#define HEXTREE_INL
hgs
parents:
diff changeset
    19
hgs
parents:
diff changeset
    20
/**
hgs
parents:
diff changeset
    21
Constructor. It constructs an associative array with no key-value pairs.
hgs
parents:
diff changeset
    22
hgs
parents:
diff changeset
    23
@param aHeap A pointer to the heap to be used by the associative array
hgs
parents:
diff changeset
    24
       implementation to allocate memory for internal data structures. This
hgs
parents:
diff changeset
    25
       heap can be shared between several processes.
hgs
parents:
diff changeset
    26
*/
hgs
parents:
diff changeset
    27
template<class T>
hgs
parents:
diff changeset
    28
inline RHexTree<T>::RHexTree(RHeap* aHeap)
hgs
parents:
diff changeset
    29
    : RHexTreeBase(aHeap)
hgs
parents:
diff changeset
    30
    {
hgs
parents:
diff changeset
    31
    }
hgs
parents:
diff changeset
    32
hgs
parents:
diff changeset
    33
/**
hgs
parents:
diff changeset
    34
Adds a key-value pair to this associative array.
hgs
parents:
diff changeset
    35
hgs
parents:
diff changeset
    36
@param aKey The 32-bit key to add to this associative array.
hgs
parents:
diff changeset
    37
@param aValue A pointer to the value to associate with aKey. It must have been
hgs
parents:
diff changeset
    38
       allocated on the same heap as the one used by the associative array
hgs
parents:
diff changeset
    39
       implementation to allocate memory for internal data structures. Ownership
hgs
parents:
diff changeset
    40
       is transferred to this associative array.
hgs
parents:
diff changeset
    41
@return KErrNone if the key-value pair was added successfully. KErrNoMemory if
hgs
parents:
diff changeset
    42
        there was not enough memory in the heap for internal data structures.
hgs
parents:
diff changeset
    43
        KErrAlreadyExists if an attempt was made to add a duplicate key.
hgs
parents:
diff changeset
    44
*/
hgs
parents:
diff changeset
    45
template<class T>
hgs
parents:
diff changeset
    46
inline TInt RHexTree<T>::SetAt(TUint aKey, T* aValue)
hgs
parents:
diff changeset
    47
    {
hgs
parents:
diff changeset
    48
    return RHexTreeBase::SetAt(aKey, aValue);
hgs
parents:
diff changeset
    49
    }
hgs
parents:
diff changeset
    50
hgs
parents:
diff changeset
    51
/**
hgs
parents:
diff changeset
    52
Looks up a given key in this associative array and returns a pointer to the
hgs
parents:
diff changeset
    53
corresponding value.
hgs
parents:
diff changeset
    54
hgs
parents:
diff changeset
    55
@param aKey The 32-bit key to look up.
hgs
parents:
diff changeset
    56
@return A pointer to the corresponding value in this associative array, if the
hgs
parents:
diff changeset
    57
        given key was found. The value may not be modified via this pointer.
hgs
parents:
diff changeset
    58
        NULL if the given key was not found.
hgs
parents:
diff changeset
    59
*/
hgs
parents:
diff changeset
    60
template<class T>
hgs
parents:
diff changeset
    61
inline const T* RHexTree<T>::At(TUint aKey) const
hgs
parents:
diff changeset
    62
    {
hgs
parents:
diff changeset
    63
    return static_cast<T*>(RHexTreeBase::At(aKey));
hgs
parents:
diff changeset
    64
    }
hgs
parents:
diff changeset
    65
hgs
parents:
diff changeset
    66
/**
hgs
parents:
diff changeset
    67
Looks up a given key in this associative array and returns a pointer to the
hgs
parents:
diff changeset
    68
corresponding value. Note that if values are modified after being added to an
hgs
parents:
diff changeset
    69
associative array, then the user is responsible for synchronisation when
hgs
parents:
diff changeset
    70
concurrent access is needed.
hgs
parents:
diff changeset
    71
hgs
parents:
diff changeset
    72
@param aKey The 32-bit key to look up.
hgs
parents:
diff changeset
    73
@return A pointer to the corresponding value in this associative array, if the
hgs
parents:
diff changeset
    74
        given key was found. The value may be modified via this pointer.
hgs
parents:
diff changeset
    75
        NULL if the given key was not found.
hgs
parents:
diff changeset
    76
*/
hgs
parents:
diff changeset
    77
template<class T>
hgs
parents:
diff changeset
    78
inline T* RHexTree<T>::At(TUint aKey)
hgs
parents:
diff changeset
    79
    {
hgs
parents:
diff changeset
    80
    return static_cast<T*>(RHexTreeBase::At(aKey));
hgs
parents:
diff changeset
    81
    }
hgs
parents:
diff changeset
    82
hgs
parents:
diff changeset
    83
#endif // HEXTREE_INL