devicediagnosticsfw/diagresultsdb/server/inc/diagresultsdbcrdc.h
branchRCL_3
changeset 26 19bba8228ff0
parent 0 b497e44ab2fc
equal deleted inserted replaced
25:b183ec05bd8c 26:19bba8228ff0
       
     1 /*
       
     2 * Copyright (c) 2007-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:  Real cleanup stack for RPointerArrays.
       
    15 *                ResetAndDestroy + Close must be called, instead of just Close.
       
    16 *  libraries   : 
       
    17 *
       
    18 */
       
    19 
       
    20 
       
    21 /**
       
    22 * Template class for destroying RPointerArrays
       
    23 *
       
    24 * @since S60 v5.0
       
    25 **/
       
    26 template <class T>
       
    27 class CleanupResetAndDestroyClose
       
    28     {
       
    29 public:
       
    30     inline static void PushL(T& aRef)
       
    31         { 
       
    32         CleanupStack::PushL(TCleanupItem(&Close,&aRef)); 
       
    33         }
       
    34 
       
    35     static void Close(TAny *aPtr) 
       
    36         {
       
    37         (STATIC_CAST(T*,aPtr))->ResetAndDestroy();
       
    38         (STATIC_CAST(T*,aPtr))->Close();
       
    39         }
       
    40     };
       
    41     
       
    42 /**
       
    43 * Use for pushing RPointerArrays onto a cleanupstack.
       
    44 *
       
    45 * @since S60 v5.0
       
    46 **/    
       
    47 template <class T>
       
    48 inline void CleanupResetAndDestroyClosePushL(T& aRef)
       
    49     {
       
    50     CleanupResetAndDestroyClose<T>::PushL(aRef);
       
    51     }