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