devicediagnosticsfw/diagframework/inc/diagcleanupresetanddestroy.inl
branchRCL_3
changeset 61 b183ec05bd8c
parent 59 13d7c31c74e0
child 62 19bba8228ff0
equal deleted inserted replaced
59:13d7c31c74e0 61:b183ec05bd8c
     1 /*
       
     2 * Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). 
       
     3 * All rights reserved.
       
     4 * This component and the accompanying materials are made available
       
     5 * under the terms of "Eclipse Public License v1.0"
       
     6 * which accompanies this distribution, and is available
       
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     8 *
       
     9 * Initial Contributors:
       
    10 * Nokia Corporation - initial contribution.
       
    11 *
       
    12 * Contributors:
       
    13 *
       
    14 * Description:  Function Definition of CleanupResetAndDestroy
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 // CLASS DECLARATION
       
    20 
       
    21 // SYSTEM INCLUDE FILES
       
    22 #include <e32base.h>                // CleanupStack
       
    23 
       
    24 // USER INCLUDE FILES
       
    25 
       
    26 namespace DiagFwInternal
       
    27     {
       
    28 
       
    29     template< class T >
       
    30     inline void CleanupResetAndDestroy( TAny* aObj )
       
    31         {
       
    32         if ( aObj )
       
    33             {
       
    34             static_cast< T* >( aObj )->ResetAndDestroy();
       
    35             }
       
    36         }
       
    37 
       
    38     template< class T >
       
    39     inline void CleanupRPointerArrayPushL( RPointerArray< T >* aObj )
       
    40         {
       
    41         if ( aObj )
       
    42             {
       
    43             CleanupStack::PushL( TCleanupItem(
       
    44                 CleanupResetAndDestroy< RPointerArray< T > >,
       
    45                 aObj ) );
       
    46             }
       
    47         }
       
    48     }
       
    49 
       
    50 // End of File
       
    51