wvuing/wvcommandutils/Src/CCACommandManagerFactory.cpp
branchRCL_3
changeset 13 a941bc465d9f
parent 0 094583676ce7
equal deleted inserted replaced
12:6ca72c0fe49a 13:a941bc465d9f
       
     1 /*
       
     2 * Copyright (c) 2006 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:  Command Manager Factory
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 
       
    20 // INCLUDE FILES
       
    21 #include    "CCACommandManagerFactory.h"
       
    22 #include    "CCACommandManager.h"
       
    23 #include    "CCASessionHandlerCmd.h"
       
    24 #include    "MCAProcessManager.h"
       
    25 #include    "CCAEngine.h"
       
    26 
       
    27 
       
    28 
       
    29 // ============================= LOCAL FUNCTIONS ===============================
       
    30 
       
    31 // -----------------------------------------------------------------------------
       
    32 // ConstructSingletonInstanceL
       
    33 // Factory function for creating a singleton instance of commandmanager factory.
       
    34 // Returns: A void pointer to the created instance.
       
    35 // -----------------------------------------------------------------------------
       
    36 //
       
    37 TAny* ConstructSingletonInstanceL()
       
    38     {
       
    39     return CCACommandManagerFactory::NewL();
       
    40     }
       
    41 
       
    42 // ============================ MEMBER FUNCTIONS ===============================
       
    43 
       
    44 // -----------------------------------------------------------------------------
       
    45 // CCACommandManagerFactory::InstanceL
       
    46 // -----------------------------------------------------------------------------
       
    47 //
       
    48 EXPORT_C CCACommandManagerFactory* CCACommandManagerFactory::InstanceL()
       
    49     {
       
    50     return ( CCACommandManagerFactory* ) BaseInstanceL();
       
    51     }
       
    52 
       
    53 
       
    54 
       
    55 // -----------------------------------------------------------------------------
       
    56 // CCACommandManagerFactory::ReleaseResources
       
    57 // -----------------------------------------------------------------------------
       
    58 //
       
    59 EXPORT_C void CCACommandManagerFactory::ReleaseResources()
       
    60     {
       
    61     CCACommandManagerFactory* instance =
       
    62         reinterpret_cast<CCACommandManagerFactory*>( Dll::Tls() );
       
    63 
       
    64     if ( instance )
       
    65         {
       
    66         delete instance;
       
    67         }
       
    68     }
       
    69 
       
    70 
       
    71 // -----------------------------------------------------------------------------
       
    72 // CCACommandManagerFactory::InitializeSessionHandlerL
       
    73 // -----------------------------------------------------------------------------
       
    74 //
       
    75 
       
    76 EXPORT_C void CCACommandManagerFactory::InitializeSessionHandlerL(
       
    77     MCAProcessManager& aProcessManager,
       
    78     MCAUiLoginCmdCB& aUiLoginCmdCB )
       
    79     {
       
    80     iSessionHandlerCmd = CCASessionHandlerCmd::NewL(
       
    81                              aProcessManager,
       
    82                              aUiLoginCmdCB );
       
    83     iCommandManager->Initialize( iSessionHandlerCmd );
       
    84     }
       
    85 
       
    86 // -----------------------------------------------------------------------------
       
    87 // CCACommandManagerFactory::CCACommandManagerFactory
       
    88 // -----------------------------------------------------------------------------
       
    89 //
       
    90 inline CCACommandManagerFactory::CCACommandManagerFactory()
       
    91 
       
    92     {
       
    93 
       
    94     }
       
    95 
       
    96 // -----------------------------------------------------------------------------
       
    97 // CCACommandManagerFactory::ConstructL
       
    98 // -----------------------------------------------------------------------------
       
    99 //
       
   100 inline void CCACommandManagerFactory::ConstructL()
       
   101     {
       
   102     // These are needed in start up
       
   103 
       
   104     iCommandManager = CCACommandManager::NewL();
       
   105 
       
   106     }
       
   107 
       
   108 // -----------------------------------------------------------------------------
       
   109 // CCACommandManagerFactory::NewL
       
   110 // Two-phased constructor.
       
   111 // -----------------------------------------------------------------------------
       
   112 //
       
   113 
       
   114 CCACommandManagerFactory* CCACommandManagerFactory::NewL()
       
   115     {
       
   116     CCACommandManagerFactory* self =
       
   117         new( ELeave ) CCACommandManagerFactory();
       
   118 
       
   119     CleanupStack::PushL( self );
       
   120     self->ConstructL();
       
   121     CleanupStack::Pop();
       
   122 
       
   123     return self;
       
   124     }
       
   125 
       
   126 
       
   127 // -----------------------------------------------------------------------------
       
   128 // CCACommandManagerFactory::~CCACommandManagerFactory
       
   129 // Destructor
       
   130 // -----------------------------------------------------------------------------
       
   131 //
       
   132 
       
   133 CCACommandManagerFactory::~CCACommandManagerFactory()
       
   134     {
       
   135     delete iCommandManager;
       
   136     delete iSessionHandlerCmd;
       
   137     }
       
   138 
       
   139 
       
   140 // -----------------------------------------------------------------------------
       
   141 // CCACommandManagerFactory::GetCommandManager
       
   142 // -----------------------------------------------------------------------------
       
   143 //
       
   144 
       
   145 EXPORT_C CCACommandManager* CCACommandManagerFactory::GetCommandManager()
       
   146     {
       
   147     return iCommandManager;
       
   148     }
       
   149 
       
   150 //    End of File
       
   151