cryptomgmtlibs/cryptotokenfw/inc/ct/RMPointerArray.h
changeset 0 2c201484c85f
child 8 35751d3474b7
equal deleted inserted replaced
-1:000000000000 0:2c201484c85f
       
     1 /*
       
     2 * Copyright (c) 2001-2009 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 the License "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: 
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 
       
    20 
       
    21 /**
       
    22  @file
       
    23  @publishedAll
       
    24  @released
       
    25 */
       
    26 
       
    27 #ifndef __RMPOINTERARRAY_H__
       
    28 #define __RMPOINTERARRAY_H__
       
    29 
       
    30 
       
    31 /**
       
    32  * An array of pointers to objects, that adds close type behaviour.
       
    33  *
       
    34  * For use with M class pointers, which have a release method and are owned by 
       
    35  * the array. When the array is closed, the objects will be released.
       
    36  *
       
    37  * @see RMPointerArray
       
    38  * @publishedPartner
       
    39  * @released
       
    40  * @since v7.0 
       
    41  */
       
    42 template<class T> class RMPointerArray : public RPointerArray<T>
       
    43 	{
       
    44  public:
       
    45 	/** Constructor */
       
    46 	inline RMPointerArray();
       
    47 	/** Frees all resources, calling Release() on the contents of the array */
       
    48 	inline void Close();
       
    49 	};
       
    50 
       
    51 /** Default constructor. */
       
    52 template <class T>
       
    53 inline RMPointerArray<T>::RMPointerArray()
       
    54 	{
       
    55 	}
       
    56 
       
    57 /** 
       
    58  * Closes the array and frees all resources; this includes deleting the objects 
       
    59  * whose pointers are held by the array. 
       
    60  */
       
    61 template <class T>
       
    62 inline void RMPointerArray<T>::Close()
       
    63 	{
       
    64 	TInt count = this->Count();
       
    65 	for (TInt ii = 0; ii < count; ii++)
       
    66 		(*this)[ii]->Release();
       
    67 	this->Reset();
       
    68 	}
       
    69 
       
    70 #endif