1 /* |
|
2 * Copyright (c) 2007-2008 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: Active Object header for providing data asynchronously |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 #ifndef __MULASYNCDATAPROVIDER_H__ |
|
20 #define __MULASYNCDATAPROVIDER_H__ |
|
21 |
|
22 #include <e32base.h> // For CActive |
|
23 #include <mul/imulmodelprovider.h> |
|
24 #include <mul/muldatapath.h> |
|
25 #include <vector> |
|
26 |
|
27 #include "muldatawindow.h" |
|
28 #include "mulpagedatawindow.h" |
|
29 |
|
30 using namespace std; |
|
31 //Forward declarations |
|
32 |
|
33 |
|
34 namespace Alf |
|
35 { |
|
36 //Forward declarations |
|
37 |
|
38 class MulAsyncData |
|
39 { |
|
40 public: |
|
41 bool operator == (const MulAsyncData& aData ) |
|
42 { |
|
43 return ( this->mStartIndex == aData.mStartIndex && this->mRange == aData.mRange ); |
|
44 } |
|
45 public: |
|
46 int mStartIndex; |
|
47 int mRange; |
|
48 MulDataPath mPath; |
|
49 }; |
|
50 |
|
51 class MulAsyncDataProvider : public CActive |
|
52 { |
|
53 |
|
54 public : // Constructor and Destructor |
|
55 |
|
56 /// need to have two-phase construction |
|
57 /// - otherwise mixing leaves and throws |
|
58 MulAsyncDataProvider( IMulModelProvider& aDataProvider, const MulPageDataWindow& aDataWindow ); |
|
59 |
|
60 ~MulAsyncDataProvider(); |
|
61 |
|
62 void ProvideData( int aStartIndex, int aRange, const MulDataPath& aPath, const bool aIsSync = false ); |
|
63 |
|
64 private: |
|
65 |
|
66 /** |
|
67 * Active call back funtion . |
|
68 */ |
|
69 void RunL(); |
|
70 |
|
71 void DoCancel(); |
|
72 |
|
73 void ActivateAndComplete(); |
|
74 |
|
75 int GetFirstIndexForWhichDataIsPresent(int aStartIndex, int aEndIndex); |
|
76 |
|
77 private: //data |
|
78 |
|
79 IMulModelProvider& mDataProvider; |
|
80 vector<MulAsyncData> mDataQueue; |
|
81 const MulPageDataWindow& mDataWindow; |
|
82 }; //end of class. |
|
83 |
|
84 } // End of namespace . |
|
85 |
|
86 #endif //__MULASYNCDATAPROVIDER_H__ |
|
87 |
|
88 // End of file |
|