servicediscoveryandcontrol/pnp/test/upnp/chunkmgr/src/rmemcell.cpp
author hgs
Fri, 03 Sep 2010 09:13:04 +0300
changeset 31 b51a6f4f15ba
parent 0 f5a58ecadc66
permissions -rw-r--r--
201035

// Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
// All rights reserved.
// This component and the accompanying materials are made available
// under the terms of "Eclipse Public License v1.0"
// which accompanies this distribution, and is available
// at the URL "http://www.eclipse.org/legal/epl-v10.html".
//
// Initial Contributors:
// Nokia Corporation - initial contribution.
//
// Contributors:
//
// Description:
// @file
// @internalComponent
// 
//

#include <e32base.h>
#include "cchunkmanager.h"
#include "cmemchunk.h"
#include "rchunkpool.h"
#include "rmemcell.h"

RMemCell::RMemCell ( RChunkPool* aChunkPool, TUint8* aBuffer, TInt aBlockSize )
	: iBuffer ( aBuffer ),
	  iChunkPool ( aChunkPool ),
	  iMaxSize ( aBlockSize ),
	  iOffset ( 0 ),
	  iLength ( aBlockSize ),
	  iNextCell ( NULL )
	{
	}

TAny* RMemCell::operator new ( TUint , RMemCell* aPtr )
	{
	return aPtr;
	}
	
void RMemCell::operator delete ( TAny* , RMemCell* )
	{
	}

void RMemCell::Free ()
	{
	iChunkPool->ChunkManager().Free ( this );
	}
	
RChunkPool* RMemCell::Pool ()
	{
	return iChunkPool;
	}

EXPORT_C RMemCell* RMemCell::Last()
{
	RMemCell* c = iNextCell;
	RMemCell* p = this;

	while (c != NULL)
		{
		p = c;
		c = c->Next();
		}
	return p;
	}