contextframework/cfw/inc/cfserver/cfasynccmdqueue.h
changeset 0 2e3d3ce01487
equal deleted inserted replaced
-1:000000000000 0:2e3d3ce01487
       
     1 /*
       
     2 * Copyright (c) 2008 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:  CCFAsyncCmdQueue class declaration.
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 #ifndef C_CFASYNCCMDQUEUE_H
       
    20 #define C_CFASYNCCMDQUEUE_H
       
    21 
       
    22 
       
    23 // SYSTEM INCLUDE FILES
       
    24 #include <e32base.h>
       
    25 
       
    26 // USER INCLUDE FILES
       
    27 
       
    28 // FORWARD DECLARATIONS
       
    29 class CCFCmd;
       
    30 class MCFContextSubscriptionListener;
       
    31 
       
    32 // DATA TYPES
       
    33 
       
    34 // CLASS DECLARATION
       
    35 
       
    36 /**
       
    37  * Queue for commands that need to be executed asynchronously.
       
    38  *
       
    39  * @lib CFServer
       
    40  * @since S60 5.0
       
    41  */
       
    42 NONSHARABLE_CLASS( CCFAsyncCmdQueue ) : public CActive
       
    43 {
       
    44 public:
       
    45 
       
    46     /**
       
    47      * Symbian two phased constructors.
       
    48      *
       
    49      * @since S60 5.0
       
    50      * @param None.
       
    51      * @return CCFAsyncCmdQueue
       
    52      */
       
    53     static CCFAsyncCmdQueue* NewL();
       
    54     static CCFAsyncCmdQueue* NewLC();
       
    55 
       
    56     /**
       
    57      * C++ destructor.
       
    58      */
       
    59     virtual ~CCFAsyncCmdQueue();
       
    60 
       
    61 public: // New functions
       
    62 
       
    63     /**
       
    64      * Adds command to the end of the asynchronous command queue.
       
    65      * Takes the command's ownership.
       
    66      *
       
    67      * @since S60 5.0
       
    68      * @param aCmd is the command to be added. Ownership is transferred.
       
    69      * @return None.
       
    70      */
       
    71     void Add( CCFCmd* aCmd );
       
    72 
       
    73     /**
       
    74      * Adds command to the front of the asynchronous command queue making it the
       
    75      * next one to be executed.
       
    76      * Takes the command's ownership.
       
    77      *
       
    78      * @since S60 5.0
       
    79      * @param aCmd is the command to be added. Ownership is transferred.
       
    80      * @return None.
       
    81      */
       
    82     void AddFirst( CCFCmd* aCmd );
       
    83 
       
    84 private: // Functions from CActive
       
    85 
       
    86     // @see CActive.
       
    87     void DoCancel();
       
    88 
       
    89     // @see CActive.
       
    90     void RunL();
       
    91 
       
    92     // @see CActive.
       
    93     TInt RunError( TInt aError );
       
    94 
       
    95 private: // New functions
       
    96 
       
    97     /**
       
    98      * Activates the queue to execute the first command.
       
    99      *
       
   100      * @since S60 5.0
       
   101      * @param None.
       
   102      * @return None.
       
   103      */
       
   104     void Activate();
       
   105 
       
   106 private:
       
   107 
       
   108     CCFAsyncCmdQueue();
       
   109 
       
   110 private: // Data
       
   111 
       
   112     // The queue for asynchronous commands.
       
   113     TSglQue< CCFCmd > iQueue;
       
   114 
       
   115     // The queue iterator for asynchronous commands.
       
   116     TSglQueIter< CCFCmd > iQueueIter;
       
   117 
       
   118     // Current command being executed, removed from the queue.
       
   119     CCFCmd* iCurrentCmd;
       
   120 };
       
   121 
       
   122 #endif // C_CFASYNCCMDQUEUE_H