commsfwutils/commsbufs/mbufmgrimpl/inc/MBufPool.h
changeset 0 dfb7c4ff071f
equal deleted inserted replaced
-1:000000000000 0:dfb7c4ff071f
       
     1 // Copyright (c) 1997-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 "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 //
       
    15 
       
    16 #if !defined(__MBufPool_h__)
       
    17 #define __MBufPool_h__
       
    18 
       
    19 //
       
    20 // MBUF POOLS
       
    21 //
       
    22 
       
    23 class CMBufMemoryAllocator;
       
    24 class CMBufManager;
       
    25 class CMBufPoolChain;
       
    26 
       
    27 NONSHARABLE_CLASS(CMBufPool) : public CBase
       
    28 /**
       
    29 @internalTechnology
       
    30 */
       
    31 	{
       
    32 private:
       
    33 	CMBufPool(TInt aMBufSize, TInt aNumMBufs, CMBufMemoryAllocator& aMemoryAllocator);
       
    34 public:
       
    35 	~CMBufPool();
       
    36 	static CMBufPool* New(TInt aMBufSize, TInt aNumMBufs, CMBufPoolChain& aMBufPoolChain, CMBufMemoryAllocator& aMemoryAllocator);
       
    37 
       
    38 	void Merge(RMBufQ& aMainPool);
       
    39     inline TInt Count() const {return iNumMBufs;}
       
    40     inline TInt MBufSize() const {return iMBufSize;}
       
    41     
       
    42     TAny *operator new(TUint aSize, TInt aExtra, CMBufMemoryAllocator& aMemoryAllocator) __NO_THROW;
       
    43     
       
    44 	void operator delete(TAny* aPtr) __NO_THROW;
       
    45 	void operator delete(TAny* aPtr, TInt aExtra, CMBufMemoryAllocator& aMemoryAllocator) __NO_THROW;
       
    46 	RMBufQ& MBufQ() {return iList;}
       
    47 //
       
    48 private:
       
    49 	friend class CMBufPoolChain;  // for access to iLink
       
    50 	
       
    51 	TDblQueLink iLink;
       
    52 	RMBufQ iList;		    // List of mbufs in this pool
       
    53 	TUint8* iPool;		    // Allocated memory
       
    54 	const TInt iNumMBufs;   // Number of mbufs in this pool
       
    55     const TInt iMBufSize;   // size of the mbufs held within this pool
       
    56 //
       
    57 	CMBufMemoryAllocator& iMemoryAllocator;
       
    58     
       
    59 public:
       
    60 	TInt __DbgCheckBuffer(RMBuf* aBuf);
       
    61 	};
       
    62 
       
    63 #endif