voipplugins/dhcppositionprovider/src/dhcppsysingletonhandler.cpp
branchRCL_3
changeset 21 f742655b05bf
parent 20 65a3ef1d5bd0
child 22 d38647835c2e
equal deleted inserted replaced
20:65a3ef1d5bd0 21:f742655b05bf
     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:  Implement the singleton handler for dhcppositionprovider.
       
    15 *
       
    16 */
       
    17 
       
    18 #include "dhcppsylogging.h"
       
    19 #include "dhcppsyrequester.h"
       
    20 #include "dhcppsysingletonhandler.h"
       
    21 
       
    22 // ---------------------------------------------------------------------------
       
    23 // CDhcpPsySingletonHandler::GetInstanceL
       
    24 // ---------------------------------------------------------------------------
       
    25 //
       
    26 CDhcpPsySingletonHandler* CDhcpPsySingletonHandler::GetInstanceL ()
       
    27     {
       
    28     TRACESTRING( "CDhcpPsySingletonHandler:: GetInstanceL" )
       
    29     CDhcpPsySingletonHandler* self =
       
    30         reinterpret_cast < CDhcpPsySingletonHandler*>( Dll::Tls() );
       
    31 
       
    32     if ( !self )
       
    33         {
       
    34         self = new( ELeave ) CDhcpPsySingletonHandler;
       
    35         CleanupStack::PushL( self );
       
    36         self->ConstructL ();
       
    37         CleanupStack::Pop( self );
       
    38         Dll::SetTls( self );
       
    39         }
       
    40 
       
    41     self->iRefCount++;
       
    42     return self;
       
    43     }
       
    44 
       
    45 // ---------------------------------------------------------------------------
       
    46 // Destructor
       
    47 // ---------------------------------------------------------------------------
       
    48 //
       
    49 CDhcpPsySingletonHandler::~CDhcpPsySingletonHandler ()
       
    50     {
       
    51     TRACESTRING( "CDhcpPsySingletonHandler:: ~CDhcpPsySingletonHandler" )
       
    52     delete iPsyRequester;
       
    53     iPsyRequester = NULL;
       
    54     }
       
    55 
       
    56 // -----------------------------------------------------------------------------
       
    57 // CDhcpPsySingletonHandler::ConstructL
       
    58 // -----------------------------------------------------------------------------
       
    59 //
       
    60 void CDhcpPsySingletonHandler::ConstructL ()
       
    61     {
       
    62     TRACESTRING( "CDhcpPsySingletonHandler::ConstructL" )
       
    63     iPsyRequester = CDhcpPsyRequester::NewL();
       
    64     }
       
    65 
       
    66 // -----------------------------------------------------------------------------
       
    67 // CDhcpPsySingletonHandler::ReleaseInstance
       
    68 // -----------------------------------------------------------------------------
       
    69 //
       
    70 void CDhcpPsySingletonHandler::ReleaseInstance()
       
    71     {
       
    72     TRACESTRING( "CDhcpPsySingletonHandler::ReleaseInstance" )
       
    73     iRefCount--;
       
    74     if ( iRefCount == 0 )
       
    75         {
       
    76         delete this;
       
    77         Dll::SetTls( NULL );
       
    78         }
       
    79     }
       
    80 
       
    81 // -----------------------------------------------------------------------------
       
    82 // CDhcpPsySingletonHandler::Requester
       
    83 // -----------------------------------------------------------------------------
       
    84 //
       
    85 CDhcpPsyRequester* CDhcpPsySingletonHandler::Requester ()
       
    86     {
       
    87     TRACESTRING( "CDhcpPsySingletonHandler::Requester" )
       
    88     return iPsyRequester;
       
    89     }