epoc32/include/ct/rmpointerarray.h
author William Roberts <williamr@symbian.org>
Wed, 31 Mar 2010 12:33:34 +0100
branchSymbian3
changeset 4 837f303aceeb
parent 2 2fe1408b6811
permissions -rw-r--r--
Current Symbian^3 public API header files (from PDK 3.0.h)
This is the epoc32/include tree with the "platform" subtrees removed, and
all but a selected few mbg and rsg files removed.
     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  @file
    21  @publishedAll
    22  @released
    23 */
    24 
    25 #ifndef __RMPOINTERARRAY_H__
    26 #define __RMPOINTERARRAY_H__
    27 
    28 
    29 /**
    30  * An array of pointers to objects, that adds close type behaviour.
    31  *
    32  * For use with M class pointers, which have a release method and are owned by 
    33  * the array. When the array is closed, the objects will be released.
    34  *
    35  * @see RMPointerArray
    36  * @since v7.0 
    37  */
    38 template<class T> class RMPointerArray : public RPointerArray<T>
    39 	{
    40  public:
    41 	/** Constructor */
    42 	inline RMPointerArray();
    43 	/** Frees all resources, calling Release() on the contents of the array */
    44 	inline void Close();
    45 	};
    46 
    47 /** Default constructor. */
    48 template <class T>
    49 inline RMPointerArray<T>::RMPointerArray()
    50 	{
    51 	}
    52 
    53 /** 
    54  * Closes the array and frees all resources; this includes deleting the objects 
    55  * whose pointers are held by the array. 
    56  */
    57 template <class T>
    58 inline void RMPointerArray<T>::Close()
    59 	{
    60 	TInt count = this->Count();
    61 	for (TInt ii = 0; ii < count; ii++)
    62 		(*this)[ii]->Release();
    63 	this->Reset();
    64 	}
    65 
    66 #endif