tactilefeedback/tactileclickplugin/src/tactilefeedbackserver.cpp
changeset 0 d54f32e146dd
equal deleted inserted replaced
-1:000000000000 0:d54f32e146dd
       
     1 /*
       
     2 * Copyright (c) 2007 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:  Implementation of the method for accessing 
       
    15 *                MTactileFeedbackServer -instance
       
    16 * Part of:      Tactile Feedback.
       
    17 *
       
    18 */
       
    19 
       
    20 
       
    21 #include <tactilefeedbacktrace.h>
       
    22 #include "tactileclickplugin.h"
       
    23 
       
    24 #include "tactilefeedbackserver.h"
       
    25 
       
    26 
       
    27 
       
    28 // ======== MEMBER FUNCTIONS ========
       
    29 
       
    30 
       
    31 // ---------------------------------------------------------------------------
       
    32 // Here we really need to do the casting to CTactileClickPlugin, and NOT
       
    33 // to MTactileFeedbackServer. It seems to be that static_cast does not work
       
    34 // in case we try to cast a pointer to some base class, which is not the 
       
    35 // first one in the inheritance list.
       
    36 // ---------------------------------------------------------------------------
       
    37 EXPORT_C MTactileFeedbackServer* MTactileFeedbackServer::Instance()
       
    38     {
       
    39     TRACE("MTactileFeedbackServer::Instance");
       
    40     
       
    41     CTactileClickPlugin* clickPlugin = NULL;
       
    42     
       
    43     TAny* tmpPtr = Dll::Tls();
       
    44     
       
    45     if ( tmpPtr )
       
    46         {
       
    47         clickPlugin = static_cast<CTactileClickPlugin*>( tmpPtr );
       
    48         }
       
    49     
       
    50     return clickPlugin;
       
    51     }
       
    52 
       
    53