resourcemgmt/hwresourcesmgr/server/inc/HWRMPluginTransactionList.h
changeset 0 4e1aa6a622a0
equal deleted inserted replaced
-1:000000000000 0:4e1aa6a622a0
       
     1 /*
       
     2 * Copyright (c) 2006-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 "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  @internalTechnology 
       
    24 */
       
    25 
       
    26 #ifndef HWRMPLUGINTRANSACTIONLIST_H
       
    27 #define HWRMPLUGINTRANSACTIONLIST_H
       
    28 
       
    29 //  INCLUDES
       
    30 #include <e32base.h>
       
    31 
       
    32 // CONSTANTS
       
    33 // None
       
    34 
       
    35 // MACROS
       
    36 // None
       
    37 
       
    38 // DATA TYPES
       
    39 
       
    40 // FUNCTION PROTOTYPES
       
    41 // None
       
    42 
       
    43 // FORWARD DECLARATIONS
       
    44 // None
       
    45 
       
    46 // CLASS DECLARATIONS
       
    47 
       
    48 /**
       
    49 * This class contains ongoing plugin operation data base class
       
    50 * It is used as a struct.
       
    51 */
       
    52 class THWRMPluginTransactionListItem
       
    53     {
       
    54     public:
       
    55     
       
    56 	    TUint8                    iTransId;            // Ongoing transaction ID
       
    57 	    TInt                      iCommandId;          // Command that is being handled.
       
    58 	    THWRMPluginTransactionListItem* iNextData;     // Next data in the queue. Not owned.
       
    59 
       
    60         /**
       
    61 	    * Convenience constructor
       
    62 	    */
       
    63 	    THWRMPluginTransactionListItem(TUint8 aTransId, TInt aCommandId)
       
    64 	        :iTransId(aTransId),
       
    65 	        iCommandId(aCommandId),
       
    66 	        iNextData(NULL)
       
    67 	            {
       
    68 	            };
       
    69 
       
    70 	    /**
       
    71 	    * Virtual destructor.
       
    72 	    */
       
    73 	    virtual ~THWRMPluginTransactionListItem()
       
    74 	        {
       
    75 	        // iNextData not owned so not cleaned
       
    76 	        iNextData = NULL;
       
    77 	        };
       
    78     };
       
    79     
       
    80 /**
       
    81 *  Hardware Resource Manager server side plugin
       
    82 *  transaction list handler
       
    83 *
       
    84 */
       
    85 class CHWRMPluginTransactionList : public CBase
       
    86     {
       
    87     public: // Constructors and Destructor
       
    88     
       
    89         /**
       
    90         * Constructor method for instance.
       
    91         */
       
    92         static CHWRMPluginTransactionList* NewL();
       
    93 
       
    94         /**
       
    95         * Destructor.
       
    96         * Deletes all data instances still in the list, even though normally 
       
    97         * instances are deleted by using class. This is because after
       
    98         * list destruction there is no way to find the instances to delete any more.
       
    99         */
       
   100         virtual ~CHWRMPluginTransactionList();
       
   101     
       
   102     public: // New functions
       
   103 
       
   104         /**
       
   105         * Finds a transaction from transaction list.
       
   106         *
       
   107         * @param aTransId   Unique transcation identifier
       
   108         * @param aRemove    If ETrue, transaction will be removed from the list.
       
   109         * @return Transaction data found or NULL if not found.
       
   110         */
       
   111         THWRMPluginTransactionListItem* FindTransaction( TUint8 aTransId, TBool aRemove);
       
   112         
       
   113         /**
       
   114         * Add transaction to transaction list
       
   115         *
       
   116         * @param aTransactionData Transaction data to add to list
       
   117         */
       
   118         void AddTransaction( THWRMPluginTransactionListItem* aTransactionData );
       
   119         
       
   120         /**
       
   121         * Removes first item from list. 
       
   122         * 
       
   123         * @return Pointer to removed item
       
   124         */
       
   125         THWRMPluginTransactionListItem* RemoveFirstItem();
       
   126         
       
   127         /**
       
   128         * Get first transaction data item in the list
       
   129         * That item can be then used to iterate further.
       
   130         *
       
   131         * @return First item in the list or NULL if empty.
       
   132         */
       
   133         inline THWRMPluginTransactionListItem* GetFirstItem();
       
   134         
       
   135         /**
       
   136         * Get count of transactions in list
       
   137         */
       
   138         inline TInt Count() const;    
       
   139          
       
   140     private: 
       
   141     
       
   142         /**
       
   143         * C++ default constructor.
       
   144         */
       
   145         CHWRMPluginTransactionList();
       
   146         
       
   147         
       
   148 	private:   // data
       
   149 	
       
   150 	    THWRMPluginTransactionListItem* iTransactionData;      // This is valid only while transaction is list
       
   151 	                                                           // Contains pointer to next data in list.
       
   152 	                                                           // Creation and deletion of data is normally
       
   153 	                                                           // responsibility of list user, but 
       
   154 	                                                           // but all instances still listed will be deleted
       
   155 	                                                           // in list destructor.
       
   156 	    THWRMPluginTransactionListItem* iTransactionDataLast;  // Last transaction data in list
       
   157 	                                                           
       
   158 	    
       
   159 	    TInt iCount;      // Number of transactions in list
       
   160 	    	    
       
   161     };
       
   162     
       
   163 
       
   164 #include "HWRMPluginTransactionList.inl"
       
   165 
       
   166 #endif  // HWRMPLUGINTRANSACTIONLIST_H
       
   167             
       
   168 // End of File