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: Background thread abstraction |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 #ifndef MFILEMANAGERTHREADFUNCTION_H |
|
20 #define MFILEMANAGERTHREADFUNCTION_H |
|
21 |
|
22 |
|
23 // INCLUDES |
|
24 #include <e32base.h> |
|
25 |
|
26 |
|
27 // CLASS DECLARATION |
|
28 /** |
|
29 * Defines an interface for background thread abstraction. |
|
30 * |
|
31 * @since 3.1 |
|
32 */ |
|
33 class MFileManagerThreadFunction |
|
34 { |
|
35 public: // Background thread space executed callbacks |
|
36 |
|
37 /** |
|
38 * Inits background thread owned handles and data. |
|
39 * Executed always on background thread start. |
|
40 * @since 3.1 |
|
41 */ |
|
42 virtual void InitThreadL() {} |
|
43 |
|
44 /** |
|
45 * Releases background thread owned handles and data. |
|
46 * Executed always on background thread exit. |
|
47 * @since 3.1 |
|
48 */ |
|
49 virtual void ReleaseThread() {} |
|
50 |
|
51 /** |
|
52 * Runs background thread. |
|
53 * @since 3.1 |
|
54 */ |
|
55 virtual void ThreadStepL() = 0; |
|
56 |
|
57 /** |
|
58 * Checks is background thread done. |
|
59 * @since 3.1 |
|
60 * @return ETrue if thread is done and should be finished, |
|
61 * EFalse if ThreadStepL should be executed. |
|
62 */ |
|
63 virtual TBool IsThreadDone() = 0; |
|
64 |
|
65 |
|
66 public: // Client thread space executed callbacks |
|
67 enum TNotifyType // Notify type flags |
|
68 { |
|
69 ENotifyNone = 0x0, |
|
70 ENotifyError = 0x1, |
|
71 ENotifyFinished = 0x2, // Notifies thread's death |
|
72 ENotifyStepFinished = 0x4 // Notifies step completion |
|
73 }; |
|
74 /** |
|
75 * Notifies client about background thread events. |
|
76 * Background thread is stopped during notification and |
|
77 * it is safe to modify shared data to handle errors etc. |
|
78 * @since 3.1 |
|
79 * @param aType notification type |
|
80 * @param aValue notification value |
|
81 */ |
|
82 virtual void NotifyThreadClientL( |
|
83 TNotifyType aType, TInt aValue ) = 0; |
|
84 |
|
85 }; |
|
86 |
|
87 #endif // MFILEMANAGERTHREADFUNCTION_H |
|
88 |
|
89 // End of File |
|