diff -r 000000000000 -r dfb7c4ff071f commsfwsupport/commselements/nodemessages/src/nm_common.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/commsfwsupport/commselements/nodemessages/src/nm_common.cpp Thu Dec 17 09:22:25 2009 +0200 @@ -0,0 +1,99 @@ +// Copyright (c) 2007-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of "Eclipse Public License v1.0" +// which accompanies this distribution, and is available +// at the URL "http://www.eclipse.org/legal/epl-v10.html". +// +// Initial Contributors: +// Nokia Corporation - initial contribution. +// +// Contributors: +// +// Description: +// + +/** + @file +*/ + +#include +#include +#include + + +#ifdef _DEBUG +// Panic category for "absolutely impossible!" vanilla ASSERT()-type panics from this module +// (if it could happen through user error then you should give it an explicit, documented, category + code) +_LIT(KSpecAssert_ElemNodeMessCmnC, "ElemNodeMessCmnC"); +#endif + +using namespace Messages; + +EXPORT_C CGlobals& TlsGlobals::InstallGlobalsL() + { + CGlobals* gl = new (ELeave) CGlobals; + CleanupStack::PushL(gl); + gl->ConstructL(); + CleanupStack::Pop(gl); + __ASSERT_DEBUG(Dll::Tls()==NULL, User::Panic(KSpecAssert_ElemNodeMessCmnC, 1)); + Dll::SetTls(gl); + return *gl; + } + +EXPORT_C void TlsGlobals::UnInstallGlobals() + { + CGlobals* gl = reinterpret_cast(Dll::Tls()); + Dll::SetTls(NULL); + __ASSERT_DEBUG(gl!=NULL, User::Panic(KSpecAssert_ElemNodeMessCmnC, 2)); + delete gl; + } + +EXPORT_C CGlobals& TlsGlobals::Get() + { + CGlobals* gl = reinterpret_cast(Dll::Tls()); + __ASSERT_DEBUG(gl!=NULL, User::Panic(KSpecAssert_ElemNodeMessCmnC, 3)); + return *gl; + } + + + +EXPORT_C CGlobals::CGlobals() + : CGlobalsInternal() + { + } + +EXPORT_C CGlobals::~CGlobals() + { + TEBase::DeRegister(*this); + } + +EXPORT_C void CGlobals::ConstructL() + { + CGlobalsInternal::ConstructL(); + TEBase::RegisterL(*this); + } + + + +EXPORT_C CGlobalsInternal::CGlobalsInternal() + { + } + +EXPORT_C CGlobalsInternal::~CGlobalsInternal() + { + delete iVirtCtor; + } + +EXPORT_C void CGlobalsInternal::ConstructL() + { + iVirtCtor = new (ELeave) Meta::CMetaDataVirtualCtorInPlace; + } + +EXPORT_C void CGlobalsInternal::AddPersistentItf(const TNodeId& aNodeId) + { + (void) aNodeId; + NM_LOG((KNodeMessagesSubTag, _L8("CSockManData::AddPersistentItf(%08x) [#%d]"), aNodeId.Ptr(), iPersistentItfCount)); + ++iPersistentItfCount; + } +