lbs/internal/lbstestserver/src/csubsessionbase.cpp
branchSymbian2
changeset 1 8758140453c0
child 6 c108117318cb
equal deleted inserted replaced
0:e8c1ea2c6496 1:8758140453c0
       
     1 // Copyright (c) 2006-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 the License "Symbian Foundation License v1.0"
       
     5 // which accompanies this distribution, and is available
       
     6 // at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html".
       
     7 //
       
     8 // Initial Contributors:
       
     9 // Nokia Corporation - initial contribution.
       
    10 //
       
    11 // Contributors:
       
    12 //
       
    13 // Description:
       
    14 //
       
    15 
       
    16 #include "csubsessionbase.h"
       
    17 #include "lbsmessageenums.h"
       
    18 
       
    19 /** 
       
    20 inline function to push the item needed to be released when destroy, via a TCleanupItem object,
       
    21 which includes a MRelease function to release the resource.
       
    22 
       
    23 @param aRef A reference MRelease function
       
    24 @internalTechnology
       
    25 @released
       
    26  */	
       
    27 inline void CleanupVirtualRelease::PushL(MRelease& aRef)
       
    28 	{
       
    29 	CleanupStack::PushL(TCleanupItem(&Release,&aRef));
       
    30 	}
       
    31 		
       
    32 /** 
       
    33 release the resource by calling the defined MRelease function
       
    34 
       
    35 @param aPrt A reference of MRelease function
       
    36 @internalTechnology
       
    37 @released
       
    38  */	
       
    39 void CleanupVirtualRelease::Release(TAny* aPtr)
       
    40 	{
       
    41 	MRelease* ptr = reinterpret_cast<MRelease*>(aPtr);
       
    42 	TReleaseFunc func = &MRelease::VirtualRelease;
       
    43 	(ptr->*func)();
       
    44 	}
       
    45 	
       
    46 	
       
    47 /** 
       
    48 function to push the item needed to be released by calling CleanupVirtualRelease class,
       
    49 which includes a MRelease function to release the resource.
       
    50 
       
    51 @param aRef A reference MRelease function
       
    52 @internalTechnology
       
    53 @released
       
    54  */	
       
    55 void CleanupVirtualReleasePushL(MRelease& aRef)
       
    56 	{
       
    57 	CleanupVirtualRelease::PushL(aRef);
       
    58 	}
       
    59 	
       
    60 /** 
       
    61 Default constructor
       
    62 Nothing here
       
    63 
       
    64 @internalTechnology
       
    65 @released
       
    66  */	
       
    67 CSubSessionBase::CSubSessionBase()
       
    68 	{
       
    69 	// does nothing
       
    70 	}
       
    71 	
       
    72 /** 
       
    73 Default destructor
       
    74 Nothing here
       
    75 
       
    76 @internalTechnology
       
    77 @released
       
    78  */	
       
    79 CSubSessionBase::~CSubSessionBase()
       
    80 	{
       
    81 	// nuke the impl object
       
    82 	if(iImpl)
       
    83 		{
       
    84 		iImpl->VirtualRelease();
       
    85 		iImpl=NULL;
       
    86 		}
       
    87 	}
       
    88 
       
    89 /** 
       
    90 Set the generic subsession implement pointer
       
    91 
       
    92 @param aImpl A generic interface pointer to MSubSessionImpl
       
    93 @see MSubSessionImpl
       
    94 @internalTechnology
       
    95 @released
       
    96  */	
       
    97 void CSubSessionBase::SetImpl(MSubSessionImpl* aImpl)
       
    98 	{
       
    99 	iImpl = aImpl;
       
   100 	}
       
   101 	
       
   102 /** 
       
   103 Get the generic subsession implement pointer
       
   104 
       
   105 @return the generic interface pointer to MSubSessionImpl
       
   106 @see MSubSessionImpl
       
   107 @internalTechnology
       
   108 @released
       
   109  */	
       
   110 MSubSessionImpl* CSubSessionBase::Impl()
       
   111 	{
       
   112 	return iImpl;
       
   113 	}
       
   114 
       
   115 /** 
       
   116 Invoke user panic by setting the category as CSubSessionBase
       
   117 
       
   118 @param aPanic A constant panic category TSubSessionBasePanic
       
   119 @internalTechnology
       
   120 @released
       
   121  */	
       
   122 void CSubSessionBase::Panic(const TSubSessionBasePanic aPanic)
       
   123 	{
       
   124 	_LIT(KSubSessionBase, "CSubSessionBase");
       
   125 	User::Panic(KSubSessionBase, aPanic);
       
   126 	}