commsfwsupport/commselements/nodemessages/src/nm_common.cpp
changeset 0 dfb7c4ff071f
equal deleted inserted replaced
-1:000000000000 0:dfb7c4ff071f
       
     1 // Copyright (c) 2007-2009 Nokia Corporation and/or its subsidiary(-ies).
       
     2 // All rights reserved.
       
     3 // This component and the accompanying materials are made available
       
     4 // under the terms of "Eclipse Public License v1.0"
       
     5 // which accompanies this distribution, and is available
       
     6 // at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     7 //
       
     8 // Initial Contributors:
       
     9 // Nokia Corporation - initial contribution.
       
    10 //
       
    11 // Contributors:
       
    12 //
       
    13 // Description:
       
    14 //
       
    15 
       
    16 /**
       
    17  @file
       
    18 */
       
    19 
       
    20 #include <elements/nm_common.h>
       
    21 #include <elements/nm_messages_base.h>
       
    22 #include <elements/nm_log.h>
       
    23 
       
    24 
       
    25 #ifdef _DEBUG
       
    26 // Panic category for "absolutely impossible!" vanilla ASSERT()-type panics from this module
       
    27 // (if it could happen through user error then you should give it an explicit, documented, category + code)
       
    28 _LIT(KSpecAssert_ElemNodeMessCmnC, "ElemNodeMessCmnC");
       
    29 #endif
       
    30 
       
    31 using namespace Messages;
       
    32 
       
    33 EXPORT_C CGlobals& TlsGlobals::InstallGlobalsL()
       
    34 	{
       
    35 	CGlobals* gl = new (ELeave) CGlobals;
       
    36 	CleanupStack::PushL(gl);
       
    37 	gl->ConstructL();
       
    38 	CleanupStack::Pop(gl);
       
    39 	__ASSERT_DEBUG(Dll::Tls()==NULL, User::Panic(KSpecAssert_ElemNodeMessCmnC, 1));
       
    40 	Dll::SetTls(gl);
       
    41 	return *gl;
       
    42 	}
       
    43 
       
    44 EXPORT_C void TlsGlobals::UnInstallGlobals()
       
    45 	{
       
    46 	CGlobals* gl = reinterpret_cast<CGlobals*>(Dll::Tls());
       
    47 	Dll::SetTls(NULL);
       
    48 	__ASSERT_DEBUG(gl!=NULL, User::Panic(KSpecAssert_ElemNodeMessCmnC, 2));
       
    49 	delete gl;
       
    50 	}
       
    51 
       
    52 EXPORT_C CGlobals& TlsGlobals::Get()
       
    53 	{
       
    54 	CGlobals* gl = reinterpret_cast<CGlobals*>(Dll::Tls());
       
    55 	__ASSERT_DEBUG(gl!=NULL, User::Panic(KSpecAssert_ElemNodeMessCmnC, 3));
       
    56 	return *gl;
       
    57 	}
       
    58 
       
    59 
       
    60 
       
    61 EXPORT_C CGlobals::CGlobals()
       
    62   : CGlobalsInternal()
       
    63 	{
       
    64 	}
       
    65 
       
    66 EXPORT_C CGlobals::~CGlobals()
       
    67 	{
       
    68 	TEBase::DeRegister(*this);
       
    69 	}
       
    70 
       
    71 EXPORT_C void CGlobals::ConstructL()
       
    72 	{
       
    73 	CGlobalsInternal::ConstructL();
       
    74 	TEBase::RegisterL(*this);
       
    75 	}
       
    76 
       
    77 
       
    78 
       
    79 EXPORT_C CGlobalsInternal::CGlobalsInternal()
       
    80 	{
       
    81 	}
       
    82 
       
    83 EXPORT_C CGlobalsInternal::~CGlobalsInternal()
       
    84 	{
       
    85 	delete iVirtCtor;
       
    86 	}
       
    87 
       
    88 EXPORT_C void CGlobalsInternal::ConstructL()
       
    89 	{
       
    90 	iVirtCtor = new (ELeave) Meta::CMetaDataVirtualCtorInPlace;
       
    91 	}
       
    92 
       
    93 EXPORT_C void CGlobalsInternal::AddPersistentItf(const TNodeId& aNodeId)
       
    94 	{
       
    95 	(void) aNodeId;
       
    96 	NM_LOG((KNodeMessagesSubTag, _L8("CSockManData::AddPersistentItf(%08x) [#%d]"), aNodeId.Ptr(), iPersistentItfCount));
       
    97 	++iPersistentItfCount;
       
    98 	}
       
    99