hgcacheproxymodel/inc/hgbuffermanager.h
author Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
Mon, 03 May 2010 13:32:54 +0300
changeset 1 e48454f237ca
child 3 c863538fcbb6
permissions -rw-r--r--
Revision: 201015 Kit: 201018

/*
* Copyright (c) 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:
*
*  Version     : %version: 1 %
*/
#ifndef HGBUFFERMANAGER_H_
#define HGBUFFERMANAGER_H_

class HgBufferManagerObserver;

class HgBufferManager
{
public:    
    
    HgBufferManager(
                    HgBufferManagerObserver* aObserver,
                    int aBufferSize,
                    int aBufferTreshold,
                    int aInitialPosition,
                    int aTotalCount );
	~HgBufferManager();

	void setPosition( int aIndex );
	void resetBuffer( int aPosition, int aTotalCount);
	void itemCountChanged( int aIndex, bool aRemoved, int aNewTotalCount );
	void resizeCache(int newSize, int newTreshold);
	
private:
	void calculate();

private:
	HgBufferManagerObserver* mObserver; 
    
	int mBufferSize;
	int mBufferTreshold;
	int mBufferPosition;
	int mDiff;
	int mTotalCount;

	bool mResetOrdered;

	int mRequestStart;
	int mRequestCount;
	int mReleaseStart;
	int mReleaseCount;
};

#endif // HGBUFFERMANAGER_H_