os/security/cryptomgmtlibs/cryptotokenfw/source/ctframework/MCTTokenObject.cpp
author sl@SLION-WIN7.fritz.box
Fri, 15 Jun 2012 03:10:57 +0200
changeset 0 bde4ae8d615e
permissions -rw-r--r--
First public contribution.
     1 /*
     2 * Copyright (c) 2001-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 the License "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 
    19 #include "ct.h"
    20 #include "ct/logger.h"
    21 
    22 EXPORT_C MCTTokenObject::MCTTokenObject(MCTToken& aToken)
    23 	{
    24 	LOG(_L("MCTTokenObject::MCTTokenObject: token object created")); // can't call Label at this point
    25 	LOG_INC_INDENT();
    26 	
    27 	aToken.ObjectCreated();
    28 	
    29 	LOG_DEC_INDENT();
    30 	}
    31 
    32 EXPORT_C void MCTTokenObject::Release()
    33 	{
    34 	LOG1(_L("MCTTokenObject::Release: token object released: %-32S"), &Label());
    35 	LOG_INC_INDENT();
    36 
    37 	// Take a copy of the token as we need to release it last
    38 	MCTToken& token = Token();
    39 	// Release the object
    40 	DoRelease();
    41 	// this MAY NOT EXIST ANY MORE!!
    42 	// Release the token.
    43 	token.Release();
    44 
    45 	LOG_DEC_INDENT();	
    46 	}
    47 
    48 EXPORT_C void MCTTokenObject::DoRelease()
    49 	{
    50 	LOG1(_L("MCTTokenObject::DoRelease: destroying token object: %-32S"), &Label());
    51 	LOG_INC_INDENT();
    52 
    53 	delete this;
    54 
    55 	LOG_DEC_INDENT();
    56 	}
    57 
    58 EXPORT_C void MCTTokenObject::AddTokenRef()
    59 	{
    60 	++(Token().ReferenceCount());
    61 	}