sl@0: // Copyright (c) 1995-2009 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 the License "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: // e32test\buffer\t_tbma.h sl@0: // sl@0: // sl@0: sl@0: #ifndef __T_TBMA_H__ sl@0: #define __T_TBMA_H__ sl@0: sl@0: #include sl@0: #include sl@0: sl@0: #define TBMA_FAULT() TBmaFault(__LINE__) sl@0: #define __ALLOC(x) User::Alloc(x) sl@0: sl@0: extern void TBmaFault(TInt aLine); sl@0: sl@0: extern RTest test; sl@0: sl@0: // Copied from klib.h sl@0: class TBitMapAllocator sl@0: { sl@0: public: sl@0: IMPORT_C static TBitMapAllocator* New(TInt aSize, TBool aState); sl@0: IMPORT_C TBitMapAllocator(TInt aSize, TBool aState); sl@0: inline TInt Avail() const {return iAvail;} sl@0: IMPORT_C TInt Alloc(); sl@0: IMPORT_C void Free(TInt aPos); sl@0: IMPORT_C void Alloc(TInt aStart, TInt aLength); sl@0: IMPORT_C void Free(TInt aStart, TInt aLength); sl@0: IMPORT_C void SelectiveFree(TInt aStart, TInt aLength); sl@0: IMPORT_C TBool NotFree(TInt aStart, TInt aLength) const; sl@0: IMPORT_C TBool NotAllocated(TInt aStart, TInt aLength) const; sl@0: IMPORT_C TInt AllocList(TInt aLength, TInt* aList); sl@0: IMPORT_C TInt AllocConsecutive(TInt aLength, TBool aBestFit) const; sl@0: IMPORT_C TInt AllocAligned(TInt aLength, TInt aAlign, TInt aBase, TBool aBestFit) const; sl@0: IMPORT_C TInt AllocAligned(TInt aLength, TInt aAlign, TInt aBase, TBool aBestFit, TInt& aCarry, TInt& aRunLength) const; sl@0: IMPORT_C TInt AllocAligned(TInt aLength, TInt aAlign, TInt aBase, TBool aBestFit, TInt& aCarry, TInt& aRunLength, TUint aOffset) const; sl@0: IMPORT_C void CopyAlignedRange(const TBitMapAllocator* aA, TInt aFirst, TInt aLen); sl@0: public: sl@0: TInt iAvail; /**< @internalComponent */ sl@0: TUint32* iCheckFirst; /**< @internalComponent */ sl@0: TInt iSize; /**< @internalComponent */ sl@0: TUint32 iMap[1]; /**< @internalComponent */ // extend sl@0: }; sl@0: sl@0: class TBmaList sl@0: { sl@0: public: sl@0: static TBmaList* New(TInt aNumBmas); sl@0: static TBmaList* New(const TBitMapAllocator& aBma, TInt aNumSplits, VA_LIST aList); sl@0: TBmaList(); sl@0: ~TBmaList(); sl@0: TInt AllocConsecutiveFF(TInt aLength); sl@0: TInt AllocConsecutiveBF(TInt aLength); sl@0: TInt AllocAlignedFF(TInt aLength, TInt aAlign); sl@0: TInt AllocAlignedBF(TInt aLength, TInt aAlign); sl@0: public: sl@0: TInt iNumBmas; sl@0: TBitMapAllocator** iBmaList; sl@0: TInt* iBaseList; sl@0: }; sl@0: sl@0: struct SRange sl@0: { sl@0: TInt iBase; sl@0: TInt iLength; sl@0: }; sl@0: sl@0: #endif