memana/analyzetoolclient/dynamicmemoryhook/inc/analyzetooleventhandler.h
changeset 2 6a82cd05fb1e
parent 1 3ff3fecb12fe
equal deleted inserted replaced
1:3ff3fecb12fe 2:6a82cd05fb1e
     1 /*
       
     2 * Copyright (c) 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:  Declaration of the class CLibraryEventHandler.
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 #ifndef ANALYZETOOLEVENTHANDLER_H
       
    20 #define ANALYZETOOLEVENTHANDLER_H
       
    21 
       
    22 // INCLUDES
       
    23 #include <e32cmn.h>
       
    24 #include "Codeblock.h"
       
    25 #include <analyzetool/atstorageserverclnt.h>
       
    26 #include <analyzetool/analyzeTool.h>
       
    27 
       
    28 // FORWARD DECLARATIONS
       
    29 class MAnalyzeToolEventhandlerNotifier;
       
    30 
       
    31 // CLASS DECLARATION
       
    32 
       
    33 /**
       
    34 *  Class for receiving library load/unlaod events from the kernel   
       
    35 */
       
    36 class CLibraryEventHandler : public CActive
       
    37     {
       
    38     
       
    39     public: 
       
    40 
       
    41         /**
       
    42         * C++ default constructor.
       
    43         * @param aAnalyzeTool A reference to the <code>RAnalyzeTool</code> 
       
    44                  which is used to observe kernel events 
       
    45         * @param aCodeblocks A reference to array of code segments
       
    46         * @param aStorageServer A reference to the 
       
    47         *                       <code>RATStorageServer</code> which is 
       
    48         *                       used to store kernel events
       
    49         * @param aProcessId A reference to the observed process id
       
    50         * @param aMutex A reference to mutex to schedule access to the 
       
    51         *                   shared resources
       
    52         * @param aNotifier A reference to notifier object which is used to 
       
    53         * 					inform killed threads
       
    54         * @param aLogOption Current used log option on allocator.
       
    55         */
       
    56         CLibraryEventHandler( RAnalyzeTool& aAnalyzeTool, 
       
    57                 RArray<TCodeblock>& aCodeblocks, 
       
    58                 RATStorageServer& aStorageServer, 
       
    59                 TUint aProcessId,
       
    60                 RMutex& aMutex,
       
    61                 MAnalyzeToolEventhandlerNotifier& aNotifier,
       
    62                 TUint32 aLogOption );
       
    63 
       
    64         /**
       
    65         * Destructor.
       
    66         */
       
    67         ~CLibraryEventHandler();
       
    68 
       
    69         /* Start receiving events from the kernel */
       
    70         void Start();
       
    71         
       
    72         /**
       
    73         * Returns eventhandler's state.
       
    74         * @return TBool ETrue if eventhandler is started, EFalse otherwise
       
    75         */
       
    76         TBool IsStarted();
       
    77 
       
    78     protected: // Functions from base classes
       
    79         
       
    80         /**
       
    81         * Process active object's task
       
    82         */
       
    83         void RunL();
       
    84 
       
    85         /**
       
    86         * Cancels active object's task
       
    87         */
       
    88         void DoCancel();
       
    89  
       
    90     private: // Member variables
       
    91 
       
    92         /* Handle to the analyze tool device driver*/
       
    93         RAnalyzeTool& iAnalyzeTool; 
       
    94 
       
    95         /* A reference to codeblocks of the observed process */
       
    96         RArray<TCodeblock>& iCodeblocks;
       
    97 
       
    98         /* Handle to the storage server*/
       
    99         RATStorageServer& iStorageServer;
       
   100 
       
   101         /* The observered process id */ 
       
   102         TUint iProcessId;
       
   103 
       
   104         /* The library info */
       
   105         TLibraryEventInfo iLibraryInfo;
       
   106 
       
   107         /* The mutex for serializing access to the shared resources */
       
   108         RMutex& iMutex;
       
   109         
       
   110         /* Inform if handler is started */
       
   111         TBool iStarted;
       
   112         
       
   113         /* A reference to event handler notifier */
       
   114         MAnalyzeToolEventhandlerNotifier& iNotifier;
       
   115 
       
   116         /* Current used log option */
       
   117         TUint32 iLogOption;
       
   118     };
       
   119 
       
   120 #endif // ANALYZETOOLEVENTHANDLER_H
       
   121 
       
   122 // End of File