sysresmonitoring/oommonitor/inc/oomconfig.h
branchRCL_3
changeset 1 0fdb7f6b0309
child 18 0818dd463d41
equal deleted inserted replaced
0:2e3d3ce01487 1:0fdb7f6b0309
       
     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:  Configuration representation classes for Out of Memory Monitor.
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 #ifndef OOMCONFIG_
       
    20 #define OOMCONFIG_
       
    21 
       
    22 #include <e32base.h>
       
    23 
       
    24 #include "oomglobalconfig.h"
       
    25 
       
    26 class COomCloseAppConfig;
       
    27 class COomRunPluginConfig;
       
    28 class MOomRuleConfig;
       
    29 class COomApplicationConfig;
       
    30 
       
    31 /*
       
    32  * A class representing the entire configuration.
       
    33  *
       
    34  *  @lib oommonitor.lib
       
    35  *  @since S60 v5.0
       
    36  */
       
    37 NONSHARABLE_CLASS(COomConfig) : public CBase
       
    38     {
       
    39 public:
       
    40     
       
    41     static COomConfig* NewL();
       
    42     
       
    43 // Functions for setting configuration  
       
    44     
       
    45     // Add the configuration for an application closure.
       
    46     // This class takes ownership of this configuration object.
       
    47     void SetAppCloseConfigL(COomCloseAppConfig* aActionConfig);
       
    48     
       
    49     // Add the configuration for a plugin action.
       
    50     // This class takes ownership of the configuration object.
       
    51     void AddPluginConfigL(COomRunPluginConfig* aPluginConfig);
       
    52     
       
    53     // Add a rule for an application
       
    54     // This class takes ownership of the given rule
       
    55     // This rule applies to the specified application (and not a plugin associated with this application)
       
    56     // The rule would usually apply to an "application close" event
       
    57     void AddApplicationRuleL(TUint aTargetAppId, MOomRuleConfig* aRule);
       
    58     
       
    59     // Add a rule for a plugin
       
    60     // This class takes ownership of the given rule
       
    61     // This rule is applied to the plugin with the specified ID
       
    62     void AddPluginRuleL(TUint aPluginId, MOomRuleConfig* aRule);    
       
    63     
       
    64     // Add this application config - this class takes ownership of it
       
    65     // Application config includes settings for a particular application, e.g. whether or not it can be closed
       
    66     void AddApplicationConfigL(COomApplicationConfig* aApplicationConfig);
       
    67     
       
    68 // Functions for getting configuration  
       
    69     
       
    70     // Get the application configuration for the given app id
       
    71     // If no specific actions have been configured for this application then the default application configuration is returned
       
    72     COomApplicationConfig& GetApplicationConfig(TInt32 aAppId);
       
    73     
       
    74     // Get the plugin configuration for the given plugin id
       
    75     // If no specific actions have been configured for this plugin then the default plugin configuration is returned
       
    76     COomRunPluginConfig& GetPluginConfig(TInt32 aPluginId);
       
    77         
       
    78 // Functions for setting global configuration   
       
    79     
       
    80     ~COomConfig();
       
    81     
       
    82     inline COomGlobalConfig& GlobalConfig();
       
    83     
       
    84     inline void SetDefaultLowRamThreshold(TInt aLowRamThreshold);
       
    85     inline void SetDefaultGoodRamThreshold(TInt aGoodRamThreshold);
       
    86     inline void SetMaxCloseAppBatch(TUint MaxCloseAppBatch);
       
    87     inline void SetDefaultWaitAfterPlugin(TInt aMilliseconds);
       
    88     inline void SetMaxAppExitTime(TInt aMilliseconds);
       
    89     
       
    90 private:
       
    91     void ConstructL();
       
    92     
       
    93     RHashMap<TInt32, COomApplicationConfig*> iApplicationToConfigMapping; // A hash-map of application configs, keyed on the application ID
       
    94     
       
    95     RHashMap<TInt32, COomRunPluginConfig*> iPluginToConfigMapping; // A hash-map of plug-in configs, keyed on the plugin ID
       
    96 
       
    97     COomGlobalConfig iGlobalConfig;
       
    98     };
       
    99 
       
   100 #include "oomconfig.inl"
       
   101 
       
   102 #endif /*OOMCONFIG_*/