RTC::ManagerConfig Class Reference

Manager configuration class. More...

#include <ManagerConfig.h>

List of all members.

Public Member Functions

 ManagerConfig ()
 Constructor.
 ManagerConfig (int argc, char **argv)
 Constructor.
virtual ~ManagerConfig (void)
 Destructor.
void init (int argc, char **argv)
 Initialization.
void configure (coil::Properties &prop)
 Specify the configuration information to the Property.
coil::Properties getConfig () const
 Get the configuration.

Static Public Attributes

static const char * config_file_path []
 The default configuration file path for manager.
static const char * config_file_env
 The environment variable to distinguish the default configuration file path.

Protected Member Functions

void parseArgs (int argc, char **argv)
 Parse the command arguments.
bool findConfigFile ()
 Find the configuration file.
void setSystemInformation (coil::Properties &prop)
 Set system information.
bool fileExist (const std::string &filename)
 Check the file existence.

Protected Attributes

coil::Properties m_argprop
 configuration properties from arguments
std::string m_configFile
 Manager's configuration file path.
bool m_isMaster
 Manager master flag.

Detailed Description

Manager configuration class.

Modify Manager's configuration. This class receives the command line arguments and will be instantiated. Set property information of Manager with the configuration file specified by the command line argument or the environment variable etc.

The priorities of each configuration are as follows:

  1. Command option "-f"
  2. Environment variable "RTC_MANAGER_CONFIG"
  3. Default configuration file "./rtc.conf"
  4. Default configuration file "/etc/rtc.conf"
  5. Default configuration file "/etc/rtc/rtc.conf"
  6. Default configuration file "/usr/local/etc/rtc.conf"
  7. Default configuration file "/usr/local/etc/rtc/rtc.conf"
  8. Embedded configuration value

If the command option "-d" is specified (even if specify configuration file by "-f" option), the embedded configuration values will be used.

Since:
0.4.0

Constructor & Destructor Documentation

RTC::ManagerConfig::ManagerConfig (  ) 

Constructor.

Constructor (Do nothing)

RTC::ManagerConfig::ManagerConfig ( int  argc,
char **  argv 
)

Constructor.

Initialize configuration information by given arguments.

Parameters:
argc Number of command line arguments
argv The command line arguments
virtual RTC::ManagerConfig::~ManagerConfig ( void   )  [virtual]

Destructor.


Member Function Documentation

void RTC::ManagerConfig::configure ( coil::Properties &  prop  ) 

Specify the configuration information to the Property.

Configure to the properties specified by Manager's configuration

Parameters:
prop The target properties to configure
bool RTC::ManagerConfig::fileExist ( const std::string &  filename  )  [protected]

Check the file existence.

Confirm whether the specified file exists

Parameters:
filename The target confirmation file
Returns:
file existance confirmation (True if the file exists.)
bool RTC::ManagerConfig::findConfigFile (  )  [protected]

Find the configuration file.

Find the configuration file and configure it. Confirm the file existence when the configuration file has already configured.

The priority of the configuration file
The command option>the environment variable>the default file> the default configuration

Default force option(-d): Ignore any default files and use the default configuration.

Returns:
Configuration file search result
coil::Properties RTC::ManagerConfig::getConfig (  )  const

Get the configuration.

Get the configuration. When this operation is called before calling init() function, return the default configuration statically defined, When this operation is called after calling init() function, return the initialized configuration according to the command line arguments, the environment variables etc. (Not implemented)

Returns:
Manager's configuration information
void RTC::ManagerConfig::init ( int  argc,
char **  argv 
)

Initialization.

Initialize with command line options. The following command options are available.

  • -f file : Specify the configuration file.
  • -l module : Specify modules to be loaded. (Not implemented)
  • -o options: Specify other options. (Not implemented)
  • -d : Use default static configuration. (Not implemented)
Parameters:
argc Number of command line arguments
argv The command line arguments
void RTC::ManagerConfig::parseArgs ( int  argc,
char **  argv 
) [protected]

Parse the command arguments.

  • -f file : Specify the configuration file.
  • -l module : Specify modules to be loaded. (Not implemented)
  • -o options: Other options. (Not implemented)
  • -d : Use default static configuration. (Not implemented)
Parameters:
argc Number of command line arguments
argv The command line arguments
void RTC::ManagerConfig::setSystemInformation ( coil::Properties &  prop  )  [protected]

Set system information.

Get the following system info. and set them to Manager's properties.

  • manager.os.name : OS name
  • manager.os.release : OS release name
  • manager.os.version : OS version
  • manager.os.arch : OS architecture
  • manager.os.hostname: Hostname
  • manager.pid : process ID
Parameters:
prop Properties to set system information

Member Data Documentation

The environment variable to distinguish the default configuration file path.

const char* RTC::ManagerConfig::config_file_path[] [static]

The default configuration file path for manager.

coil::Properties RTC::ManagerConfig::m_argprop [protected]

configuration properties from arguments

std::string RTC::ManagerConfig::m_configFile [protected]

Manager's configuration file path.

Manager master flag.

true:master,false:slave

Generated on Fri Mar 11 00:00:59 2011 for OpenRTM by  doxygen 1.6.3