codhandler/codeng/src/Timeout.cpp
author Kiiskinen Klaus (Nokia-D-MSW/Tampere) <klaus.kiiskinen@nokia.com>
Fri, 08 May 2009 08:25:06 +0300
changeset 8 7c90e6132015
parent 0 dd21522fd290
permissions -rw-r--r--
Revision: 200915 Kit: 200918

/*
* Copyright (c) 2004 Nokia Corporation and/or its subsidiary(-ies).
* All rights reserved.
* This component and the accompanying materials are made available
* under the terms of the License "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: 
*      Implementation of class CTimeout.   
*      
*
*/


// INCLUDE FILES

#include "Timeout.h"
#include "CodLogger.h"
#include "CodPanic.h"

// ================= MEMBER FUNCTIONS =======================

// ---------------------------------------------------------
// CTimeout::NewL()
// ---------------------------------------------------------
//
CTimeout* CTimeout::NewL( TInt aPriority, TCallBack aCallBack )
    {
    CTimeout* timeout = new (ELeave) CTimeout( aPriority, aCallBack );
    CleanupStack::PushL( timeout );
    timeout->ConstructL();
    CleanupStack::Pop( timeout );
    return timeout;
    }

// ---------------------------------------------------------
// CTimeout::~CTimeout()
// ---------------------------------------------------------
//
CTimeout::~CTimeout()
    {
    CLOG(( ECodEng, 2, _L("CTimeout::~CTimeout") ));
    Cancel();
    }

// ---------------------------------------------------------
// CTimeout::RunL()
// ---------------------------------------------------------
//
void CTimeout::RunL()
    {
    CLOG(( ECodEng, 2, _L("CTimeout::RunL iStatus(%d)"), iStatus.Int() ));
#ifdef _DEBUG
    TBool again =
#endif /* def _DEBUG */
    iCallBack.CallBack();
    // Assert that this is a "once-only" callback.
    __ASSERT_DEBUG( !again, CodPanic( ECodInternal ) );
    }

// ---------------------------------------------------------
// CTimeout::CTimeout()
// ---------------------------------------------------------
//
CTimeout::CTimeout( TInt aPriority, TCallBack aCallBack )
: CTimer( aPriority ), iCallBack( aCallBack )
    {
    CLOG(( ECodEng, 2, _L("CTimeout::CTimeout") ));
    CActiveScheduler::Add( this );
    }