servicediscoveryandcontrol/pnp/test/upnp/chunkmgr/src/rmemcell.cpp
changeset 0 f5a58ecadc66
equal deleted inserted replaced
-1:000000000000 0:f5a58ecadc66
       
     1 // Copyright (c) 2008-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 // @file
       
    15 // @internalComponent
       
    16 // 
       
    17 //
       
    18 
       
    19 #include <e32base.h>
       
    20 #include "cchunkmanager.h"
       
    21 #include "cmemchunk.h"
       
    22 #include "rchunkpool.h"
       
    23 #include "rmemcell.h"
       
    24 
       
    25 RMemCell::RMemCell ( RChunkPool* aChunkPool, TUint8* aBuffer, TInt aBlockSize )
       
    26 	: iBuffer ( aBuffer ),
       
    27 	  iChunkPool ( aChunkPool ),
       
    28 	  iMaxSize ( aBlockSize ),
       
    29 	  iOffset ( 0 ),
       
    30 	  iLength ( aBlockSize ),
       
    31 	  iNextCell ( NULL )
       
    32 	{
       
    33 	}
       
    34 
       
    35 TAny* RMemCell::operator new ( TUint , RMemCell* aPtr )
       
    36 	{
       
    37 	return aPtr;
       
    38 	}
       
    39 	
       
    40 void RMemCell::operator delete ( TAny* , RMemCell* )
       
    41 	{
       
    42 	}
       
    43 
       
    44 void RMemCell::Free ()
       
    45 	{
       
    46 	iChunkPool->ChunkManager().Free ( this );
       
    47 	}
       
    48 	
       
    49 RChunkPool* RMemCell::Pool ()
       
    50 	{
       
    51 	return iChunkPool;
       
    52 	}
       
    53 
       
    54 EXPORT_C RMemCell* RMemCell::Last()
       
    55 {
       
    56 	RMemCell* c = iNextCell;
       
    57 	RMemCell* p = this;
       
    58 
       
    59 	while (c != NULL)
       
    60 		{
       
    61 		p = c;
       
    62 		c = c->Next();
       
    63 		}
       
    64 	return p;
       
    65 	}
       
    66