メインページ | ネームスペース一覧 | クラス階層 | 構成 | ファイル一覧 | ネームスペースメンバ | 構成メンバ | ファイルメンバ

RtcConfig.h

説明を見る。
00001 // -*- C++ -*-
00019 /*
00020  * $Log: RtcConfig.h,v $
00021  * Revision 1.1.1.1  2005/05/12 09:06:18  n-ando
00022  * Public release.
00023  *
00024  *
00025  */
00026 
00027 #ifndef RtcConfig_h
00028 #define RtcConfig_h
00029 
00030 #include <string>
00031 #include <map>
00032 #include <vector>
00033 #include <list>
00034 #include <fstream>
00035 #include "rtm/RTC.h"
00036 
00037 
00038 namespace RTM
00039 {
00040   
00041   using namespace std;
00042   
00043 #ifdef ORB_IS_OMNIORB
00044   static const char* config_map[][3] = 
00045         {{"IIOPAddrPort", "-ORBendPoint", "giop:tcp:"},
00046          {"", "", ""},
00047          {"NameServer", "-ORBInitRef", "NameService=corbaname::"},
00048          {0,0,0}};
00049 #endif // omniORB
00050   
00051 #ifdef ORB_IS_MICO
00052   static const char* config_map[][3] = 
00053         {{"NameServer", "-ORBNamingAddr", ""},
00054          {"IIOPAddrPort", "-ORBIIOPAddr", "inet:"},
00055          {"", "", ""},
00056          {0,0,0}};
00057 #endif // MICO
00058   
00059   static const char* config_file_path[] = 
00060         {"./rtc.conf",
00061          "/etc/rtc.conf",
00062          "/etc/rtc/rtc.conf",
00063          "/usr/local/etc/rtc.conf",
00064          NULL};
00065   
00066   static const char* config_file_env = "RTC_CONFIG";
00067 
00089   class RtcConfig
00090   {
00091   public:
00107         RtcConfig(): m_DebugMode(false){};
00108 
00130         RtcConfig(int argc, char** argv);
00131 
00143         virtual ~RtcConfig();
00144         
00166         bool initConfig(int argc, char** argv);
00167         
00185         char** getOrbInitArgv() const
00186         {
00187           //      for (int i = 0; i < m_Argc; i++) cerr << m_Argv[i] << endl;
00188           return m_Argv;
00189         };
00190         
00206         int getOrbInitArgc() const {return m_Argc;};
00207         
00223         string getNameServer() const {return m_NameServer;};
00224         
00241         list<string>& getComponentLoadPath() {return m_ComponentLoadPath;};
00242         
00250         string getBinName() const {return m_BinName;};
00251         
00259         string getOSname() const {return m_OSname;};
00260         
00268         string getHostname() const {return m_Hostname;};
00269         
00277         string getOSrelease() const {return m_OSrelease;};
00278         
00286         string getOSversion() const {return m_OSversion;};
00287         
00295         string getArch() const {return m_Arch;};
00296         
00304         string getPid() const {return m_Pid;};
00305 
00306         string getLogFileName();
00307         string getErrorLogFileName();
00308         int getLogLevel();
00309         int getLogLock();
00310         std::string getLogTimeFormat();
00311         
00312   protected:
00320         bool parseCommandArgs(int argc, char** argv);
00321         
00329         bool findConfigFile();
00330         
00338         bool parseConfigFile();
00339         
00347         bool collectSysInfo();
00348         
00356         void printUsage(char* arg);
00357         
00365         void argsToArgv();
00366 
00374         bool fileExist(const char *filename);
00382         bool split(const string& input, const string& delimiter, list<string>& results);
00383   private:
00391         string m_BinName;
00392         string m_ArgConfigFile;
00393         string m_ConfigFile;
00394         map<string, string> m_Config;
00395         vector<string> m_Args;
00396         char** m_Argv;
00397         int m_Argc;
00398         string m_NameServer;
00399         std::list<string> m_ComponentLoadPath;
00400         string m_OSname;
00401         string m_Hostname;
00402         string m_OSrelease;
00403         string m_OSversion;
00404         string m_Arch;
00405         string m_Pid;
00406         bool m_DebugMode;
00407   };
00408   
00409 }; // end of namespace RTM
00410 
00411 #endif // end of __RtcConfig_h__

OpenRTMに対してMon May 23 03:13:42 2005に生成されました。 doxygen 1.3.6