Public Member Functions | Static Public Attributes | Protected Member Functions | Protected Attributes | List of all members
RTC::ManagerConfig Class Reference

Manager configuration class. More...

#include <ManagerConfig.h>

Inheritance diagram for RTC::ManagerConfig:
Inheritance graph
[legend]

Public Member Functions

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

Static Public Attributes

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

Protected Member Functions

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

Protected Attributes

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

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

Definition at line 84 of file ManagerConfig.h.

Constructor & Destructor Documentation

RTC::ManagerConfig::ManagerConfig ( )

Constructor.

Constructor (Do nothing)

Definition at line 52 of file ManagerConfig.cpp.

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

Constructor.

Initialize configuration information by given arguments.

Parameters
argcNumber of command line arguments
argvThe command line arguments

Definition at line 64 of file ManagerConfig.cpp.

RTC::ManagerConfig::~ManagerConfig ( void  )
virtual

Destructor.

Definition at line 77 of file ManagerConfig.cpp.

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
propThe target properties to configure

Definition at line 100 of file ManagerConfig.cpp.

bool RTC::ManagerConfig::fileExist ( const std::string &  filename)
protected

Check the file existence.

Confirm whether the specified file exists

Parameters
filenameThe target confirmation file
Returns
file existance confirmation (True if the file exists.)

Definition at line 264 of file ManagerConfig.cpp.

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

Definition at line 187 of file ManagerConfig.cpp.

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
argcNumber of command line arguments
argvThe command line arguments

Definition at line 88 of file ManagerConfig.cpp.

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
argcNumber of command line arguments
argvThe command line arguments

Definition at line 127 of file ManagerConfig.cpp.

void RTC::ManagerConfig::setSystemInformation ( coil::Properties prop)
protected

Set system information.

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

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

Definition at line 229 of file ManagerConfig.cpp.

Member Data Documentation

const char * RTC::ManagerConfig::config_file_env = "RTC_MANAGER_CONFIG"
static

The environment variable to distinguish the default configuration file path.

Definition at line 107 of file ManagerConfig.h.

const char * RTC::ManagerConfig::config_file_path
static
Initial value:
=
{
"./rtc.conf",
"/etc/rtc.conf",
"/etc/rtc/rtc.conf",
"/usr/local/etc/rtc.conf",
"/usr/local/etc/rtc/rtc.conf",
NULL
}

The default configuration file path for manager.

Definition at line 95 of file ManagerConfig.h.

coil::Properties RTC::ManagerConfig::m_argprop
protected

configuration properties from arguments

Definition at line 376 of file ManagerConfig.h.

std::string RTC::ManagerConfig::m_configFile
protected

Manager's configuration file path.

Definition at line 385 of file ManagerConfig.h.

bool RTC::ManagerConfig::m_isMaster
protected

Manager master flag.

true:master,false:slave

Definition at line 400 of file ManagerConfig.h.


The documentation for this class was generated from the following files:


openrtm_aist
Author(s): Noriaki Ando
autogenerated on Thu Jun 6 2019 19:26:04