main/al/newallocator.inl
changeset 23 74c9f037fd5d
equal deleted inserted replaced
5:f7f0874bfe7d 23:74c9f037fd5d
       
     1 /*
       
     2 * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
       
     3 * All rights reserved.
       
     4 * This component and the accompanying materials are made available
       
     5 * under the terms of "Eclipse Public License v1.0"
       
     6 * which accompanies this distribution, and is available
       
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     8 *
       
     9 * Initial Contributors:
       
    10 * Nokia Corporation - initial contribution.
       
    11 *
       
    12 * Contributors:
       
    13 *
       
    14 * Description: 
       
    15 *
       
    16 */
       
    17 #ifndef NEWALLOCATOR_INL
       
    18 #define NEWALLOCATOR_INL
       
    19 
       
    20 inline RNewAllocator::RNewAllocator()
       
    21     {}
       
    22 
       
    23 /**
       
    24 @return The maximum length to which the heap can grow.
       
    25 
       
    26 @publishedAll
       
    27 @released
       
    28 */
       
    29 inline TInt RNewAllocator::MaxLength() const
       
    30     {return iMaxLength;}
       
    31 
       
    32 inline void RNewAllocator::operator delete(TAny*, TAny*) 
       
    33 /**
       
    34 Called if constructor issued by operator new(TUint aSize, TAny* aBase) throws exception.
       
    35 This is dummy as corresponding new operator does not allocate memory.
       
    36 */
       
    37     {}
       
    38 
       
    39 
       
    40 inline TUint8* RNewAllocator::Base() const
       
    41 /**
       
    42 Gets a pointer to the start of the heap.
       
    43     
       
    44 Note that because of the small space overhead incurred by all allocated cells, 
       
    45 no cell will have the same address as that returned by this function.
       
    46     
       
    47 @return A pointer to the base of the heap.
       
    48 */
       
    49     {return iBase;}
       
    50 
       
    51 
       
    52 inline TInt RNewAllocator::Align(TInt a) const
       
    53 /**
       
    54 @internalComponent
       
    55 */
       
    56     {return _ALIGN_UP(a, iAlign);}
       
    57 
       
    58 
       
    59 
       
    60 
       
    61 inline const TAny* RNewAllocator::Align(const TAny* a) const
       
    62 /**
       
    63 @internalComponent
       
    64 */
       
    65     {return (const TAny*)_ALIGN_UP((TLinAddr)a, iAlign);}
       
    66 
       
    67 
       
    68 
       
    69 inline void RNewAllocator::Lock() const
       
    70 /**
       
    71 @internalComponent
       
    72 */
       
    73     {((RFastLock&)iLock).Wait();}
       
    74 
       
    75 
       
    76 
       
    77 
       
    78 inline void RNewAllocator::Unlock() const
       
    79 /**
       
    80 @internalComponent
       
    81 */
       
    82     {((RFastLock&)iLock).Signal();}
       
    83 
       
    84 
       
    85 inline TInt RNewAllocator::ChunkHandle() const
       
    86 /**
       
    87 @internalComponent
       
    88 */
       
    89     {
       
    90     return iChunkHandle;
       
    91     }
       
    92 
       
    93 
       
    94 #endif // NEWALLOCATOR_INL