connectionmonitoring/connectionmonitorui/inc/ConnectionArray.h
branchRCL_3
changeset 58 83ca720e2b9a
parent 0 5a93021fdf25
equal deleted inserted replaced
57:05bc53fe583b 58:83ca720e2b9a
       
     1 /*
       
     2 * Copyright (c) 2004 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:  Contains and handles CConnectionInfo instances
       
    15 *     
       
    16 *
       
    17 */
       
    18 
       
    19 
       
    20 #ifndef CONNECTIONARRAY_H_INCLUDED
       
    21 #define CONNECTIONARRAY_H_INCLUDED
       
    22 
       
    23 // INCLUDES
       
    24 #include    "ConnectionInfoBase.h"
       
    25 
       
    26 
       
    27 // CONSTANTS
       
    28 
       
    29 // FORWARD DECLARATIONS
       
    30 
       
    31 // CLASS DECLARATION
       
    32 /**
       
    33 * Contains and handles CConnectionInfo instances.
       
    34 */
       
    35 class CConnectionArray : public CBase, public MDesCArray
       
    36     {
       
    37     public:
       
    38         /**
       
    39         * Constructor.
       
    40         */
       
    41         CConnectionArray();
       
    42 
       
    43         /**
       
    44         * Destructor.
       
    45         */
       
    46         virtual ~CConnectionArray();
       
    47 
       
    48         /**
       
    49         * Contructs dynamic data members
       
    50         */
       
    51         virtual void ConstructL();
       
    52    
       
    53     public: // from MDesCArray
       
    54         /** 
       
    55         * Returns the number of descriptor elements in a descriptor array.
       
    56         * @return The number of descriptor elements in a descriptor array. 
       
    57         */
       
    58         virtual TInt MdcaCount() const;
       
    59 
       
    60         /** 
       
    61         * Indexes into a descriptor array.    
       
    62         * @param aIndex The position of the descriptor element within a 
       
    63         * descriptor array. 
       
    64         * The position is relative to zero; i.e. zero implies the first 
       
    65         * descriptor element in a descriptor array. 
       
    66         * @return A  non-modifiable pointer descriptor representing 
       
    67         * the descriptor element located at position aIndex within a 
       
    68         * descriptor array. 
       
    69         */
       
    70         virtual TPtrC MdcaPoint( TInt aIndex ) const;
       
    71 
       
    72     public:
       
    73     
       
    74         /**
       
    75         * Give back a copy of connectionarray. 
       
    76         */
       
    77         virtual CConnectionArray* DeepCopyL();
       
    78     
       
    79         /**
       
    80         * Returns the index of the given connection
       
    81         * @param aConnectionId connection id
       
    82         * @return index value of connection in the array, or -1 if there
       
    83         * is no connection the given Id
       
    84         */
       
    85         TInt GetArrayIndex( TUint aConnectionId ) const;
       
    86 
       
    87         /**
       
    88         * Returns the index of the given connection
       
    89         * @param aConnection connection 
       
    90         * @return index value of connection in the array, or -1 if there
       
    91         * is no the given connection 
       
    92         */
       
    93         TInt GetArrayIndex( CConnectionInfoBase* aConnection ) const;
       
    94 
       
    95         /**
       
    96         * Add only new connection to the array
       
    97         * @param aConnection the connection to be added to the array
       
    98         */
       
    99         void AppendL( CConnectionInfoBase* aConnection );
       
   100 
       
   101         /**
       
   102         * Delete connection from the array
       
   103         * @param aConnectionId id of connection to be removed from the array
       
   104         */
       
   105         void Delete( TUint aConnectionId );
       
   106 
       
   107         /**
       
   108         * Delete connection from the array
       
   109         * @param aConnection the connection to be removed from the array
       
   110         */
       
   111         void Delete( CConnectionInfoBase* aConnection );
       
   112 
       
   113         /**
       
   114         * Destroys the connection array
       
   115         */
       
   116         void Reset();
       
   117 
       
   118         /**
       
   119         * Returns info object of connection given by index value in the array
       
   120         * @param aIndex index value of connection in the array
       
   121         * @return CConnectionInfo* pointer to the connection info object
       
   122         */
       
   123         CConnectionInfoBase* operator[]( TUint aIndex ) const;
       
   124         
       
   125         /**
       
   126         * Returns info object of connection given by index value in the array
       
   127         * Checks the boundaries of array.
       
   128         * @param aIndex index value of connection in the array
       
   129         * @return CConnectionInfoBase* pointer to the connection info object if
       
   130         * the given index is valid, NULL otherwise
       
   131         */
       
   132         CConnectionInfoBase* At( TInt aIndex ) const;
       
   133         
       
   134         /**
       
   135         * Gives back the number of active connections (created or suspended)
       
   136         * @return the number of active connections
       
   137         */
       
   138         TInt NumberOfActiveConnections() const;
       
   139 
       
   140         /**
       
   141         * Gives back the number of suspended connections
       
   142         * @return the number of suspended connections
       
   143         */
       
   144         TInt NumberOfSuspendedConnections() const;
       
   145 
       
   146     protected:
       
   147         /**
       
   148         * Contains the connections.
       
   149         */
       
   150         CArrayPtrFlat<CConnectionInfoBase>* iConnectionArray;   ///< Owned.
       
   151     };
       
   152 
       
   153 #endif // CONNECTIONARRAY_H_INCLUDED