|
1 /* |
|
2 * Copyright (c) 2006-2007 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: Processor object for running harvester requests |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 #ifndef HARVESTERREQUESTQUEUE_H |
|
20 #define HARVESTERREQUESTQUEUE_H |
|
21 |
|
22 #include <e32base.h> |
|
23 |
|
24 class CHarvesterRequestActive; |
|
25 |
|
26 /** |
|
27 * Processor object for running queued tasks. |
|
28 * |
|
29 * @since S60 v5.0 |
|
30 */ |
|
31 class CHarvesterRequestQueue: public CActive |
|
32 { |
|
33 public: |
|
34 |
|
35 /** |
|
36 * Two-phased constructor. |
|
37 * |
|
38 * @since S60 v5.0 |
|
39 * @return Instance of CHarvesterRequestQueue. |
|
40 */ |
|
41 static CHarvesterRequestQueue* NewL(); |
|
42 |
|
43 /** |
|
44 * Destructor |
|
45 * |
|
46 * @since S60 v5.0 |
|
47 */ |
|
48 virtual ~CHarvesterRequestQueue(); |
|
49 |
|
50 /** |
|
51 * Activates next request if possible. |
|
52 * |
|
53 * @since S60 v5.0 |
|
54 */ |
|
55 void Process(); |
|
56 |
|
57 /** |
|
58 * Adds new request to the queue. |
|
59 * |
|
60 * @since S60 v5.0 |
|
61 * @param aRequest Request to be added to the queue. |
|
62 */ |
|
63 void AddRequestL( CHarvesterRequestActive* aRequest ); |
|
64 |
|
65 /** |
|
66 * Marks request completed. |
|
67 * |
|
68 * @since S60 v5.0 |
|
69 */ |
|
70 void RequestComplete(); |
|
71 |
|
72 /** |
|
73 * Force requests |
|
74 * |
|
75 * @since S60 v5.0 |
|
76 */ |
|
77 void ForceRequests(); |
|
78 |
|
79 protected: |
|
80 // from base class CActive |
|
81 |
|
82 /** |
|
83 * Handles an active object's request completion event. |
|
84 * |
|
85 * @since S60 v5.0 |
|
86 */ |
|
87 void RunL(); |
|
88 |
|
89 /** |
|
90 * Implements cancellation of an outstanding request. |
|
91 * |
|
92 * @since S60 v5.0 |
|
93 */ |
|
94 void DoCancel(); |
|
95 |
|
96 /** |
|
97 * Handles a leave occurring in the request completion event handler |
|
98 * RunL(). |
|
99 * |
|
100 * @since S60 v5.0 |
|
101 * @return Error code. |
|
102 */ |
|
103 TInt RunError( TInt aError ); |
|
104 |
|
105 private: |
|
106 |
|
107 /** |
|
108 * C++ default constructor |
|
109 * |
|
110 * @since S60 v5.0 |
|
111 * @return Instance of CHarvesterRequestQueue. |
|
112 */ |
|
113 CHarvesterRequestQueue(); |
|
114 |
|
115 /** |
|
116 * Symbian 2nd phase constructor can leave. |
|
117 * |
|
118 * @since S60 v5.0 |
|
119 */ |
|
120 void ConstructL(); |
|
121 |
|
122 private: |
|
123 |
|
124 /** |
|
125 * Array of active objects for each pending harvester request. |
|
126 */ |
|
127 RPointerArray <CHarvesterRequestActive> iRequests; |
|
128 |
|
129 // number of currently active requests |
|
130 TInt iActiveRequests; |
|
131 |
|
132 TBool iShutdown; |
|
133 |
|
134 }; |
|
135 |
|
136 #endif // HARVESTERREQUESTQUEUE_H |