Manager configuration class.
More...
#include <ManagerConfig.h>
|
| ManagerConfig () |
| Constructor.
|
|
| ManagerConfig (int argc, char **argv) |
| Constructor.
|
|
virtual | ~ManagerConfig () |
| 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 const char *const | 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 .
|
|
|
void | parseArgs (int argc, char **argv) |
| Parse the command arguments.
|
|
bool | findConfigFile () |
| Find the configuration file.
|
|
|
static void | setSystemInformation (coil::Properties &prop) |
| Set system information.
|
|
static bool | fileExist (const std::string &filename) |
| Check the file existence.
|
|
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:
- UNIX/Linux
-
Command option "-f"
-
Environment variable "RTC_MANAGER_CONFIG"
-
Default configuration file "./rtc.conf"
-
Default configuration file "/etc/rtc.conf"
-
Default configuration file "/etc/rtc/rtc.conf"
-
Default configuration file "/usr/local/etc/rtc.conf"
-
Default configuration file "/usr/local/etc/rtc/rtc.conf"
-
Embedded configuration value
- Windows
-
Command option "-f"
-
Environment variable "RTC_MANAGER_CONFIG"
-
Default configuration file "./rtc.conf"
-
Default configuration file "%RTM_ROOT%/%RTM_VC_VERSION%/rtc.conf"
- Since
- 0.4.0
◆ ManagerConfig() [1/2]
RTC::ManagerConfig::ManagerConfig |
( |
| ) |
|
Constructor.
Constructor (Do nothing)
◆ ManagerConfig() [2/2]
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 |
◆ ~ManagerConfig()
virtual RTC::ManagerConfig::~ManagerConfig |
( |
| ) |
|
|
virtual |
◆ configure()
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 |
◆ fileExist()
static bool RTC::ManagerConfig::fileExist |
( |
const std::string & | filename | ) |
|
|
staticprotected |
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.)
◆ findConfigFile()
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
◆ getConfig()
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
◆ init()
void RTC::ManagerConfig::init |
( |
int | argc, |
|
|
char ** | argv ) |
Initialization.
Initialize with command line options. The following command options are available.
- -a : Disable manager service
- -f <file name> : Specify a configuration file
- -o <option> ; Specify options
- -p <port number>: Specify a port number
- -d : Run as the master manager
- Parameters
-
argc | Number of command line arguments |
argv | The command line arguments |
◆ parseArgs()
void RTC::ManagerConfig::parseArgs |
( |
int | argc, |
|
|
char ** | argv ) |
|
protected |
Parse the command arguments.
- -a : Disable manager service
- -f <file name> : Specify a configuration file
- -o <option> ; Specify options
- -p <port number>: Specify a port number
- -d : Run as the master manager
- Parameters
-
argc | Number of command line arguments |
argv | The command line arguments |
◆ setSystemInformation()
static void RTC::ManagerConfig::setSystemInformation |
( |
coil::Properties & | prop | ) |
|
|
staticprotected |
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
-
prop | Properties to set system information |
◆ config_file_env
const char* RTC::ManagerConfig::config_file_env |
|
static |
The environment variable to distinguish the default configuration file path .
◆ config_file_path
const char* const RTC::ManagerConfig::config_file_path[] |
|
static |
The default configuration file path for manager .
◆ m_argprop
coil::Properties RTC::ManagerConfig::m_argprop |
|
protected |
configuration properties from arguments
◆ m_configFile
std::string RTC::ManagerConfig::m_configFile |
|
protected |
Manager's configuration file path .
◆ m_isMaster
bool RTC::ManagerConfig::m_isMaster {false} |
|
protected |
Manager master flag.
true:master,false:slave
The documentation for this class was generated from the following file: