diff -r ba22309243a1 -r f8c3d4e6102c radioengine/utils/api/cradiorepositoryentity.inl --- a/radioengine/utils/api/cradiorepositoryentity.inl Thu Jul 08 12:44:18 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,143 +0,0 @@ -/* -* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: -* -*/ - -// System includes -#include - -// ----------------------------------------------------------------------------- -// -// ----------------------------------------------------------------------------- -// -template -EXPORT_C CRadioRepositoryEntity* CRadioRepositoryEntity::NewL( const TUid& aUid, - TUint32 aKey, - MRadioRepositoryEntityObserver& aObserver, - CActive::TPriority aPriority ) - { - LEVEL3( LOG_METHOD_AUTO ); - CRadioRepositoryEntity* self = new ( ELeave ) CRadioRepositoryEntity( aUid, aKey, aObserver, aPriority ); - CleanupStack::PushL( self ); - self->ConstructL(); - CleanupStack::Pop( self ); - return self; - } - -// ----------------------------------------------------------------------------- -// -// ----------------------------------------------------------------------------- -// -template -CRadioRepositoryEntity::CRadioRepositoryEntity( const TUid& aUid, - TUint32 aKey, - MRadioRepositoryEntityObserver& aObserver, - CActive::TPriority aPriority ) - : CRadioRepositoryEntityBase( aUid, aKey, aObserver, aPriority ) - { - LEVEL3( LOG_METHOD_AUTO ); - } - -// ----------------------------------------------------------------------------- -// -// ----------------------------------------------------------------------------- -// -template -void CRadioRepositoryEntity::ConstructL() - { - LEVEL3( LOG_METHOD_AUTO ); - iRepository = CRepository::NewL( iUid ); - - CActiveScheduler::Add( this ); - iRepository->Get( iKey, iValue ); - User::LeaveIfError( iRepository->NotifyRequest( iKey, iStatus ) ); - SetActive(); - } - -// ----------------------------------------------------------------------------- -// -// ----------------------------------------------------------------------------- -// -template -EXPORT_C CRadioRepositoryEntity::~CRadioRepositoryEntity() - { - LEVEL3( LOG_METHOD_AUTO ); - Cancel(); - delete iRepository; - } - -// ----------------------------------------------------------------------------- -// Sets the value of the key. -// ----------------------------------------------------------------------------- -// -template -TInt CRadioRepositoryEntity::SetValue( const T& aValue, TBool aSavingEnabled ) - { - LEVEL3( LOG_METHOD_AUTO ); - iValue = aValue; - if ( aSavingEnabled ) - { - return iRepository->Set( iKey, aValue ); - } - return KErrNone; - } - -// ----------------------------------------------------------------------------- -// Returns the cached copy of the key's value. -// ----------------------------------------------------------------------------- -// -template -const T& CRadioRepositoryEntity::Value() const - { - LEVEL3( LOG_METHOD_AUTO ); - return iValue; - } - -// ----------------------------------------------------------------------------- -// Forcibly updates the cached value from the repository. -// ----------------------------------------------------------------------------- -// -template -void CRadioRepositoryEntity::UpdateL() - { - LEVEL3( LOG_METHOD_AUTO ); - User::LeaveIfError( iRepository->Get( iKey, iValue ) ); - } - -// ----------------------------------------------------------------------------- -// Executed when the key's value is changed. -// ----------------------------------------------------------------------------- -// -template -void CRadioRepositoryEntity::RunL() - { - LEVEL3( LOG_METHOD_AUTO ); - User::LeaveIfError( iRepository->NotifyRequest( iKey, iStatus ) ); - SetActive(); - - TInt err = iRepository->Get( iKey, iValue ); - iObserver.HandleRepositoryValueChangeL( iUid, iKey, iValue, err ); - } - -// ----------------------------------------------------------------------------- -// Cancels all pending notifications. -// ----------------------------------------------------------------------------- -// -template -void CRadioRepositoryEntity::DoCancel() - { - LEVEL3( LOG_METHOD_AUTO ); - iRepository->NotifyCancel( iKey ); - }