Update contrib.
1 // Copyright (c) 1995-2009 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 the License "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".
8 // Initial Contributors:
9 // Nokia Corporation - initial contribution.
14 // e32test\buffer\t_tbma.h
22 #include <e32atomics.h>
24 #define TBMA_FAULT() TBmaFault(__LINE__)
25 #define __ALLOC(x) User::Alloc(x)
27 extern void TBmaFault(TInt aLine);
32 class TBitMapAllocator
35 IMPORT_C static TBitMapAllocator* New(TInt aSize, TBool aState);
36 IMPORT_C TBitMapAllocator(TInt aSize, TBool aState);
37 inline TInt Avail() const {return iAvail;}
38 IMPORT_C TInt Alloc();
39 IMPORT_C void Free(TInt aPos);
40 IMPORT_C void Alloc(TInt aStart, TInt aLength);
41 IMPORT_C void Free(TInt aStart, TInt aLength);
42 IMPORT_C void SelectiveFree(TInt aStart, TInt aLength);
43 IMPORT_C TBool NotFree(TInt aStart, TInt aLength) const;
44 IMPORT_C TBool NotAllocated(TInt aStart, TInt aLength) const;
45 IMPORT_C TInt AllocList(TInt aLength, TInt* aList);
46 IMPORT_C TInt AllocConsecutive(TInt aLength, TBool aBestFit) const;
47 IMPORT_C TInt AllocAligned(TInt aLength, TInt aAlign, TInt aBase, TBool aBestFit) const;
48 IMPORT_C TInt AllocAligned(TInt aLength, TInt aAlign, TInt aBase, TBool aBestFit, TInt& aCarry, TInt& aRunLength) const;
49 IMPORT_C TInt AllocAligned(TInt aLength, TInt aAlign, TInt aBase, TBool aBestFit, TInt& aCarry, TInt& aRunLength, TUint aOffset) const;
50 IMPORT_C void CopyAlignedRange(const TBitMapAllocator* aA, TInt aFirst, TInt aLen);
52 TInt iAvail; /**< @internalComponent */
53 TUint32* iCheckFirst; /**< @internalComponent */
54 TInt iSize; /**< @internalComponent */
55 TUint32 iMap[1]; /**< @internalComponent */ // extend
61 static TBmaList* New(TInt aNumBmas);
62 static TBmaList* New(const TBitMapAllocator& aBma, TInt aNumSplits, VA_LIST aList);
65 TInt AllocConsecutiveFF(TInt aLength);
66 TInt AllocConsecutiveBF(TInt aLength);
67 TInt AllocAlignedFF(TInt aLength, TInt aAlign);
68 TInt AllocAlignedBF(TInt aLength, TInt aAlign);
71 TBitMapAllocator** iBmaList;