src/Env/Env.h

説明を見る。
00001 // 
00002 // Copyright (c) 2005-2008 Kenichi Watanabe.
00003 // Copyright (c) 2005-2008 Yasuhiro Watari.
00004 // Copyright (c) 2005-2008 Hironori Ichibayashi.
00005 // Copyright (c) 2008-2009 Kazuo Horio.
00006 // Copyright (c) 2009-2013 Naruki Kurata.
00007 // Copyright (c) 2005-2013 Ryota Shioya.
00008 // Copyright (c) 2005-2013 Masahiro Goshima.
00009 // 
00010 // This software is provided 'as-is', without any express or implied
00011 // warranty. In no event will the authors be held liable for any damages
00012 // arising from the use of this software.
00013 // 
00014 // Permission is granted to anyone to use this software for any purpose,
00015 // including commercial applications, and to alter it and redistribute it
00016 // freely, subject to the following restrictions:
00017 // 
00018 // 1. The origin of this software must not be misrepresented; you must not
00019 // claim that you wrote the original software. If you use this software
00020 // in a product, an acknowledgment in the product documentation would be
00021 // appreciated but is not required.
00022 // 
00023 // 2. Altered source versions must be plainly marked as such, and must not be
00024 // misrepresented as being the original software.
00025 // 
00026 // 3. This notice may not be removed or altered from any source
00027 // distribution.
00028 // 
00029 // 
00030 
00031 
00032 //
00033 // Simulator system environment
00034 // 
00035 //
00036 
00037 #ifndef __ONIKIRI_ENV_H
00038 #define __ONIKIRI_ENV_H
00039 
00040 #include "Utility/String.h"
00041 #include "Env/Param/ParamExchange.h"
00042 
00043 namespace Onikiri
00044 {
00045 
00046     class Environment : public ParamExchange
00047     {
00048         std::vector<String> m_cmdLineArgs;
00049         std::vector<String> m_cfgXmlFiles;
00050         String m_startupPath;
00051 
00052         u64 m_execBeginTime;
00053         u64 m_execPeriod;
00054         String m_versionString;
00055         String m_sessionName;
00056         String m_errorMsg;
00057         bool m_error;
00058         bool m_dumpSuccess;
00059 
00060         void BeginExec();
00061         void EndExec();
00062         void DumpResult();
00063 
00064         class Path : public ParamExchangeChild
00065         {
00066             String m_execFilePath;
00067             String m_startupPath;
00068 
00069             String m_path;
00070             bool m_useXMLFile;
00071             bool m_useSimulatorExecFile;
00072         public:
00073         
00074             BEGIN_PARAM_MAP("")
00075                 PARAM_ENTRY( "@Path", m_path )
00076                 PARAM_ENTRY( "@UseXMLFilePath", m_useXMLFile )
00077                 PARAM_ENTRY( "@UseSimulatorExecFilePath", m_useSimulatorExecFile )
00078             END_PARAM_MAP()
00079 
00080             Path();
00081             String Get();
00082             void Initialize( Environment& env );
00083         };
00084         Path m_hostWorkPath;
00085         String m_outputXMLFileName;
00086         String m_outputXMLLevel;
00087         String m_outputXMLFilter;
00088 
00089         bool m_outputPrintToSTDOUT;
00090         String m_outputPrintFileName;
00091         std::ofstream m_outputPrintStream;
00092 
00093         bool m_suppressInternalMessage;
00094         bool m_suppressWarning;
00095         bool m_paramDBInitialized;
00096     public:
00097         BEGIN_PARAM_MAP("/Session/")
00098             PARAM_ENTRY("@Name", m_sessionName)
00099             PARAM_ENTRY("Result/@ExecutionPeriod", m_execPeriod)
00100             PARAM_ENTRY("Result/@VersionNumber", m_versionString)
00101             PARAM_ENTRY("Result/@Error", m_error)
00102             PARAM_ENTRY("Environment/OutputXML/@FileName", m_outputXMLFileName)
00103             PARAM_ENTRY("Environment/OutputXML/@Level", m_outputXMLLevel)
00104             PARAM_ENTRY("Environment/OutputXML/@Filter", m_outputXMLFilter)
00105             PARAM_ENTRY("Environment/Print/@FileName", m_outputPrintFileName)
00106             PARAM_ENTRY("Environment/Print/@SuppressInternalMessage", m_suppressInternalMessage)
00107             PARAM_ENTRY("Environment/Print/@SuppressWarningMessage", m_suppressWarning)
00108             CHAIN_PARAM_MAP("Environment/HostWorkPath/", m_hostWorkPath)
00109         END_PARAM_MAP()
00110 
00111         Environment();
00112         ~Environment();
00113         void Initialize(int argc, char* argv[], const std::vector<String>& defaultParams = std::vector<String>());
00114         void Finalize();
00115 
00116         void Print(const std::string& str);
00117         void Print(const char* str, ...);
00118         void PrintInternal(const char* str, ...);
00119 
00120         void SetError( bool error, const std::string& msg );
00121         void SetWarning(bool warning);
00122         bool IsDumpSuccess();
00123         void PrintFatalErrorXML();
00124 
00125         const std::vector<String>& GetCmdLineArgs();
00126         const std::vector<String>& GetCfgXmlFiles();
00127         String GetStartupPath();
00128         String GetHostWorkPath();
00129 
00130         bool IsSuppressedInternalMessage();
00131     };
00132 
00133     extern Environment g_env;
00134 
00135 } // namespace Onikiri
00136 
00137 #endif
00138 

Onikiri2に対してTue Jun 18 14:34:20 2013に生成されました。  doxygen 1.4.7