commsfwutils/commsbufs/mbufmgr/src/mb_allocator.cpp
changeset 0 dfb7c4ff071f
equal deleted inserted replaced
-1:000000000000 0:dfb7c4ff071f
       
     1 // Copyright (c) 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 #include <comms-infras/mbufallocator.h>
       
    17 #include <comms-infras/commsbufpondop.h>
       
    18 #include "commsbufpondintf.h"
       
    19 
       
    20 EXPORT_C RMBufAllocator::RMBufAllocator() 
       
    21 : TCommsBufAllocator(TCommsBufPondTLSOp::Get())
       
    22 	{}
       
    23 
       
    24 EXPORT_C TInt RMBufAllocator::BytesAvailable() const
       
    25 /**
       
    26 Obtains the total available bytes available in the mbuf system in it's entirety.
       
    27 @return the number of available bytes within all of the MBuf pools.
       
    28 */
       
    29     {
       
    30 	return iPond.BytesAvailable ();
       
    31 	}
       
    32 
       
    33 EXPORT_C TInt RMBufAllocator::BytesAvailable(TInt aSize) const
       
    34 /**
       
    35 Obtains the total bytes available in the pool of the given sized MBuf.
       
    36 @param aSize one of the sizes returned by RMBufAllocator::NextMBufSize().
       
    37 @return the number of available bytes within the MBuf pool of MBufs given by the size aSize.
       
    38 */
       
    39     {
       
    40 	return iPond.BytesAvailable (aSize);
       
    41 	}
       
    42 
       
    43 EXPORT_C TInt RMBufAllocator::NextMBufSize(TInt aSize) const
       
    44 /**
       
    45 Returns the first MBuf size that is greater than aSize, returns KErrNotFound if there isn't an MBuf
       
    46 whose size is larger than aSize. Can be used to find the size of each of the MBuf pools by starting
       
    47 at 0 and repeatedly passing in the result of the previous call until KErrNotFound occurs.
       
    48 @param aSize a starting size to search upwards from.
       
    49 @return the size of the first MBuf whose size is greater than aSize.
       
    50 */
       
    51     {
       
    52 	return iPond.NextBufSize (aSize);
       
    53 	}
       
    54 
       
    55 EXPORT_C TInt RMBufAllocator::LargestMBufSize() const
       
    56 /**
       
    57 @return the size of the largest MBuf that is registered with the sytem.
       
    58 */
       
    59     {
       
    60 	return iPond.LargestBufSize ();
       
    61 	} 
       
    62