00001 #pragma ident "$Id: ConfDataWriter.hpp 2549 2011-04-11 08:49:50Z yanweignss $"
00002
00008 #ifndef GPSTK_CONFDATA_WRITER_HPP
00009 #define GPSTK_CONFDATA_WRITER_HPP
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035 #include <string>
00036 #include <map>
00037 #include "FFTextStream.hpp"
00038 #include "StringUtils.hpp"
00039
00040 using namespace std;
00041
00042 namespace gpstk
00043 {
00044
00045
00048
00088 class ConfDataWriter:public FFTextStream
00089 {
00090 public:
00091
00093 ConfDataWriter()
00094 { setVariableWidth(); setValuePrecision();}
00095
00102 ConfDataWriter(const char* file)
00103 : FFTextStream(file, std::ios::out)
00104 { writeHeader(); };
00105
00106
00113 ConfDataWriter(const string& file)
00114 : FFTextStream(file.c_str(), std::ios::out)
00115 { writeHeader(); };
00116
00117
00119 virtual void open(const char* fn);
00120
00121
00123 virtual void open(const string& fn)
00124 { open( fn.c_str() ); };
00125
00126
00129 virtual void writeHeader();
00130
00132 void writeCommentLine(const string& comment);
00133
00137 void writeSeparatorLine(const string& s = "-",
00138 const int& n = 130);
00139
00141 void writeBlankLine(const int& n=1);
00142
00150 void writeVariable(const string& var,
00151 const string& val,
00152 const string& varComment = "",
00153 const string& valComment = "");
00154
00155
00163 void writeVariable(const string& var,
00164 const int& val,
00165 const string& varComment = "",
00166 const string& valComment = "")
00167 { writeVariable(var,StringUtils::asString(val),varComment,valComment);}
00168
00169
00177 void writeVariable(const string& var,
00178 const double& val,
00179 const string& varComment = "",
00180 const string& valComment = "");
00181
00182
00183
00192 void writeVariableList(const string& var,
00193 const string valList[],
00194 const int& n,
00195 const string& varComment = "",
00196 const string& valComment = "");
00197
00198
00206 void writeVariableList(const string& var,
00207 vector<string> valList,
00208 const string& varComment = "",
00209 const string& valComment = "");
00210
00211
00220 void writeVariableList(const string& var,
00221 const int valList[],
00222 const int& n,
00223 const string& varComment = "",
00224 const string& valComment = "");
00225
00226
00235 void writeVariableList(const string& var,
00236 const double valList[],
00237 const int& n,
00238 const string& varComment = "",
00239 const string& valComment = "");
00240
00241
00247 void writeSection(const string& name,
00248 const string& comment = "");
00249
00252 void writeEnd();
00253
00256 void setVariableWidth(const int width = 0)
00257 { variableWidth = width;}
00258
00261 void setValuePrecision(const int precision = 6)
00262 { valuePrecison = precision;}
00263
00264 protected:
00265
00267 void formattedPutLine(const string& sline);
00268
00269 int variableWidth;
00270
00271 int valuePrecison;
00272
00273 };
00274
00276
00277 }
00278
00279
00280
00281 #endif // GPSTK_CONFDATA_WRITER_HPP