xmscore  1.0
xms::DaStreamWriter Class Reference

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< Implm_impl
 Implementation.
 

Detailed Description

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.

Constructor & Destructor Documentation

◆ DaStreamWriter()

xms::DaStreamWriter::DaStreamWriter ( std::ostream &  a_outStream,
bool  a_binaryArrays = false 
)
explicit

Constructor.

Parameters
a_outStreamThe output stream.
a_binaryArraysShould binary arrays be written?

Definition at line 720 of file daStreamIo.cpp.

Member Function Documentation

◆ AppendInt()

void xms::DaStreamWriter::AppendInt ( int  a_val)

Append an integer value to the end of a line of text.

Parameters
a_valThe integer value.

Definition at line 882 of file daStreamIo.cpp.

References m_impl.

Referenced by DaReaderWriterIoUnitTests::testReadWriteLineParts(), and WriteBinaryBytes().

◆ AppendInts()

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.

Parameters
a_valuesA pointer to the integer values.
a_numValuesThe number of integer values.

Definition at line 891 of file daStreamIo.cpp.

References m_impl.

Referenced by DaReaderWriterIoUnitTests::testReadWriteLineParts().

◆ AppendString()

void xms::DaStreamWriter::AppendString ( const std::string &  a_val)

Append a string to the end of a line of text.

Parameters
a_valThe string to append.

Definition at line 900 of file daStreamIo.cpp.

References m_impl.

Referenced by DaReaderWriterIoUnitTests::testReadWriteLineParts().

◆ IsBinary()

bool xms::DaStreamWriter::IsBinary ( ) const

Are array values written as binary?

Returns
If the array values will be written as binary.

Definition at line 734 of file daStreamIo.cpp.

References m_impl.

Referenced by WriteVecDbl(), WriteVecInt(), and WriteVecPt3d().

◆ SetBinaryBlockSize()

void xms::DaStreamWriter::SetBinaryBlockSize ( int  a_blockSize)

Set the block size to use when writing binary arrays.

Parameters
a_blockSizeThe block size.

Definition at line 955 of file daStreamIo.cpp.

References m_impl.

Referenced by DaReaderWriterIoUnitTests::testReadWriteBinaryArrays().

◆ Write2StringLine()

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.

Parameters
a_nameThe name to be written before the value.
a_val1The first word.
a_val2The second word.

Definition at line 836 of file daStreamIo.cpp.

References xms::daWrite2StringLine(), and m_impl.

Referenced by DaReaderWriterIoUnitTests::testReadWrite2StringLine().

◆ Write3DoubleLine()

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.

Parameters
a_nameThe name to be written before the value.
a_val1The first double.
a_val2The second double.
a_val3The third double.

Definition at line 863 of file daStreamIo.cpp.

References xms::daWrite3DoubleLine(), and m_impl.

Referenced by DaReaderWriterIoUnitTests::testReadWrite3DoubleLine().

◆ Write3StringLine()

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.

Parameters
a_nameThe name to be written before the value.
a_val1The first word.
a_val2The second word.
a_val3The third word.

Definition at line 849 of file daStreamIo.cpp.

References xms::daWrite3StringLine(), and m_impl.

Referenced by DaReaderWriterIoUnitTests::testReadWrite3StringLine().

◆ WriteBinaryBytes()

bool xms::DaStreamWriter::WriteBinaryBytes ( const char *  a_source,
long long  a_sourceLength 
)

Write binary bytes of a given length to the stream.

Parameters
a_sourceThe bytes to be written.
a_sourceLengthThe number of bytes to be written.
Returns
True if no errors.

Definition at line 917 of file daStreamIo.cpp.

References AppendInt(), EndLine(), m_impl, and WriteString().

Referenced by DaReaderWriterIoUnitTests::testReadWriteBinaryArrays(), WriteVecDbl(), WriteVecInt(), and WriteVecPt3d().

◆ WriteDoubleLine()

void xms::DaStreamWriter::WriteDoubleLine ( const char *  a_name,
double  a_val 
)

Write a named double line value.

Parameters
a_nameThe name to be written before the value.
a_valThe double value to write.

Definition at line 769 of file daStreamIo.cpp.

References xms::daWriteDoubleLine(), and m_impl.

Referenced by DaReaderWriterIoUnitTests::testReadWriteDoubleLine().

◆ WriteIntLine()

void xms::DaStreamWriter::WriteIntLine ( const char *  a_name,
int  a_val 
)

Write a named integer value to a line.

Parameters
a_nameThe name to be written before the value.
a_valThe integer value.

Definition at line 760 of file daStreamIo.cpp.

References xms::daWriteIntLine(), and m_impl.

Referenced by DaReaderWriterIoUnitTests::testReadWriteIntLine().

◆ WriteLine()

void xms::DaStreamWriter::WriteLine ( const std::string &  a_line)

Write a given line to a stream.

Parameters
a_lineThe line of text to be written.

Definition at line 742 of file daStreamIo.cpp.

References xms::daWriteLine(), and m_impl.

Referenced by DaReaderWriterIoUnitTests::testReadWriteLine().

◆ WriteString()

void xms::DaStreamWriter::WriteString ( const char *  a_string)

Write a string value to the stream.

Parameters
a_string

Definition at line 874 of file daStreamIo.cpp.

References m_impl.

Referenced by DaReaderWriterIoUnitTests::testReadWriteLineParts(), and WriteBinaryBytes().

◆ WriteStringLine()

void xms::DaStreamWriter::WriteStringLine ( const char *  a_name,
const std::string &  a_val 
)

Write a named word line.

Parameters
a_nameThe name to be written before the value.
a_valThe word.

Definition at line 751 of file daStreamIo.cpp.

References xms::daWriteStringLine(), and m_impl.

Referenced by DaReaderWriterIoUnitTests::testReadWriteStringLine().

◆ WriteVecDbl()

void xms::DaStreamWriter::WriteVecDbl ( const char *  a_name,
const VecDbl a_vec 
)

Write a named vector of doubles to multiple lines.

Parameters
a_nameThe name to be written before the value.
a_vecThe 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().

◆ WriteVecInt()

void xms::DaStreamWriter::WriteVecInt ( const char *  a_name,
const VecInt a_vec 
)

Write a named vector of integers to several lines.

Parameters
a_nameThe name to be written before the value.
a_vecThe 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().

◆ WriteVecPt3d()

void xms::DaStreamWriter::WriteVecPt3d ( const char *  a_name,
const VecPt3d a_points 
)

Write a named vector of Pt3d to multiple lines.

Parameters
a_nameThe name to be written before the value.
a_pointsThe 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().


The documentation for this class was generated from the following files: