Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
gnsstk::ConfDataWriter Class Reference

Detailed Description

This is a class to write configuration data files.

A typical way to use this class follows:

// Declare a ConfDataReader object
ConfDataWriter confWriter;
// Open and parse configuration file
confWriter.open("configuration.txt");
confWriter.writeVariable(cutOffElevation,
10.0,
"minimum allowed satellite elevation",
"in degrees");

The configuration file follows the following format:

Definition at line 99 of file ConfDataWriter.hpp.

#include <ConfDataWriter.hpp>

Inheritance diagram for gnsstk::ConfDataWriter:
Inheritance graph
[legend]

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="")
 
- Public Member Functions inherited from gnsstk::FFTextStream
 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...
 
- Public Member Functions inherited from gnsstk::FFStream
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...
 
- Protected Member Functions inherited from gnsstk::FFTextStream
virtual void tryFFStreamGet (FFData &rec)
 
virtual void tryFFStreamPut (const FFData &rec)
 

Protected Attributes

int valuePrecison
 
int variableWidth
 

Additional Inherited Members

- Static Public Member Functions inherited from gnsstk::FFStream
static bool isFFStream (std::istream &i)
 Check if the input stream is the kind of RinexObsStream. More...
 
- Public Attributes inherited from gnsstk::FFTextStream
unsigned int lineNumber
 
- Public Attributes inherited from gnsstk::FFStream
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...
 

Constructor & Destructor Documentation

◆ ConfDataWriter() [1/3]

gnsstk::ConfDataWriter::ConfDataWriter ( )
inline

Default constructor.

Definition at line 104 of file ConfDataWriter.hpp.

◆ ConfDataWriter() [2/3]

gnsstk::ConfDataWriter::ConfDataWriter ( const char *  file)
inline

Common constructor. It will always open 'file' for read and will configuration data in one pass.

Parameters
fileConfiguration data file to read

Definition at line 113 of file ConfDataWriter.hpp.

◆ ConfDataWriter() [3/3]

gnsstk::ConfDataWriter::ConfDataWriter ( const std::string &  file)
inline

Common constructor. It will always open 'fn' for read and will configuration data in one pass.

Parameters
fileConfiguration data file to read

Definition at line 124 of file ConfDataWriter.hpp.

Member Function Documentation

◆ formattedPutLine()

void gnsstk::ConfDataWriter::formattedPutLine ( const std::string &  sline)
protected

Write a string line to the file.

Definition at line 296 of file ConfDataWriter.cpp.

◆ open() [1/2]

void gnsstk::ConfDataWriter::open ( const char *  fn)
virtual

Method to open a configuration data file to be written.

Definition at line 52 of file ConfDataWriter.cpp.

◆ open() [2/2]

virtual void gnsstk::ConfDataWriter::open ( const std::string &  fn)
inlinevirtual

Method to open a configuration data file to be written.

Definition at line 135 of file ConfDataWriter.hpp.

◆ setValuePrecision()

void gnsstk::ConfDataWriter::setValuePrecision ( const int  precision = 6)
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.

◆ setVariableWidth()

void gnsstk::ConfDataWriter::setVariableWidth ( const int  width = 0)
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.

◆ writeBlankLine()

void gnsstk::ConfDataWriter::writeBlankLine ( const int &  n = 1)

Write several blank lines default write one line.

Definition at line 92 of file ConfDataWriter.cpp.

◆ writeCommentLine()

void gnsstk::ConfDataWriter::writeCommentLine ( const std::string &  comment)

Write a comment line start by '#'.

Definition at line 76 of file ConfDataWriter.cpp.

◆ writeEnd()

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.

◆ writeHeader()

void gnsstk::ConfDataWriter::writeHeader ( )
virtual

Write a common header for all of the configuration data files written by this class.

Definition at line 62 of file ConfDataWriter.cpp.

◆ writeSection()

void gnsstk::ConfDataWriter::writeSection ( const std::string &  name,
const std::string &  comment = "" 
)

Write a new section with some comment

Parameters
namename of the section to be written
commentcomment of the section to be written

Definition at line 264 of file ConfDataWriter.cpp.

◆ writeSeparatorLine()

void gnsstk::ConfDataWriter::writeSeparatorLine ( const std::string &  s = "-",
const int &  n = 130 
)

Write a comment line as a separator line

Parameters
schar of the separator line
nsize of the separator line

Definition at line 85 of file ConfDataWriter.cpp.

◆ writeVariable() [1/3]

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

Parameters
varvariable name
valvariable value
varCommentvariable comment
valCommentvalue comment

Definition at line 134 of file ConfDataWriter.cpp.

◆ writeVariable() [2/3]

void gnsstk::ConfDataWriter::writeVariable ( const std::string &  var,
const int &  val,
const std::string &  varComment = "",
const std::string &  valComment = "" 
)
inline

Write a integer variable with general format

Parameters
varvariable name
valvariable value
varCommentvariable comment
valCommentvalue comment

Definition at line 175 of file ConfDataWriter.hpp.

◆ writeVariable() [3/3]

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

Parameters
varvariable name
valvariable value
varCommentvariable comment
valCommentvalue comment

Definition at line 108 of file ConfDataWriter.cpp.

◆ writeVariableList() [1/4]

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

Parameters
varvariable name
valListvariable list values
nsize of the variable list
varCommentvariable comment
valCommentvalue comment

Definition at line 243 of file ConfDataWriter.cpp.

◆ writeVariableList() [2/4]

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

Parameters
varvariable name
valListvariable list values
nsize of the variable list
varCommentvariable comment
valCommentvalue comment

Definition at line 220 of file ConfDataWriter.cpp.

◆ writeVariableList() [3/4]

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

Parameters
varvariable name
valListvariable list values
nsize of the variable list
varCommentvariable comment
valCommentvalue comment

Definition at line 153 of file ConfDataWriter.cpp.

◆ writeVariableList() [4/4]

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

Parameters
varvariable name
valListvariable list values by std::vector
varCommentvariable comment
valCommentvalue comment

Definition at line 184 of file ConfDataWriter.cpp.

Member Data Documentation

◆ valuePrecison

int gnsstk::ConfDataWriter::valuePrecison
protected

Definition at line 283 of file ConfDataWriter.hpp.

◆ variableWidth

int gnsstk::ConfDataWriter::variableWidth
protected

Definition at line 281 of file ConfDataWriter.hpp.


The documentation for this class was generated from the following files:
gnsstk::ConfDataWriter::ConfDataWriter
ConfDataWriter()
Default constructor.
Definition: ConfDataWriter.hpp:104


gnsstk
Author(s):
autogenerated on Wed Oct 25 2023 02:40:44