|
1 // Copyright (c) 2002-2009 Nokia Corporation and/or its subsidiary(-ies). |
|
2 // All rights reserved. |
|
3 // This component and the accompanying materials are made available |
|
4 // under the terms of "Eclipse Public License v1.0" |
|
5 // which accompanies this distribution, and is available |
|
6 // at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
7 // |
|
8 // Initial Contributors: |
|
9 // Nokia Corporation - initial contribution. |
|
10 // |
|
11 // Contributors: |
|
12 // |
|
13 // Description: |
|
14 // |
|
15 |
|
16 #ifndef __LOGSERVCACHECONFIG_H__ |
|
17 #define __LOGSERVCACHECONFIG_H__ |
|
18 |
|
19 #include <logcli.h> |
|
20 |
|
21 // Classes referenced |
|
22 class MLogServDatabaseTransactionInterface; |
|
23 |
|
24 /** |
|
25 Caches a copy of the LogEng configuration data (a TLogConfig instance). |
|
26 Provides public methods for retrieving/updating the configuration data. |
|
27 if the configuration data is updated in a transaction, the changes will be committed/rolled back |
|
28 when the transaction is committed/rolled back. |
|
29 |
|
30 Note: the LogEng configuration is kept in a database table with name "Config". |
|
31 |
|
32 @see TLogConfig |
|
33 @see MLogServDatabaseTransactionInterface |
|
34 @internalComponent |
|
35 */ |
|
36 class CLogServCacheConfig : public CBase |
|
37 { |
|
38 public: |
|
39 static CLogServCacheConfig* NewL(MLogServDatabaseTransactionInterface& aDatabase); |
|
40 ~CLogServCacheConfig(); |
|
41 const TLogConfig& Config() const; |
|
42 void UpdateL(const TLogConfig& aConfig); |
|
43 #ifdef _DEBUG |
|
44 inline TBool InTransaction() const; |
|
45 #endif |
|
46 void Commit(); |
|
47 inline void Rollback(); |
|
48 |
|
49 private: |
|
50 CLogServCacheConfig(MLogServDatabaseTransactionInterface& aDatabase); |
|
51 void ConstructL(); |
|
52 void ReadL(); |
|
53 |
|
54 private: |
|
55 MLogServDatabaseTransactionInterface& iDatabase; |
|
56 TLogConfig iConfig;//The last good configuration value. Essentially, the current configuration |
|
57 TLogConfig iRequestedConfiguration;//The requested configuration |
|
58 TBool iInTransaction;//Indicates whether the configuration cache is currently within an update transaction |
|
59 |
|
60 }; |
|
61 |
|
62 #ifdef _DEBUG |
|
63 /** |
|
64 Indicates whether a configuration transaction has begun |
|
65 */ |
|
66 inline TBool CLogServCacheConfig::InTransaction() const |
|
67 { |
|
68 return iInTransaction; |
|
69 } |
|
70 #endif//_DEBUG |
|
71 |
|
72 /** |
|
73 Roll back a configuration transaction |
|
74 */ |
|
75 inline void CLogServCacheConfig::Rollback() |
|
76 { |
|
77 // Nothing really to do here other than discard the transaction status |
|
78 // (ready to start over again). |
|
79 iInTransaction = EFalse; |
|
80 } |
|
81 |
|
82 #endif |