sl@0: /*
sl@0: * Copyright (c) 2001-2009 Nokia Corporation and/or its subsidiary(-ies).
sl@0: * All rights reserved.
sl@0: * This component and the accompanying materials are made available
sl@0: * under the terms of the License "Eclipse Public License v1.0"
sl@0: * which accompanies this distribution, and is available
sl@0: * at the URL "http://www.eclipse.org/legal/epl-v10.html".
sl@0: *
sl@0: * Initial Contributors:
sl@0: * Nokia Corporation - initial contribution.
sl@0: *
sl@0: * Contributors:
sl@0: *
sl@0: * Description: 
sl@0: *
sl@0: */
sl@0: 
sl@0: 
sl@0: #include "ct.h"
sl@0: #include "ct/logger.h"
sl@0: 
sl@0: EXPORT_C MCTTokenObject::MCTTokenObject(MCTToken& aToken)
sl@0: 	{
sl@0: 	LOG(_L("MCTTokenObject::MCTTokenObject: token object created")); // can't call Label at this point
sl@0: 	LOG_INC_INDENT();
sl@0: 	
sl@0: 	aToken.ObjectCreated();
sl@0: 	
sl@0: 	LOG_DEC_INDENT();
sl@0: 	}
sl@0: 
sl@0: EXPORT_C void MCTTokenObject::Release()
sl@0: 	{
sl@0: 	LOG1(_L("MCTTokenObject::Release: token object released: %-32S"), &Label());
sl@0: 	LOG_INC_INDENT();
sl@0: 
sl@0: 	// Take a copy of the token as we need to release it last
sl@0: 	MCTToken& token = Token();
sl@0: 	// Release the object
sl@0: 	DoRelease();
sl@0: 	// this MAY NOT EXIST ANY MORE!!
sl@0: 	// Release the token.
sl@0: 	token.Release();
sl@0: 
sl@0: 	LOG_DEC_INDENT();	
sl@0: 	}
sl@0: 
sl@0: EXPORT_C void MCTTokenObject::DoRelease()
sl@0: 	{
sl@0: 	LOG1(_L("MCTTokenObject::DoRelease: destroying token object: %-32S"), &Label());
sl@0: 	LOG_INC_INDENT();
sl@0: 
sl@0: 	delete this;
sl@0: 
sl@0: 	LOG_DEC_INDENT();
sl@0: 	}
sl@0: 
sl@0: EXPORT_C void MCTTokenObject::AddTokenRef()
sl@0: 	{
sl@0: 	++(Token().ReferenceCount());
sl@0: 	}