commondrm/drmutility/inc/DrmQueue.h
changeset 0 95b198f216e5
child 12 8a03a285ab14
equal deleted inserted replaced
-1:000000000000 0:95b198f216e5
       
     1 /*
       
     2 * Copyright (c) 2006 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:  DRM Queue
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 #ifndef CDRMQUEUE_H
       
    20 #define CDRMQUEUE_H
       
    21 
       
    22 //*** system include files go here:
       
    23 #include <e32base.h>
       
    24 
       
    25 //*** user include files go here:
       
    26 
       
    27 //*** forward declarations go here:
       
    28 
       
    29 //*** constants go here:
       
    30 
       
    31 namespace DRM
       
    32 {
       
    33  /**
       
    34   *  DRM Queue
       
    35   *
       
    36   *
       
    37   *
       
    38   *  @lib drmutility.lib
       
    39   *  @since S60 v4.0
       
    40   */
       
    41 template< class C > class CDrmQueue : public CBase
       
    42     {
       
    43 
       
    44 public:
       
    45 
       
    46     /**
       
    47     * Construction function
       
    48     */
       
    49     static CDrmQueue<C>* NewLC();
       
    50 
       
    51     /**
       
    52     * Construction function
       
    53     */
       
    54     static CDrmQueue<C>* NewL();
       
    55 
       
    56 
       
    57     /**
       
    58     * Destructor.
       
    59     */
       
    60     ~CDrmQueue();
       
    61 
       
    62     /**
       
    63     * C++ default constructor.
       
    64     */
       
    65     CDrmQueue();
       
    66 
       
    67     /**
       
    68     * Checks the rights and their status for a specific unique id
       
    69     * implementation
       
    70     *
       
    71     * @param[in]   aData : a pointer to the data object
       
    72     */
       
    73     void AppendToQueueL( C* aData );
       
    74 
       
    75 
       
    76 
       
    77     /**
       
    78     * Checks the rights and their status for a specific unique id
       
    79     * implementation
       
    80     *
       
    81     * @return pointer to popped data.
       
    82     */
       
    83     C* PopFront();
       
    84 
       
    85     /**
       
    86     * Checks 
       
    87     * implementation
       
    88     * @param[in]   aId : ID representing data to be popped from queue
       
    89     * @return      Pointer to data object in queue, NULL if not found 
       
    90     * 
       
    91     */
       
    92     C* PopItem( TInt aId );
       
    93 
       
    94 private:
       
    95 
       
    96 
       
    97 
       
    98     /**
       
    99     * 2nd phase constructor.
       
   100     */
       
   101     void ConstructL();
       
   102 
       
   103 
       
   104     struct QueueData
       
   105         {
       
   106         C* iData;
       
   107         QueueData* iNext;
       
   108         };
       
   109 
       
   110 
       
   111 
       
   112     // Operation Queue:
       
   113     QueueData* iFirst;
       
   114     QueueData* iLast;
       
   115 
       
   116     // To prevent queue handling from being messed up by threads
       
   117     RSemaphore iSemaphore;
       
   118     };
       
   119 }
       
   120 
       
   121 // Since it's a template class include the implementation
       
   122 #include "drmqueue.inl"
       
   123 
       
   124 #endif // CDRMAUTOMATEDUSAGE_H