This is a class to write configuration data files.
A typical way to use this class follows:
The configuration file follows the following format:
Definition at line 99 of file ConfDataWriter.hpp.
#include <ConfDataWriter.hpp>
Public Member Functions | |
ConfDataWriter () | |
Default constructor. More... | |
ConfDataWriter (const char *file) | |
ConfDataWriter (const std::string &file) | |
virtual void | open (const char *fn) |
Method to open a configuration data file to be written. More... | |
virtual void | open (const std::string &fn) |
Method to open a configuration data file to be written. More... | |
void | setValuePrecision (const int precision=6) |
void | setVariableWidth (const int width=0) |
void | writeBlankLine (const int &n=1) |
Write several blank lines default write one line. More... | |
void | writeCommentLine (const std::string &comment) |
Write a comment line start by '#'. More... | |
void | writeEnd () |
virtual void | writeHeader () |
void | writeSection (const std::string &name, const std::string &comment="") |
void | writeSeparatorLine (const std::string &s="-", const int &n=130) |
void | writeVariable (const std::string &var, const double &val, const std::string &varComment="", const std::string &valComment="") |
void | writeVariable (const std::string &var, const int &val, const std::string &varComment="", const std::string &valComment="") |
void | writeVariable (const std::string &var, const std::string &val, const std::string &varComment="", const std::string &valComment="") |
void | writeVariableList (const std::string &var, const double valList[], const int &n, const std::string &varComment="", const std::string &valComment="") |
void | writeVariableList (const std::string &var, const int valList[], const int &n, const std::string &varComment="", const std::string &valComment="") |
void | writeVariableList (const std::string &var, const std::string valList[], const int &n, const std::string &varComment="", const std::string &valComment="") |
void | writeVariableList (const std::string &var, std::vector< std::string > valList, const std::string &varComment="", const std::string &valComment="") |
![]() | |
FFTextStream () | |
Default constructor. More... | |
FFTextStream (const char *fn, std::ios::openmode mode=std::ios::in) | |
FFTextStream (const std::string &fn, std::ios::openmode mode=std::ios::in) | |
void | formattedGetLine (std::string &line, const bool expectEOF=false) |
virtual void | open (const char *fn, std::ios::openmode mode) |
Overrides open to reset the line number. More... | |
virtual void | open (const std::string &fn, std::ios::openmode mode) |
Overrides open to reset the line number. More... | |
virtual | ~FFTextStream () |
Destructor. More... | |
![]() | |
void | conditionalThrow (void) |
void | dumpState (std::ostream &s=std::cout) const |
A function to help debug FFStreams. More... | |
FFStream () | |
Default constructor, initialize internal data. More... | |
FFStream (const char *fn, std::ios::openmode mode=std::ios::in) | |
FFStream (const std::string &fn, std::ios::openmode mode=std::ios::in) | |
virtual | ~FFStream () |
Virtual destructor, close the stream etc. More... | |
Protected Member Functions | |
void | formattedPutLine (const std::string &sline) |
Write a string line to the file. More... | |
![]() | |
virtual void | tryFFStreamGet (FFData &rec) |
virtual void | tryFFStreamPut (const FFData &rec) |
Protected Attributes | |
int | valuePrecison |
int | variableWidth |
Additional Inherited Members | |
![]() | |
static bool | isFFStream (std::istream &i) |
Check if the input stream is the kind of RinexObsStream. More... | |
![]() | |
unsigned int | lineNumber |
![]() | |
std::string | filename |
file name More... | |
FFStreamError | mostRecentException |
This stores the most recently thrown exception. More... | |
unsigned int | recordNumber |
keeps track of the number of records read More... | |
|
inline |
Default constructor.
Definition at line 104 of file ConfDataWriter.hpp.
|
inline |
Common constructor. It will always open 'file' for read and will configuration data in one pass.
file | Configuration data file to read |
Definition at line 113 of file ConfDataWriter.hpp.
|
inline |
Common constructor. It will always open 'fn' for read and will configuration data in one pass.
file | Configuration data file to read |
Definition at line 124 of file ConfDataWriter.hpp.
|
protected |
Write a string line to the file.
Definition at line 296 of file ConfDataWriter.cpp.
|
virtual |
Method to open a configuration data file to be written.
Definition at line 52 of file ConfDataWriter.cpp.
|
inlinevirtual |
Method to open a configuration data file to be written.
Definition at line 135 of file ConfDataWriter.hpp.
|
inline |
Method to set the precision of double variable's value to make the output looks the output looks more neat and beauty.
Definition at line 273 of file ConfDataWriter.hpp.
|
inline |
Method to set the variable name with to make the output looks more neat and beauty.
Definition at line 268 of file ConfDataWriter.hpp.
void gnsstk::ConfDataWriter::writeBlankLine | ( | const int & | n = 1 | ) |
Write several blank lines default write one line.
Definition at line 92 of file ConfDataWriter.cpp.
void gnsstk::ConfDataWriter::writeCommentLine | ( | const std::string & | comment | ) |
Write a comment line start by '#'.
Definition at line 76 of file ConfDataWriter.cpp.
void gnsstk::ConfDataWriter::writeEnd | ( | ) |
Write a common tailer for all of the configuration data files written by this class.
Definition at line 285 of file ConfDataWriter.cpp.
|
virtual |
Write a common header for all of the configuration data files written by this class.
Definition at line 62 of file ConfDataWriter.cpp.
void gnsstk::ConfDataWriter::writeSection | ( | const std::string & | name, |
const std::string & | comment = "" |
||
) |
Write a new section with some comment
name | name of the section to be written |
comment | comment of the section to be written |
Definition at line 264 of file ConfDataWriter.cpp.
void gnsstk::ConfDataWriter::writeSeparatorLine | ( | const std::string & | s = "-" , |
const int & | n = 130 |
||
) |
Write a comment line as a separator line
s | char of the separator line |
n | size of the separator line |
Definition at line 85 of file ConfDataWriter.cpp.
void gnsstk::ConfDataWriter::writeVariable | ( | const std::string & | var, |
const double & | val, | ||
const std::string & | varComment = "" , |
||
const std::string & | valComment = "" |
||
) |
Write a double variable with general format
var | variable name |
val | variable value |
varComment | variable comment |
valComment | value comment |
Definition at line 134 of file ConfDataWriter.cpp.
|
inline |
Write a integer variable with general format
var | variable name |
val | variable value |
varComment | variable comment |
valComment | value comment |
Definition at line 175 of file ConfDataWriter.hpp.
void gnsstk::ConfDataWriter::writeVariable | ( | const std::string & | var, |
const std::string & | val, | ||
const std::string & | varComment = "" , |
||
const std::string & | valComment = "" |
||
) |
Write a string variable with general format
var | variable name |
val | variable value |
varComment | variable comment |
valComment | value comment |
Definition at line 108 of file ConfDataWriter.cpp.
void gnsstk::ConfDataWriter::writeVariableList | ( | const std::string & | var, |
const double | valList[], | ||
const int & | n, | ||
const std::string & | varComment = "" , |
||
const std::string & | valComment = "" |
||
) |
Write a double variable list with general format
var | variable name |
valList | variable list values |
n | size of the variable list |
varComment | variable comment |
valComment | value comment |
Definition at line 243 of file ConfDataWriter.cpp.
void gnsstk::ConfDataWriter::writeVariableList | ( | const std::string & | var, |
const int | valList[], | ||
const int & | n, | ||
const std::string & | varComment = "" , |
||
const std::string & | valComment = "" |
||
) |
Write a int variable list with general format
var | variable name |
valList | variable list values |
n | size of the variable list |
varComment | variable comment |
valComment | value comment |
Definition at line 220 of file ConfDataWriter.cpp.
void gnsstk::ConfDataWriter::writeVariableList | ( | const std::string & | var, |
const std::string | valList[], | ||
const int & | n, | ||
const std::string & | varComment = "" , |
||
const std::string & | valComment = "" |
||
) |
Write a string variable list with general format
var | variable name |
valList | variable list values |
n | size of the variable list |
varComment | variable comment |
valComment | value comment |
Definition at line 153 of file ConfDataWriter.cpp.
void gnsstk::ConfDataWriter::writeVariableList | ( | const std::string & | var, |
std::vector< std::string > | valList, | ||
const std::string & | varComment = "" , |
||
const std::string & | valComment = "" |
||
) |
Write a string variable list with general format
var | variable name |
valList | variable list values by std::vector |
varComment | variable comment |
valComment | value comment |
Definition at line 184 of file ConfDataWriter.cpp.
|
protected |
Definition at line 283 of file ConfDataWriter.hpp.
|
protected |
Definition at line 281 of file ConfDataWriter.hpp.