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

RtcConfig.h

説明を見る。
00001 // -*- C++ -*-
00021 #ifndef RtcConfig_h
00022 #define RtcConfig_h
00023 
00024 #include <string>
00025 #include <map>
00026 #include <vector>
00027 #include <list>
00028 #include <fstream>
00029 #include "rtm/RTC.h"
00030 
00031 
00032 namespace RTM
00033 {
00034   
00035   using namespace std;
00036   
00037 #ifdef ORB_IS_OMNIORB
00038   static const char* config_map[][3] = 
00039         {{"IIOPAddrPort", "-ORBendPoint", "giop:tcp:"},
00040          {"", "", ""},
00041          {"NameServer", "-ORBInitRef", "NameService=corbaname::"},
00042          {0,0,0}};
00043 #endif // omniORB
00044   
00045 #ifdef ORB_IS_MICO
00046   static const char* config_map[][3] = 
00047         {{"NameServer", "-ORBNamingAddr", ""},
00048          {"IIOPAddrPort", "-ORBIIOPAddr", "inet:"},
00049          {"", "", ""},
00050          {0,0,0}};
00051 #endif // MICO
00052   
00053   static const char* config_file_path[] = 
00054         {"./rtc.conf",
00055          "/etc/rtc.conf",
00056          "/etc/rtc/rtc.conf",
00057          "/usr/local/etc/rtc.conf",
00058          NULL};
00059   
00060   static const char* config_file_env = "RTC_CONFIG";
00061 
00083   class RtcConfig
00084   {
00085   public:
00101         RtcConfig(): m_DebugMode(false){};
00102 
00124         RtcConfig(int argc, char** argv);
00125 
00137         virtual ~RtcConfig();
00138         
00160         bool initConfig(int argc, char** argv);
00161         
00179         char** getOrbInitArgv() const
00180         {
00181           //      for (int i = 0; i < m_Argc; i++) cerr << m_Argv[i] << endl;
00182           return m_Argv;
00183         };
00184         
00200         int getOrbInitArgc() const {return m_Argc;};
00201         
00217         string getNameServer() const {return m_NameServer;};
00218         
00235         list<string>& getComponentLoadPath() {return m_ComponentLoadPath;};
00236         
00244         string getBinName() const {return m_BinName;};
00245         
00253         string getOSname() const {return m_OSname;};
00254         
00262         string getHostname() const {return m_Hostname;};
00263         
00271         string getOSrelease() const {return m_OSrelease;};
00272         
00280         string getOSversion() const {return m_OSversion;};
00281         
00289         string getArch() const {return m_Arch;};
00290         
00298         string getPid() const {return m_Pid;};
00299 
00300         string getLogFileName();
00301         string getErrorLogFileName();
00302         int getLogLevel();
00303         int getLogLock();
00304         std::string getLogTimeFormat();
00305         
00306   protected:
00314         bool parseCommandArgs(int argc, char** argv);
00315         
00323         bool findConfigFile();
00324         
00332         bool parseConfigFile();
00333         
00341         bool collectSysInfo();
00342         
00350         void printUsage(char* arg);
00351         
00359         void argsToArgv();
00360 
00368         bool fileExist(const char *filename);
00376         bool split(const string& input, const string& delimiter, list<string>& results);
00377   private:
00385         string m_BinName;
00386         string m_ArgConfigFile;
00387         string m_ConfigFile;
00388         map<string, string> m_Config;
00389         vector<string> m_Args;
00390         char** m_Argv;
00391         int m_Argc;
00392         string m_NameServer;
00393         std::list<string> m_ComponentLoadPath;
00394         string m_OSname;
00395         string m_Hostname;
00396         string m_OSrelease;
00397         string m_OSversion;
00398         string m_Arch;
00399         string m_Pid;
00400         bool m_DebugMode;
00401   };
00402   
00403 }; // end of namespace RTM
00404 
00405 #endif // end of __RtcConfig_h__

OpenRTMに対してWed Apr 6 14:22:11 2005に生成されました。 doxygen 1.3.6