sl@0: // Copyright (c) 2002-2009 Nokia Corporation and/or its subsidiary(-ies). sl@0: // All rights reserved. sl@0: // This component and the accompanying materials are made available sl@0: // under the terms of "Eclipse Public License v1.0" sl@0: // which accompanies this distribution, and is available sl@0: // at the URL "http://www.eclipse.org/legal/epl-v10.html". sl@0: // sl@0: // Initial Contributors: sl@0: // Nokia Corporation - initial contribution. sl@0: // sl@0: // Contributors: sl@0: // sl@0: // Description: sl@0: // sl@0: sl@0: #ifndef __LOGSERVCACHECONFIG_H__ sl@0: #define __LOGSERVCACHECONFIG_H__ sl@0: sl@0: #include sl@0: sl@0: // Classes referenced sl@0: class MLogServDatabaseTransactionInterface; sl@0: sl@0: /** sl@0: Caches a copy of the LogEng configuration data (a TLogConfig instance). sl@0: Provides public methods for retrieving/updating the configuration data. sl@0: if the configuration data is updated in a transaction, the changes will be committed/rolled back sl@0: when the transaction is committed/rolled back. sl@0: sl@0: Note: the LogEng configuration is kept in a database table with name "Config". sl@0: sl@0: @see TLogConfig sl@0: @see MLogServDatabaseTransactionInterface sl@0: @internalComponent sl@0: */ sl@0: class CLogServCacheConfig : public CBase sl@0: { sl@0: public: sl@0: static CLogServCacheConfig* NewL(MLogServDatabaseTransactionInterface& aDatabase); sl@0: ~CLogServCacheConfig(); sl@0: const TLogConfig& Config() const; sl@0: void UpdateL(const TLogConfig& aConfig); sl@0: #ifdef _DEBUG sl@0: inline TBool InTransaction() const; sl@0: #endif sl@0: void Commit(); sl@0: inline void Rollback(); sl@0: sl@0: private: sl@0: CLogServCacheConfig(MLogServDatabaseTransactionInterface& aDatabase); sl@0: void ConstructL(); sl@0: void ReadL(); sl@0: sl@0: private: sl@0: MLogServDatabaseTransactionInterface& iDatabase; sl@0: TLogConfig iConfig;//The last good configuration value. Essentially, the current configuration sl@0: TLogConfig iRequestedConfiguration;//The requested configuration sl@0: TBool iInTransaction;//Indicates whether the configuration cache is currently within an update transaction sl@0: sl@0: }; sl@0: sl@0: #ifdef _DEBUG sl@0: /** sl@0: Indicates whether a configuration transaction has begun sl@0: */ sl@0: inline TBool CLogServCacheConfig::InTransaction() const sl@0: { sl@0: return iInTransaction; sl@0: } sl@0: #endif//_DEBUG sl@0: sl@0: /** sl@0: Roll back a configuration transaction sl@0: */ sl@0: inline void CLogServCacheConfig::Rollback() sl@0: { sl@0: // Nothing really to do here other than discard the transaction status sl@0: // (ready to start over again). sl@0: iInTransaction = EFalse; sl@0: } sl@0: sl@0: #endif