loggingservices/eventlogger/LogServ/src/LogServOperationBase.cpp
author Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
Thu, 02 Sep 2010 22:18:45 +0300
changeset 46 826b40dcb0a8
parent 0 08ec8eefde2f
child 45 cc28652e0254
permissions -rw-r--r--
Revision: 201035 Kit: 201035

// Copyright (c) 2002-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:
//

#include "LogServOperationBase.h"
#include "logservpanic.h"
#include "LogServOperationManager.h"


CLogServOperationBase::CLogServOperationBase(MLogServTaskInterface& aTaskInterface, 
											 MLogServOperationManager& aOperationManager, 
											 const RMessage2& aMessage, 
											 CLogPackage& aPackage,
					                         const TLogClientServerData& aClientServerData,
					                         TLogServSessionId aSessionId) :
	iTaskInterface(aTaskInterface), 
	iOperationManager(aOperationManager), 
	iPackage(aPackage), 
	iMessage(aMessage),
	iClientServerData(aClientServerData),
	iSessionId(aSessionId),
	iMessageCompletion(ETrue)
	{
	// Queue this operations
	OperationManager().OMOperationQueueAdd(*this);
	}

CLogServOperationBase::~CLogServOperationBase()
	{
	// Dequeue this operations
	OperationManager().OMOperationQueueRemove(*this);
	}

//
//	By default operations don't write back to the client
//
void CLogServOperationBase::WriteL(const RMessage2& /*aMessage*/)
	{
	}

//
//	Finish processing for this operation
//
CLogServOperationBase::TCompletionStatus CLogServOperationBase::CompleteProcessingL(TInt /*aFinalCompletionCode*/)
	{
	Complete(KErrNone);
	//
	return CLogServOperationBase::EOperationComplete;
	}

//
//	Complete the client request
//
void CLogServOperationBase::Complete(TInt aCompletionCode)
	{
	__ASSERT_ALWAYS(! iMessage.IsNull(), Panic(ELogNoOutstandingAsyncRequest));
	
	if (iMessageCompletion)
	  {
	  iMessage.Complete(aCompletionCode);
	  }

	// Unnecessary?
	iMessage = RMessage2();
	}

//
//	Return the offset of this item within a containing queue
//
TUint CLogServOperationBase::QueueOffset()
	{
	return _FOFF(CLogServOperationBase, iServerLink);
	}