GeneralConfig Class Reference

class representing a general configuration (no scheme config) More...

#include <config_pm.h>

Inheritance diagram for GeneralConfig:

PS_Config List of all members.

Public Member Functions

 GeneralConfig ()
 constructor
virtual ~GeneralConfig ()
 destructor
int readConfFiles ()
 read the config files
SchemeConfiggetScheme (const string &scheme_name)
 get a scheme configuration by scheme name
SchemeConfiggetSchemeByNumber (int no)
 get a scheme by number
int setActiveScheme (const string &scheme_name)
 sets the active scheme
string getBatteryScheme ()
 get the name of the battery scheme
string getACScheme ()
 get the name of the AC scheme

Public Attributes

SchemeConfigcurrent_scheme
 the current active scheme config
SchemeConfigAC_scheme
 the default AC scheme config
SchemeConfigBattery_scheme
 the default battery scheme config
string config_dir
 directory where to find config files
string script_dir
 directory where to find "internal" scripts
string scheme_dir
 the directory where scheme files are found
string pub_script_dir
 directory where to find scripts for e.g. events
bool disable_CPU_freq
 whether to disable cpu frequency scaling

Private Member Functions

int initSchemes ()
 initializes all schemes reading them from config files
bool parseSchemes ()
 parse all scheme config files

Private Attributes

SchemeConfigscheme_configs
 beginning of scheme list

Static Private Attributes

static const string config_files [6] = { "common", "thermal", "cpufreq", "battery", "sleep", "events" }
 six different general config files are used

Detailed Description

class representing a general configuration (no scheme config)


Constructor & Destructor Documentation

GeneralConfig::GeneralConfig  ) 
 

constructor

GeneralConfig::~GeneralConfig  )  [virtual]
 

destructor


Member Function Documentation

string GeneralConfig::getACScheme  ) 
 

get the name of the AC scheme

Returns:
the name of the scheme
Return values:
"" if no scheme is associated (this would be a bug)

string GeneralConfig::getBatteryScheme  ) 
 

get the name of the battery scheme

Returns:
the name of the scheme
Return values:
"" if no scheme is associated (this would be a bug)

SchemeConfig * GeneralConfig::getScheme const string &  scheme_name  ) 
 

get a scheme configuration by scheme name

Parameters:
scheme_name the name of the scheme
Returns:
SchemeConfig object or NULL

SchemeConfig * GeneralConfig::getSchemeByNumber int  no  ) 
 

get a scheme by number

use for iteration to get all schemes...

Parameters:
no number of scheme when added
Returns:
pointer to a SchemeConfig
Return values:
pointer to requested SchemeConfig
NULL if scheme at position no does not exist

int GeneralConfig::initSchemes  )  [private]
 

initializes all schemes reading them from config files

Returns:
number of initialised schemes or < 0 on error

bool GeneralConfig::parseSchemes  )  [private]
 

parse all scheme config files

Returns:
true on success, false otherwise

int GeneralConfig::readConfFiles  ) 
 

read the config files

Returns:
  • -1 if no schemes available, have to quit then or we may access NULL pointer in powersave.cpp: config->current_scheme, makes no sense to assign a default scheme

int GeneralConfig::setActiveScheme const string &  scheme_name  ) 
 

sets the active scheme

Parameters:
scheme_name pass the name of the scheme as it is defined in POWERSAVE_SCHEME_NAME
Returns:
integer representing result of set active scheme
Return values:
-1 if the scheme does not exist
0 if scheme is already active
1 if scheme is successfully activated


Member Data Documentation

SchemeConfig* GeneralConfig::AC_scheme
 

the default AC scheme config

SchemeConfig* GeneralConfig::Battery_scheme
 

the default battery scheme config

string GeneralConfig::config_dir
 

directory where to find config files

const string GeneralConfig::config_files = { "common", "thermal", "cpufreq", "battery", "sleep", "events" } [static, private]
 

six different general config files are used

SchemeConfig* GeneralConfig::current_scheme
 

the current active scheme config

bool GeneralConfig::disable_CPU_freq
 

whether to disable cpu frequency scaling

string GeneralConfig::pub_script_dir
 

directory where to find scripts for e.g. events

SchemeConfig* GeneralConfig::scheme_configs [private]
 

beginning of scheme list

string GeneralConfig::scheme_dir
 

the directory where scheme files are found

string GeneralConfig::script_dir
 

directory where to find "internal" scripts


The documentation for this class was generated from the following files:
Generated on Mon Mar 27 09:27:20 2006 for Powersave Daemon by  doxygen 1.4.6