1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1.2 +++ b/os/security/cryptomgmtlibs/cryptotokenfw/source/ctframework/MCTTokenObject.cpp Fri Jun 15 03:10:57 2012 +0200
1.3 @@ -0,0 +1,61 @@
1.4 +/*
1.5 +* Copyright (c) 2001-2009 Nokia Corporation and/or its subsidiary(-ies).
1.6 +* All rights reserved.
1.7 +* This component and the accompanying materials are made available
1.8 +* under the terms of the License "Eclipse Public License v1.0"
1.9 +* which accompanies this distribution, and is available
1.10 +* at the URL "http://www.eclipse.org/legal/epl-v10.html".
1.11 +*
1.12 +* Initial Contributors:
1.13 +* Nokia Corporation - initial contribution.
1.14 +*
1.15 +* Contributors:
1.16 +*
1.17 +* Description:
1.18 +*
1.19 +*/
1.20 +
1.21 +
1.22 +#include "ct.h"
1.23 +#include "ct/logger.h"
1.24 +
1.25 +EXPORT_C MCTTokenObject::MCTTokenObject(MCTToken& aToken)
1.26 + {
1.27 + LOG(_L("MCTTokenObject::MCTTokenObject: token object created")); // can't call Label at this point
1.28 + LOG_INC_INDENT();
1.29 +
1.30 + aToken.ObjectCreated();
1.31 +
1.32 + LOG_DEC_INDENT();
1.33 + }
1.34 +
1.35 +EXPORT_C void MCTTokenObject::Release()
1.36 + {
1.37 + LOG1(_L("MCTTokenObject::Release: token object released: %-32S"), &Label());
1.38 + LOG_INC_INDENT();
1.39 +
1.40 + // Take a copy of the token as we need to release it last
1.41 + MCTToken& token = Token();
1.42 + // Release the object
1.43 + DoRelease();
1.44 + // this MAY NOT EXIST ANY MORE!!
1.45 + // Release the token.
1.46 + token.Release();
1.47 +
1.48 + LOG_DEC_INDENT();
1.49 + }
1.50 +
1.51 +EXPORT_C void MCTTokenObject::DoRelease()
1.52 + {
1.53 + LOG1(_L("MCTTokenObject::DoRelease: destroying token object: %-32S"), &Label());
1.54 + LOG_INC_INDENT();
1.55 +
1.56 + delete this;
1.57 +
1.58 + LOG_DEC_INDENT();
1.59 + }
1.60 +
1.61 +EXPORT_C void MCTTokenObject::AddTokenRef()
1.62 + {
1.63 + ++(Token().ReferenceCount());
1.64 + }