idlefw/tsrc/wsplugin/ut_aiwspluginanim/src/ut_aiwspluginanimtls.cpp
branchRCL_3
changeset 28 053c6c7c14f3
equal deleted inserted replaced
27:2c7f27287390 28:053c6c7c14f3
       
     1 /*
       
     2 * Copyright (c) 2009 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:
       
    15 *
       
    16 */
       
    17 
       
    18 // System includes
       
    19 
       
    20 // User includes
       
    21 #include "ut_aiwspluginanimtls.h"
       
    22 
       
    23 // Constants
       
    24 
       
    25 // ======== LOCAL FUNCTIONS ========
       
    26     
       
    27 // ======== MEMBER FUNCTIONS =======
       
    28 // ----------------------------------------------------------------------------
       
    29 // UT_AiWsPluginAnimTls::CreateL()
       
    30 //
       
    31 // ----------------------------------------------------------------------------
       
    32 //
       
    33 void UT_AiWsPluginAnimTls::CreateL()
       
    34     {
       
    35     if ( !Instance() )
       
    36         {
       
    37         UT_AiWsPluginAnimTls* self = new( ELeave ) UT_AiWsPluginAnimTls;
       
    38         CleanupStack::PushL( self );
       
    39         User::LeaveIfError( Dll::SetTls( self ) );
       
    40         CleanupStack::Pop( self );
       
    41         }
       
    42     }
       
    43   
       
    44 // ----------------------------------------------------------------------------
       
    45 // UT_AiWsPluginAnimTls::Instance()
       
    46 //
       
    47 // ----------------------------------------------------------------------------
       
    48 //   
       
    49 UT_AiWsPluginAnimTls* UT_AiWsPluginAnimTls::Instance()
       
    50     {
       
    51     return static_cast<UT_AiWsPluginAnimTls*>( Dll::Tls() );
       
    52     }
       
    53     
       
    54 // ----------------------------------------------------------------------------
       
    55 // UT_AiWsPluginAnimTls::Destroy()
       
    56 //
       
    57 // ----------------------------------------------------------------------------
       
    58 //    
       
    59 void UT_AiWsPluginAnimTls::Destroy()
       
    60     {
       
    61     delete Instance();
       
    62     Dll::SetTls( NULL );
       
    63     }
       
    64 
       
    65 // ----------------------------------------------------------------------------
       
    66 // UT_AiWsPluginAnimTls::UT_AiWsPluginAnimTls()
       
    67 //
       
    68 // ----------------------------------------------------------------------------
       
    69 //
       
    70 UT_AiWsPluginAnimTls::UT_AiWsPluginAnimTls() 
       
    71     {
       
    72     }
       
    73 
       
    74 // ----------------------------------------------------------------------------
       
    75 // UT_AiWsPluginAnimTls::~UT_AiWsPluginAnimTls
       
    76 //
       
    77 // ----------------------------------------------------------------------------
       
    78 //    
       
    79 UT_AiWsPluginAnimTls::~UT_AiWsPluginAnimTls() 
       
    80     {
       
    81     iEventHandlers.Close();
       
    82     iFeatures.Close();
       
    83     }
       
    84     
       
    85 // ----------------------------------------------------------------------------
       
    86 // UT_AiWsPluginAnimTls::AddEventHandlerL()
       
    87 //
       
    88 // ----------------------------------------------------------------------------
       
    89 //
       
    90 void UT_AiWsPluginAnimTls::AddEventHandlerL( 
       
    91     T_AiWsPlugin::CTestEventHandler& aHandler )
       
    92     {
       
    93     iEventHandlers.AppendL( &aHandler );
       
    94     }
       
    95     
       
    96 // ----------------------------------------------------------------------------
       
    97 // UT_AiWsPluginAnimTls::EventHandlers()
       
    98 //
       
    99 // ----------------------------------------------------------------------------
       
   100 //
       
   101 TArray<T_AiWsPlugin::CTestEventHandler*> UT_AiWsPluginAnimTls::EventHandlers() const
       
   102     {
       
   103     return iEventHandlers.Array();
       
   104     }
       
   105 
       
   106 // ----------------------------------------------------------------------------
       
   107 // UT_AiWsPluginAnimTls::IncFeatMgrCount()
       
   108 //
       
   109 // ----------------------------------------------------------------------------
       
   110 //
       
   111 void UT_AiWsPluginAnimTls::IncFeatMgrCount()
       
   112     {
       
   113     ++iFeatMgrCount;
       
   114     }
       
   115     
       
   116 // ----------------------------------------------------------------------------
       
   117 // UT_AiWsPluginAnimTls::DecFeatMgrCount()
       
   118 //
       
   119 // ----------------------------------------------------------------------------
       
   120 //    
       
   121 void UT_AiWsPluginAnimTls::DecFeatMgrCount()
       
   122     {
       
   123     --iFeatMgrCount;
       
   124     }
       
   125 
       
   126 // ----------------------------------------------------------------------------
       
   127 // UT_AiWsPluginAnimTls::FeatMgrCount()
       
   128 //
       
   129 // ----------------------------------------------------------------------------
       
   130 //    
       
   131 TInt UT_AiWsPluginAnimTls::FeatMgrCount() const
       
   132     {
       
   133     return iFeatMgrCount;
       
   134     }
       
   135 
       
   136 // ----------------------------------------------------------------------------
       
   137 // UT_AiWsPluginAnimTls::FeatureSupported()
       
   138 //
       
   139 // ----------------------------------------------------------------------------
       
   140 //    
       
   141 TBool UT_AiWsPluginAnimTls::FeatureSupported( TInt aFeatureId ) const
       
   142     {
       
   143     const TBool* value = iFeatures.Find( aFeatureId );
       
   144     
       
   145     return (value ? *value : EFalse);
       
   146     }
       
   147  
       
   148 // ----------------------------------------------------------------------------
       
   149 // UT_AiWsPluginAnimTls::SetFeatureSupportedL()
       
   150 //
       
   151 // ----------------------------------------------------------------------------
       
   152 //    
       
   153 void UT_AiWsPluginAnimTls::SetFeatureSupportedL( TInt aFeatureId, 
       
   154     TBool aValue )
       
   155     {
       
   156     iFeatures.InsertL( aFeatureId, aValue );
       
   157     }
       
   158 
       
   159 // End of file