devicediagnosticsfw/diagframework/inc/diagcleanupresetanddestroy.h
branchRCL_3
changeset 25 b183ec05bd8c
parent 24 13d7c31c74e0
child 26 19bba8228ff0
equal deleted inserted replaced
24:13d7c31c74e0 25: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:  Provides ResetAndDestroy for RPointerArrays.
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 #ifndef DIAGCLEANUPRESETANDDESTROY_H
       
    20 #define DIAGCLEANUPRESETANDDESTROY_H
       
    21 
       
    22 // SYSTEM INCLUDES
       
    23 #include <e32def.h>                 // TAny
       
    24 
       
    25 // FORWARD DECLARATION
       
    26 template< class T >
       
    27 class RPointerArray;
       
    28 
       
    29 namespace DiagFwInternal
       
    30     {
       
    31 
       
    32     /**
       
    33     * Cleanup function for RPointerArray or any other types with ResetAndDestroy()
       
    34     *   @usage
       
    35     *   RPointerArray< CDiagResultsDatabaseItem > myArray;
       
    36     *   CleanupStack::PushL( TCleanupItem( 
       
    37     *       DiagFwInternal::CleanupResetAndDestroy< RPointerArray< CDiagResultsDatabaseItem > >,
       
    38     *       &myArray ) );
       
    39     *    
       
    40     *   ...
       
    41     *
       
    42     *   CleanupStack::PopAndDestroy( &myArray );
       
    43     */
       
    44     template< class T >
       
    45     inline void CleanupResetAndDestroy( TAny* aObj );
       
    46 
       
    47     /**
       
    48     * Push a RPointerArray of templated type to cleanup stack
       
    49     *   @usage
       
    50     *   RPointerArray< CDiagResultsDatabaseItem > myArray;
       
    51     *   DiagFwInternal::CleanupRPointerArrayPushL< CDiagResultsDatabaseItem >( &myArray );
       
    52     *
       
    53     *   ...
       
    54     *   
       
    55     *   CleanupStack::PopAndDestroy( &myArray );
       
    56     */
       
    57     template< class T >
       
    58     inline void CleanupRPointerArrayPushL( RPointerArray< T >* aObj );
       
    59 
       
    60     }
       
    61 
       
    62 // Inline methods
       
    63 #include "diagcleanupresetanddestroy.inl"
       
    64 
       
    65 #endif // DIAGCLEANUPRESETANDDESTROY_H
       
    66 
       
    67 // End of File
       
    68