buildverification/smoketest/Timew/Src/SM_MOD.CPP
branchRCL_3
changeset 20 493058e57c8c
parent 0 9736f095102e
equal deleted inserted replaced
19:4ca382093dae 20:493058e57c8c
       
     1 // Copyright (c) 1997-2009 Nokia Corporation and/or its subsidiary(-ies).
       
     2 // All rights reserved.
       
     3 // This component and the accompanying materials are made available
       
     4 // under the terms of "Eclipse Public License v1.0"
       
     5 // which accompanies this distribution, and is available
       
     6 // at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     7 //
       
     8 // Initial Contributors:
       
     9 // Nokia Corporation - initial contribution.
       
    10 //
       
    11 // Contributors:
       
    12 //
       
    13 // Description:
       
    14 //
       
    15 
       
    16 #include "sm_std.h"
       
    17 
       
    18 CModelBase::CModelBase()
       
    19 //
       
    20 //	Protected constructor
       
    21 //
       
    22 	{
       
    23 	}
       
    24 
       
    25 CModelBase::~CModelBase()
       
    26 //
       
    27 //	destructor
       
    28 //
       
    29 	{
       
    30 	delete(iResponder);
       
    31 	}
       
    32 
       
    33 void CModelBase::Notify(TInt aNotification)
       
    34 //
       
    35 //	Funnel for all calls to the notifier
       
    36 //
       
    37 	{
       
    38 	if (!iDoingViewNotify && iObserver)
       
    39 		DoObserverNotify(aNotification);
       
    40 	}
       
    41 
       
    42 void CModelBase::DoObserverNotify(TInt aNotification)
       
    43 //
       
    44 //	Single function that actually calls the view notifier
       
    45 //
       
    46 	{
       
    47 	__ASSERT_DEBUG(iObserver,Fault(EModelfNoNotifier));
       
    48 	iDoingViewNotify=ETrue;
       
    49 	iObserver->HandleUpdate(aNotification);
       
    50 	iDoingViewNotify=EFalse;
       
    51 	}
       
    52 
       
    53 void CModelBase::SetResponderActive(CModelResponder* aResponder)
       
    54 //
       
    55 //	Set the engines responder
       
    56 //
       
    57 	{
       
    58 	iResponder=aResponder;
       
    59 	if (iResponder)
       
    60 		CActiveScheduler::Add(iResponder);
       
    61 	}
       
    62 
       
    63 void CModelBase::Start()
       
    64 //
       
    65 //	Start the responder
       
    66 //	The engine requires that an active scheduler be installed
       
    67 //
       
    68 	{
       
    69 	iResponder->Start();
       
    70 	}
       
    71 
       
    72 void CModelBase::Stop()
       
    73 //
       
    74 //	Stop the responder and the engine
       
    75 //
       
    76 	{
       
    77 	if (iResponder)
       
    78 		iResponder->Cancel();
       
    79 	}
       
    80 
       
    81 void CModelBase::SetTimewModelObserver(MTimewModelObserver *aObserver)
       
    82 //
       
    83 //	Register the observer of the engine
       
    84 //
       
    85 	{
       
    86 	iObserver=aObserver;
       
    87 	}