00001
00026 #ifndef GMSH2UGPARAM_HH_
00027 #define GMSH2UGPARAM_HH_
00028
00029 #ifdef HAVE_RLOG
00030
00031 #include <rlog/rlog.h>
00032 #include <rlog/rloglocation.h>
00033 #include <rlog/Error.h>
00034 #include <rlog/RLogChannel.h>
00035 #include <rlog/StdioNode.h>
00036
00037 #include <rlog/RLogTime.h>
00038 #endif // HAVE_RLOG
00039
00040
00041 class FemaxxPost3dparam
00042 {
00043 private:
00044
00045
00047 static bool instanceFlag;
00049 static FemaxxPost3dparam *single;
00051 FemaxxPost3dparam()
00052 {
00053 inputFile_ = "";
00054 outputFile_ = "";
00055 }
00056
00057
00058
00059
00060 std::string inputFile_;
00061 std::string outputFile_;
00062
00063
00064
00069 int notCorrectCommandLineParameterMsg(std::string parameter)
00070 {
00071 #ifdef HAVE_RLOG
00072 rError("Option '%s' is not specified.",parameter.c_str());
00073 #else
00074 std::cout << "Option '" << parameter << "' is not specified."
00075 << std::endl;
00076 #endif // HAVE_RLOG
00077 return OKCODE;
00078 }
00079
00080
00081 public:
00082
00083
00085 static FemaxxPost3dparam* getInstance();
00087 ~FemaxxPost3dparam()
00088 {
00089 instanceFlag = false;
00090 }
00091
00092
00093
00094
00096 int inputFile(std::string inputFile)
00097 {
00098 inputFile_ = inputFile;
00099 return OKCODE;
00100 }
00102 std::string inputFile()
00103 {
00104 return inputFile_;
00105 }
00106
00108 int outputFile(std::string outputFile)
00109 {
00110 outputFile_ = outputFile;
00111 return OKCODE;
00112 }
00114 std::string outputFile()
00115 {
00116 return outputFile_;
00117 }
00118
00119
00120
00121
00123 int showAll()
00124 {
00125 #ifdef HAVE_RLOG
00126 rInfo("===============================================================");
00127 rInfo("Values of all command line options:");
00128 rInfo(" ");
00129 rInfo("Mandatory arguments:");
00130 rInfo("--------------------");
00131 rInfo("input-file = %s", inputFile_.c_str());
00132 rInfo("output-file = %s", outputFile_.c_str());
00133
00134
00135
00136
00137 rInfo("===============================================================");
00138 #else
00139 std::cout << "THIS IS CURRENTLY NOT SUPPORTED" << std::endl;
00140 #endif // HAVE_RLOG
00141
00142 return OKCODE;
00143 }
00144
00145 int checkAll()
00146 {
00147 #ifdef HAVE_RLOG
00148 rInfo("===============================================================");
00149 rInfo("Checking if all command line parameters are correct.");
00150 #else
00151 std::cout
00152 << "==============================================================="
00153 << std::endl
00154 << "Checking if all command line parameters are correct."
00155 << std::endl;
00156 #endif // HAVE_RLOG
00157
00158 bool allCorrect = true;
00159 if (inputFile_ == "")
00160 {
00161 allCorrect = false;
00162 notCorrectCommandLineParameterMsg("input-file");
00163 }
00164 if (outputFile_ == "")
00165 {
00166 allCorrect = false;
00167 notCorrectCommandLineParameterMsg("output-file");
00168 }
00169
00170 #ifdef HAVE_RLOG
00171 rInfo("===============================================================");
00172 #else
00173 std::cout
00174 << "==============================================================="
00175 << std::endl;
00176 #endif // HAVE_RLOG
00177
00178 if (allCorrect== true)
00179 return OKCODE;
00180 else
00181 return ERRORCODE;
00182 }
00183
00184
00185 };
00186
00187 bool FemaxxPost3dparam::instanceFlag = false;
00188 FemaxxPost3dparam* FemaxxPost3dparam::single = NULL;
00189
00190
00191 FemaxxPost3dparam* FemaxxPost3dparam::getInstance()
00192 {
00193 if(! instanceFlag)
00194 {
00195 static FemaxxPost3dparam single;
00196 instanceFlag = true;
00197 return &single;
00198 }
00199 else
00200 {
00201 #ifdef HAVE_RLOG
00202 rError("Error: You can not create a second instance of the");
00203 rError("Emparam class.");
00204 rError("Continue");
00205 #else
00206 std::cerr << "Error: You can not create a second instance of the"
00207 << std::endl
00208 << "Emparam class." << std::endl
00209 << "Only one class per application is allowed." << std::endl
00210 <<"Continue." << std::endl;
00211 #endif // HAVE_RLOG
00212 return single;
00213 }
00214 };
00215
00216
00217 #endif // Gmsh2ugparam_HH_
00218