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