equal
deleted
inserted
replaced
|
1 /* |
|
2 * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). |
|
3 * All rights reserved. |
|
4 * This component and the accompanying materials are made available |
|
5 * under the terms of "Eclipse Public License v1.0" |
|
6 * which accompanies this distribution, and is available |
|
7 * at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
8 * |
|
9 * Initial Contributors: |
|
10 * Nokia Corporation - initial contribution. |
|
11 * |
|
12 * Contributors: |
|
13 * |
|
14 * Description: |
|
15 * |
|
16 */ |
|
17 |
|
18 #ifndef BUFFERMANAGER_H_ |
|
19 #define BUFFERMANAGER_H_ |
|
20 |
|
21 class AbstractDataProvider |
|
22 { |
|
23 public: |
|
24 |
|
25 enum requestsOrder { |
|
26 ascending, |
|
27 descending |
|
28 }; |
|
29 |
|
30 virtual void release(int start, int end) = 0; |
|
31 virtual void request(int start, int end, requestsOrder order) = 0; |
|
32 }; |
|
33 |
|
34 |
|
35 class BufferManager |
|
36 { |
|
37 public: |
|
38 |
|
39 BufferManager( |
|
40 AbstractDataProvider* aObserver, |
|
41 int aBufferSize, |
|
42 int aBufferTreshold, |
|
43 int aInitialPosition, |
|
44 int aTotalCount ); |
|
45 |
|
46 ~BufferManager(); |
|
47 |
|
48 void setPosition( int aIndex ); |
|
49 |
|
50 void resetBuffer( int aPosition, int aTotalCount); |
|
51 |
|
52 void itemCountChanged( int aIndex, bool aRemoved, int aNewTotalCount ); |
|
53 void resizeCache(int newSize, int newTreshold); |
|
54 |
|
55 private: |
|
56 void calculate(); |
|
57 |
|
58 private: |
|
59 AbstractDataProvider* mObserver; |
|
60 |
|
61 int mBufferSize; |
|
62 int mBufferTreshold; |
|
63 int mBufferPosition; |
|
64 int mDiff; |
|
65 int mTotalCount; |
|
66 |
|
67 bool mResetOrdered; |
|
68 |
|
69 int mRequestStart; |
|
70 int mRequestCount; |
|
71 int mReleaseStart; |
|
72 int mReleaseCount; |
|
73 }; |
|
74 |
|
75 |
|
76 |
|
77 #endif /*BUFFERMANAGER_H_*/ |