mmuifw_plat/alf_widgetmodel_api/inc/alf/alfeventoutputsignalsubscriber.h
branchRCL_3
changeset 26 0e9bb658ef58
parent 0 e83bab7cf002
equal deleted inserted replaced
25:4ea6f81c838a 26:0e9bb658ef58
       
     1 /*
       
     2 * Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies). 
       
     3 * All rights reserved.
       
     4 * This component and the accompanying materials are made available
       
     5 * under the terms of "Eclipse Public License v1.0"
       
     6 * which accompanies this distribution, and is available
       
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     8 *
       
     9 * Initial Contributors:
       
    10 * Nokia Corporation - initial contribution.
       
    11 *
       
    12 * Contributors:
       
    13 *
       
    14 * Description:   Event output signal subscriber interface
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 #ifndef ALFEVENTOUTPUTSIGNALSUBSCRIBER_H
       
    20 #define ALFEVENTOUTPUTSIGNALSUBSCRIBER_H
       
    21 
       
    22 #include <osn/osndefines.h>
       
    23 //using namespace osncore;
       
    24 
       
    25 namespace Alf
       
    26     {
       
    27 
       
    28 /**
       
    29  *  Event output signal subscriber interface. 
       
    30  */
       
    31 class IAlfEventOutputSignalSubscriber
       
    32 	{
       
    33 public:
       
    34     /**
       
    35     * Called by event output signal. This method calls subscriber's callback method.
       
    36     */
       
    37 	virtual void receiveSignal() = 0;
       
    38 	virtual ~IAlfEventOutputSignalSubscriber() {}
       
    39 	};
       
    40 
       
    41 /**
       
    42  *  Event output signal subscriber. 
       
    43  */	
       
    44 template <class T>
       
    45 OSN_NONSHARABLE_CLASS( AlfEventOutputSignalSubscriber )
       
    46 	: public IAlfEventOutputSignalSubscriber
       
    47 	{
       
    48 public:
       
    49 	explicit AlfEventOutputSignalSubscriber(T& aSubscriber, void (T::*aFnc)(void))
       
    50 		:mSubscriber(aSubscriber), mFnc(aFnc) {}
       
    51 
       
    52 	void receiveSignal() {(mSubscriber.*mFnc)();}
       
    53 
       
    54 private: // data
       
    55 	// Subscriber
       
    56 	T& mSubscriber;
       
    57 	// Callback
       
    58 	void (T::*mFnc)(void);
       
    59 	};
       
    60 
       
    61     } // namespace Alf
       
    62 
       
    63 #endif // ALFEVENTOUTPUTSIGNALSUBSCRIBER_H