xmscore
1.0
|
Class for writing ASCII files with named card fields. Also includes the ability to embed non-portable compressed binary for integer and Pt3d arrays. More...
Classes | |
class | Impl |
Implementation for DaStreamWriter. More... | |
Public Member Functions | |
DaStreamWriter (std::ostream &a_outStream, bool a_binaryArrays=false) | |
Constructor. More... | |
~DaStreamWriter () | |
Destructor. | |
bool | IsBinary () const |
Are array values written as binary? More... | |
void | WriteLine (const std::string &a_line) |
Write a given line to a stream. More... | |
void | WriteStringLine (const char *a_name, const std::string &a_val) |
Write a named word line. More... | |
void | WriteIntLine (const char *a_name, int a_val) |
Write a named integer value to a line. More... | |
void | WriteDoubleLine (const char *a_name, double a_val) |
Write a named double line value. More... | |
void | WriteVecInt (const char *a_name, const VecInt &a_vec) |
Write a named vector of integers to several lines. More... | |
void | WriteVecDbl (const char *a_name, const VecDbl &a_vec) |
Write a named vector of doubles to multiple lines. More... | |
void | WriteVecPt3d (const char *a_name, const VecPt3d &a_points) |
Write a named vector of Pt3d to multiple lines. More... | |
void | Write2StringLine (const char *a_name, const std::string &a_val1, const std::string &a_val2) |
Write a named pair of words to a line. More... | |
void | Write3StringLine (const char *a_name, const std::string &a_val1, const std::string &a_val2, const std::string &a_val3) |
Write a named triplet of words to a line. More... | |
void | Write3DoubleLine (const char *a_name, const double &a_val1, const double &a_val2, const double &a_val3) |
Write a named triplet of doubles to a line. More... | |
void | WriteString (const char *a_string) |
Write a string value to the stream. More... | |
void | AppendInt (int a_val) |
Append an integer value to the end of a line of text. More... | |
void | AppendInts (const int *a_vals, int a_numVals) |
Append a list of integer values to the end of a line of text. More... | |
void | AppendString (const std::string &a_val) |
Append a string to the end of a line of text. More... | |
void | EndLine () |
Add return to move to the next line of text. | |
bool | WriteBinaryBytes (const char *a_source, long long a_sourceLength) |
Write binary bytes of a given length to the stream. More... | |
void | SetBinaryBlockSize (int a_blockSize) |
Set the block size to use when writing binary arrays. More... | |
Private Attributes | |
std::unique_ptr< Impl > | m_impl |
Implementation. | |
Class for writing ASCII files with named card fields. Also includes the ability to embed non-portable compressed binary for integer and Pt3d arrays.
Definition at line 79 of file daStreamIo.h.
|
explicit |
Constructor.
a_outStream | The output stream. |
a_binaryArrays | Should binary arrays be written? |
Definition at line 720 of file daStreamIo.cpp.
void xms::DaStreamWriter::AppendInt | ( | int | a_val | ) |
Append an integer value to the end of a line of text.
a_val | The integer value. |
Definition at line 882 of file daStreamIo.cpp.
References m_impl.
Referenced by DaReaderWriterIoUnitTests::testReadWriteLineParts(), and WriteBinaryBytes().
void xms::DaStreamWriter::AppendInts | ( | const int * | a_values, |
int | a_numValues | ||
) |
Append a list of integer values to the end of a line of text.
a_values | A pointer to the integer values. |
a_numValues | The number of integer values. |
Definition at line 891 of file daStreamIo.cpp.
References m_impl.
Referenced by DaReaderWriterIoUnitTests::testReadWriteLineParts().
void xms::DaStreamWriter::AppendString | ( | const std::string & | a_val | ) |
Append a string to the end of a line of text.
a_val | The string to append. |
Definition at line 900 of file daStreamIo.cpp.
References m_impl.
Referenced by DaReaderWriterIoUnitTests::testReadWriteLineParts().
bool xms::DaStreamWriter::IsBinary | ( | ) | const |
Are array values written as binary?
Definition at line 734 of file daStreamIo.cpp.
References m_impl.
Referenced by WriteVecDbl(), WriteVecInt(), and WriteVecPt3d().
void xms::DaStreamWriter::SetBinaryBlockSize | ( | int | a_blockSize | ) |
Set the block size to use when writing binary arrays.
a_blockSize | The block size. |
Definition at line 955 of file daStreamIo.cpp.
References m_impl.
Referenced by DaReaderWriterIoUnitTests::testReadWriteBinaryArrays().
void xms::DaStreamWriter::Write2StringLine | ( | const char * | a_name, |
const std::string & | a_val1, | ||
const std::string & | a_val2 | ||
) |
Write a named pair of words to a line.
a_name | The name to be written before the value. |
a_val1 | The first word. |
a_val2 | The second word. |
Definition at line 836 of file daStreamIo.cpp.
References xms::daWrite2StringLine(), and m_impl.
Referenced by DaReaderWriterIoUnitTests::testReadWrite2StringLine().
void xms::DaStreamWriter::Write3DoubleLine | ( | const char * | a_name, |
const double & | a_val1, | ||
const double & | a_val2, | ||
const double & | a_val3 | ||
) |
Write a named triplet of doubles to a line.
a_name | The name to be written before the value. |
a_val1 | The first double. |
a_val2 | The second double. |
a_val3 | The third double. |
Definition at line 863 of file daStreamIo.cpp.
References xms::daWrite3DoubleLine(), and m_impl.
Referenced by DaReaderWriterIoUnitTests::testReadWrite3DoubleLine().
void xms::DaStreamWriter::Write3StringLine | ( | const char * | a_name, |
const std::string & | a_val1, | ||
const std::string & | a_val2, | ||
const std::string & | a_val3 | ||
) |
Write a named triplet of words to a line.
a_name | The name to be written before the value. |
a_val1 | The first word. |
a_val2 | The second word. |
a_val3 | The third word. |
Definition at line 849 of file daStreamIo.cpp.
References xms::daWrite3StringLine(), and m_impl.
Referenced by DaReaderWriterIoUnitTests::testReadWrite3StringLine().
bool xms::DaStreamWriter::WriteBinaryBytes | ( | const char * | a_source, |
long long | a_sourceLength | ||
) |
Write binary bytes of a given length to the stream.
a_source | The bytes to be written. |
a_sourceLength | The number of bytes to be written. |
Definition at line 917 of file daStreamIo.cpp.
References AppendInt(), EndLine(), m_impl, and WriteString().
Referenced by DaReaderWriterIoUnitTests::testReadWriteBinaryArrays(), WriteVecDbl(), WriteVecInt(), and WriteVecPt3d().
void xms::DaStreamWriter::WriteDoubleLine | ( | const char * | a_name, |
double | a_val | ||
) |
Write a named double line value.
a_name | The name to be written before the value. |
a_val | The double value to write. |
Definition at line 769 of file daStreamIo.cpp.
References xms::daWriteDoubleLine(), and m_impl.
Referenced by DaReaderWriterIoUnitTests::testReadWriteDoubleLine().
void xms::DaStreamWriter::WriteIntLine | ( | const char * | a_name, |
int | a_val | ||
) |
Write a named integer value to a line.
a_name | The name to be written before the value. |
a_val | The integer value. |
Definition at line 760 of file daStreamIo.cpp.
References xms::daWriteIntLine(), and m_impl.
Referenced by DaReaderWriterIoUnitTests::testReadWriteIntLine().
void xms::DaStreamWriter::WriteLine | ( | const std::string & | a_line | ) |
Write a given line to a stream.
a_line | The line of text to be written. |
Definition at line 742 of file daStreamIo.cpp.
References xms::daWriteLine(), and m_impl.
Referenced by DaReaderWriterIoUnitTests::testReadWriteLine().
void xms::DaStreamWriter::WriteString | ( | const char * | a_string | ) |
Write a string value to the stream.
a_string |
Definition at line 874 of file daStreamIo.cpp.
References m_impl.
Referenced by DaReaderWriterIoUnitTests::testReadWriteLineParts(), and WriteBinaryBytes().
void xms::DaStreamWriter::WriteStringLine | ( | const char * | a_name, |
const std::string & | a_val | ||
) |
Write a named word line.
a_name | The name to be written before the value. |
a_val | The word. |
Definition at line 751 of file daStreamIo.cpp.
References xms::daWriteStringLine(), and m_impl.
Referenced by DaReaderWriterIoUnitTests::testReadWriteStringLine().
void xms::DaStreamWriter::WriteVecDbl | ( | const char * | a_name, |
const VecDbl & | a_vec | ||
) |
Write a named vector of doubles to multiple lines.
a_name | The name to be written before the value. |
a_vec | The vector of doubles. |
Definition at line 797 of file daStreamIo.cpp.
References xms::daWriteVecDbl(), IsBinary(), m_impl, and WriteBinaryBytes().
Referenced by DaReaderWriterIoUnitTests::testReadWriteBinaryVecDbl(), and DaReaderWriterIoUnitTests::testReadWriteVecDbl().
void xms::DaStreamWriter::WriteVecInt | ( | const char * | a_name, |
const VecInt & | a_vec | ||
) |
Write a named vector of integers to several lines.
a_name | The name to be written before the value. |
a_vec | The vector of integers. |
Definition at line 778 of file daStreamIo.cpp.
References xms::daWriteVecInt(), IsBinary(), m_impl, and WriteBinaryBytes().
Referenced by DaReaderWriterIoUnitTests::testReadWriteBinaryVecInt(), and DaReaderWriterIoUnitTests::testReadWriteVecInt().
void xms::DaStreamWriter::WriteVecPt3d | ( | const char * | a_name, |
const VecPt3d & | a_points | ||
) |
Write a named vector of Pt3d to multiple lines.
a_name | The name to be written before the value. |
a_points | The vector of Pt3d. |
Definition at line 816 of file daStreamIo.cpp.
References xms::daWriteVecPt3d(), IsBinary(), m_impl, and WriteBinaryBytes().
Referenced by DaReaderWriterIoUnitTests::testReadWriteBinaryVecPt3d(), and DaReaderWriterIoUnitTests::testReadWriteVecPt3d().