Manager configuration クラス
[詳解]
#include <ManagerConfig.h>
Manager configuration クラス
Manager のコンフィギュレーションを行う、コマンドライン引数を受け取り、 (あるいは引数なしで)インスタンス化される。 コマンドライン引数で指定された設定ファイル、環境変数などから Manager の プロパティ情報を設定する。
各設定の優先度は以下のとおりである。
- UNIX/Linux
-
コマンドラインオプション "-f"
-
環境変数 "RTC_MANAGER_CONFIG"
-
デフォルト設定ファイル "./rtc.conf"
-
デフォルト設定ファイル "/etc/rtc.conf"
-
デフォルト設定ファイル "/etc/rtc/rtc.conf"
-
デフォルト設定ファイル "/usr/local/etc/rtc.conf"
-
デフォルト設定ファイル "/usr/local/etc/rtc/rtc.conf"
-
埋め込みコンフィギュレーション値
- Windows
-
コマンドラインオプション "-f"
-
環境変数 "RTC_MANAGER_CONFIG"
-
デフォルト設定ファイル "./rtc.conf"
-
デフォルト設定ファイル "%RTM_ROOT%/%RTM_VC_VERSION%/rtc.conf"
- から
- 0.4.0
◆ ManagerConfig() [1/2]
RTC::ManagerConfig::ManagerConfig |
( |
| ) |
|
◆ ManagerConfig() [2/2]
RTC::ManagerConfig::ManagerConfig |
( |
int |
argc, |
|
|
char ** |
argv |
|
) |
| |
コンストラクタ
与えられた引数によりコンフィギュレーション情報の初期化を行う。
- 引数
-
argc | コマンドライン引数の数 |
argv | コマンドライン引数 |
◆ ~ManagerConfig()
virtual RTC::ManagerConfig::~ManagerConfig |
( |
| ) |
|
|
virtual |
◆ configure()
void RTC::ManagerConfig::configure |
( |
coil::Properties & |
prop | ) |
|
Configuration 情報を Property に設定する
◆ fileExist()
static bool RTC::ManagerConfig::fileExist |
( |
const std::string & |
filename | ) |
|
|
staticprotected |
◆ findConfigFile()
bool RTC::ManagerConfig::findConfigFile |
( |
| ) |
|
|
protected |
Configuration file の検索
Configuration file を検索し、設定する。 既に Configuration file が設定済みの場合は、ファイルの存在確認を行う。
Configuration file の優先順位
コマンドオプション指定>環境変数>デフォルトファイル>デフォルト設定
デフォルト強制オプション(-d): デフォルトファイルがあっても無視して デフォルト設定を使う
- 戻り値
- Configuration file 検索結果
◆ getConfig()
coil::Properties RTC::ManagerConfig::getConfig |
( |
| ) |
const |
コンフィギュレーションを取得する
コンフィギュレーションを取得する。init()呼び出し前に呼ぶと、 静的に定義されたデフォルトのコンフィギュレーションを返す。 init() 呼び出し後に呼ぶと、コマンドライン引数、環境変数等に 基づいた初期化されたコンフィギュレーションを返す。 (未実装)
- 戻り値
- Manager のコンフィギュレーション情報
◆ init()
void RTC::ManagerConfig::init |
( |
int |
argc, |
|
|
char ** |
argv |
|
) |
| |
初期化
コマンドライン引数に応じて初期化を実行する。コマンドラインオプションは 以下のものが使用可能である。
- -a : マネージャサービスOFF
- -f <file name> : 設定ファイルの指定
- -o <option> ; オプション指定
- -p <port number>: ポート番号指定
- -d : マスターマネージャ指定
- 引数
-
argc | コマンドライン引数の数 |
argv | コマンドライン引数 |
◆ parseArgs()
void RTC::ManagerConfig::parseArgs |
( |
int |
argc, |
|
|
char ** |
argv |
|
) |
| |
|
protected |
コマンド引数をパースする
- -a : マネージャサービスOFF
- -f <file name> : 設定ファイルの指定
- -o <option> ; オプション指定
- -p <port number>: ポート番号指定
- -d : マスターマネージャ指定
- 引数
-
argc | コマンドライン引数の数 |
argv | コマンドライン引数 |
◆ setSystemInformation()
static void RTC::ManagerConfig::setSystemInformation |
( |
coil::Properties & |
prop | ) |
|
|
staticprotected |
システム情報を設定する
システム情報を取得しプロパティにセットする。設定されるキーは以下の通り。
- os.name : OS名
- os.release : OSリリース名
- os.version : OSバージョン名
- os.arch : OSアーキテクチャ
- os.hostname: ホスト名
- manager.pid : プロセスID
- 引数
-
◆ config_file_env
const char* RTC::ManagerConfig::config_file_env |
|
static |
デフォルト・コンフィギュレーションのファイル・パスを識別する 環境変数
◆ config_file_path
const char* const RTC::ManagerConfig::config_file_path[] |
|
static |
◆ m_argprop
coil::Properties RTC::ManagerConfig::m_argprop |
|
protected |
◆ m_configFile
std::string RTC::ManagerConfig::m_configFile |
|
protected |
◆ m_isMaster
bool RTC::ManagerConfig::m_isMaster {false} |
|
protected |
このクラス詳解は次のファイルから抽出されました: