|
1 /* |
|
2 * Copyright (c) 2002-2004 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: This file contains the header file of the CSWInstRequestStore |
|
15 * class. |
|
16 * |
|
17 * This class stores all outstanding requests and makes sure that |
|
18 * no more than allowed number of simultaneous requests may be |
|
19 * issued. |
|
20 * |
|
21 * Currently only 1 outstanding request is supported. |
|
22 * |
|
23 */ |
|
24 |
|
25 |
|
26 #ifndef SWINSTREQUESTSTORE_H |
|
27 #define SWINSTREQUESTSTORE_H |
|
28 |
|
29 // INCLUDES |
|
30 #include <e32base.h> |
|
31 |
|
32 namespace SwiUI |
|
33 { |
|
34 class CSWInstRequestObject; |
|
35 |
|
36 const TUint KMaxRequestCount = 1; |
|
37 |
|
38 // CLASS DECLARATION |
|
39 |
|
40 /** |
|
41 * This class stores all outstanding requests. Currently only 1 simultaneous |
|
42 * request is supported. |
|
43 * |
|
44 * @since 3.0 |
|
45 */ |
|
46 class CSWInstRequestStore : public CBase |
|
47 { |
|
48 public: // Constructors and destructor |
|
49 |
|
50 /** |
|
51 * Two-phased constructor. |
|
52 */ |
|
53 static CSWInstRequestStore* NewL(); |
|
54 |
|
55 /** |
|
56 * Destructor. |
|
57 */ |
|
58 virtual ~CSWInstRequestStore(); |
|
59 |
|
60 public: // New functions |
|
61 |
|
62 /** |
|
63 * Returns the request object based on the given id. |
|
64 * @since 3.0 |
|
65 * @return Request object. NULL if not found. Client must not delete the object. |
|
66 */ |
|
67 CSWInstRequestObject* GetRequest( TInt aRequestId ); |
|
68 |
|
69 /** |
|
70 * Returns the current total request count. |
|
71 * @since 3.0 |
|
72 * @return Request count. |
|
73 */ |
|
74 TInt RequestCount(); |
|
75 |
|
76 /** |
|
77 * Returns the current outstanding request count. |
|
78 * @since 3.0 |
|
79 * @return Request count. |
|
80 */ |
|
81 TInt PendingRequestCount(); |
|
82 |
|
83 /** |
|
84 * Adds the given request to the store. Leaves with KSWInstErrBusy if |
|
85 * the maximum number of outstanding requests is exceeded. |
|
86 * @since 3.0 |
|
87 * @param aRequest - The request object. |
|
88 */ |
|
89 void AddRequestL( CSWInstRequestObject* aRequest ); |
|
90 |
|
91 /** |
|
92 * Destroy a request and remove it from the store. |
|
93 * @since 3.0 |
|
94 * @param aIpc - Request id of the object. |
|
95 * @return KErrNone, if no error, KErrNotFound if the object is not in the store. |
|
96 */ |
|
97 TInt DestroyRequest( TInt aRequestId ); |
|
98 |
|
99 /** |
|
100 * Destroys all completed requests. |
|
101 * @since 3.0 |
|
102 */ |
|
103 void Flush(); |
|
104 |
|
105 /** |
|
106 * Cancels all requests. Asynchronous. |
|
107 * @since 3.0 |
|
108 */ |
|
109 void CancelAllRequests(); |
|
110 |
|
111 private: |
|
112 |
|
113 /** |
|
114 * C++ default constructor. |
|
115 */ |
|
116 CSWInstRequestStore(); |
|
117 |
|
118 /** |
|
119 * 2nd phase constructor. |
|
120 */ |
|
121 void ConstructL(); |
|
122 |
|
123 private: // Data |
|
124 |
|
125 RPointerArray<CSWInstRequestObject> iRequests; |
|
126 }; |
|
127 } |
|
128 |
|
129 #endif // SWINSTREQUESTSTORE_H |
|
130 |
|
131 // End of File |