memana/analyzetoolclient/dynamicmemoryhook/inc/customuser.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 CustomUser containing overloaded User static functions.
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 #ifndef CUSTOMUSER_H
       
    20 #define CUSTOMUSER_H
       
    21 
       
    22 // INCLUDES
       
    23 #include <u32std.h>
       
    24 
       
    25 // CLASS DECLARATION
       
    26 
       
    27 /**
       
    28 *  Class which overloads the User functions and provides access to 
       
    29 *  the overloaded functions  
       
    30 */
       
    31 class CustomUser
       
    32     {
       
    33     
       
    34     public:
       
    35 
       
    36         /**
       
    37         * Overloaded version of User::Exit()
       
    38         * Terminates the current thread, specifying a reason. All child 
       
    39         * threads are terminated and all resources are cleaned up.If the 
       
    40         * current thread is the main thread in a process, the process is
       
    41         * also terminated.
       
    42         * @param aReason The reason code.
       
    43         */
       
    44         IMPORT_C static void Exit( TInt aReason );
       
    45 
       
    46         /**
       
    47         * Overloaded version of User::Panic()
       
    48         * Panics the current thread, specifying a category name and panic
       
    49         * number. Keep the length of the category name small;
       
    50         * a length of 16 is ideal.
       
    51         * @param aCategory A reference to the descriptor containing the text 
       
    52         * that defines the category for this panic.
       
    53         * @param aReason The panic number. 
       
    54         */   
       
    55         IMPORT_C static void Panic( const TDesC& aCategory, TInt aReason );
       
    56 
       
    57         /**
       
    58         * Overloaded version of UserHeap::SetupThreadHeap()
       
    59         * Setups the threads heap.
       
    60         * @param aNotFirst Is this first thread using specified heap
       
    61         * @param aInfo Specifies the thread heap properties
       
    62         * @param aFileName The name of the log file
       
    63         * @param aLogOption The logging option for storage server
       
    64         * @param aIsDebug Determines whether a binary is UDEB or UREL
       
    65         * @param aVersion Atool version number
       
    66         * @param aAllocCallStackSize Max number of stored callstack items when memory allocated
       
    67         * @param aFreecallStackSize Max number of stored callstack items when memory freed
       
    68         * @return TInt KErrNone, if the insertion is successful, otherwise 
       
    69         * one of the system wide error codes.
       
    70         */   
       
    71         IMPORT_C static TInt SetupThreadHeap( 
       
    72                              TBool aNotFirst, 
       
    73                              SStdEpocThreadCreateInfo& aInfo,
       
    74                              const TFileName aFileName,
       
    75                              TUint32 aLogOption, TUint32 aIsDebug,
       
    76                              const TFileName aVersion,
       
    77                              TUint32 aAllocCallStackSize,
       
    78                              TUint32 aFreeCallStackSize );
       
    79                              
       
    80         /**
       
    81         * Overloaded version of UserHeap::SetCritical()
       
    82         * Sets up or changes the effect that termination of the current 
       
    83         * thread has, either on its owning process, or on the whole system.
       
    84         * The precise effect of thread termination is defined by the following
       
    85         *  specific values of the TCritical enum:
       
    86         * ENotCritical
       
    87         * EProcessCritical
       
    88         * EProcessPermanent
       
    89         * ESystemCritical
       
    90         * ESystemPermanent
       
    91         * Notes: The enum value EAllThreadsCritical cannot be set using this
       
    92         * function. It is associated with a process, not a thread, and, if 
       
    93         * appropriate, should be set using User::SetProcessCritical().
       
    94         * The states associated with ENotCritical, EProcessCritical, 
       
    95         * EProcessPermanent, ESystemCritical and ESystemPermanent are all 
       
    96         * mutually exclusive, i.e. the thread can only be in one of these 
       
    97         * states at any one time.
       
    98         * @param aCritical The state to be set.
       
    99         * @return TInt KErrNone, if successful; KErrArgument, if 
       
   100         * EAllThreadsCritical is passed - this is a state associated with a 
       
   101         * process, and you use User::SetProcessCritical() to set it.
       
   102         */ 
       
   103         IMPORT_C static TInt SetCritical( User::TCritical aCritical );
       
   104         
       
   105         /**
       
   106         * Overloaded version of UserHeap::SetCritical()
       
   107         * Sets up or changes the effect that termination of subsequently 
       
   108         * created threads will have, either on the owning process, 
       
   109         * or on the whole system. It is important to note that we are not
       
   110         * referring to threads that have already been created, but threads
       
   111         * that will be created subsequent to a call to this function.
       
   112         * The precise effect of thread termination is defined by the following
       
   113         * specific values of the TCritical enum:
       
   114         * ENotCritical
       
   115         * EAllThreadsCritical
       
   116         * ESystemCritical
       
   117         * ESystemPermanent
       
   118         * Notes:
       
   119         * The enum values EProcessCritical and EProcessPermanent cannot be set
       
   120         * using this function. They are states associated with a thread, not a
       
   121         * process, and, if appropriate, should be set using 
       
   122         * User::SetCritical(). The states associated with ENotCritical, 
       
   123         * EAllThreadsCritical, ESystemCritical and ESystemPermanent are all 
       
   124         * mutually exclusive, i.e. the process can only be in one of these 
       
   125         * states at any one time.
       
   126         * @param aCritical The state to be set.
       
   127         * @return TInt KErrNone, if successful; KErrArgument, if either 
       
   128         * EProcessCritical or EProcessPermanent is passed - these are states
       
   129         * associated with a thread, and you use User::SetCritical() 
       
   130         * to set them.
       
   131         */ 
       
   132         IMPORT_C static TInt SetProcessCritical( User::TCritical aCritical );
       
   133         
       
   134         /**
       
   135 		* Overloaded version of User::DbgMarkEnd()
       
   136 		* Marks the end of heap cell checking at the current nested level 
       
   137 		* for the current thread's default heap, or the kernel heap.
       
   138 		* @param aKernel ETrue, if checking is being done for the kernel heap; 
       
   139 		* 	EFalse, if checking is being done for the current thread's default heap.
       
   140 		* @param aCount The number of allocated heap cells expected.
       
   141 		*/ 
       
   142         IMPORT_C static TUint32 CustomUser::__DbgMarkEnd( TBool aKernel, TInt aCount );
       
   143         
       
   144     private: // Private functions
       
   145         
       
   146         /**
       
   147         * Factory function for creating RAllocator instances.
       
   148         * @param aNotFirst Is this first thread using specified heap
       
   149         * @param aLogOption The logging option for storage server
       
   150         * @param aFileName The name of the logging file
       
   151         * @param aIsDebug Determines whether a binary is UDEB or UREL
       
   152         * @param aAllocCallStackSize Max number of stored callstack items when memory allocated
       
   153         * @param aFreecallStackSize Max number of stored callstack items when memory freed
       
   154         * @return RAllocator& A reference to created allocator
       
   155         */  
       
   156         static RAllocator& InstallAllocator( TBool aNotFirst,
       
   157                                              const TFileName aFileName,
       
   158                                              TUint32 aLogOption, TUint32 aIsDebug,
       
   159                                              TUint32 aAllocCallStackSize,
       
   160                                              TUint32 aFreeCallStackSize );
       
   161         
       
   162 		/**
       
   163 		* Check atool version
       
   164 		* @param aVersion - Atool version number.
       
   165 		* @param aToolVersion The atool version number
       
   166 		* @return KErrNone if correct version found, otherwise one of the system wide 
       
   167 		* error codes.
       
   168 		*/
       
   169         static TInt CheckVersion( const TFileName aVersion, TDes& aToolVersion ); 
       
   170         
       
   171 		/**
       
   172 		* Function for showing incorrect version information (file or XTI).
       
   173 		* @param aLogOption The logging option
       
   174 		* @param aFileName The name of the log file
       
   175 		* @param aToolVersion The atool version number
       
   176 		*/
       
   177         static void ReportIncorrectVersion( const TUint32 aLogOption, 
       
   178 											const TFileName aFileName,
       
   179 											const TDes& aToolVersion );
       
   180         
       
   181     };
       
   182 
       
   183 #endif // CUSTOMUSER_H
       
   184 
       
   185 // End of File