QDP++
QDP::BinaryFileWriter Class Reference

Binary file output class. More...

#include <qdp_io.h>

Inheritance diagram for QDP::BinaryFileWriter:
QDP::BinaryWriter

Public Member Functions

 BinaryFileWriter ()
 ~BinaryFileWriter ()
 BinaryFileWriter (const std::string &p)
bool is_open ()
 Queries whether the file is open.
void open (const std::string &p)
void close ()
 Closes the last file opened.
void flush ()
 Flushes the buffer.
Public Member Functions inherited from QDP::BinaryWriter
 BinaryWriter ()
 Default constructor.
virtual ~BinaryWriter ()
virtual void writeArrayPrimaryNode (const char *output, size_t nbytes, size_t nmemb)
 Write data on the primary node only.
virtual void writeArray (const char *output, size_t nbytes, size_t nmemb)
 Write data from the primary node.
virtual void writeDesc (const std::string &output)
 Writes a fixed length of characters like an array.
virtual void write (const std::string &output)
virtual void write (const char *output)
virtual void write (const char &output)
virtual void write (const int &output)
virtual void write (const unsigned int &output)
virtual void write (const short int &output)
virtual void write (const unsigned short int &output)
virtual void write (const long int &output)
virtual void write (const unsigned long int &output)
virtual void write (const long long int &output)
virtual void write (const float &output)
virtual void write (const double &output)
virtual void write (const bool &output)
virtual bool fail ()
 Checks status of the previous IO operation.
virtual QDPUtil::n_uint32_t getChecksum ()
 Get the current checksum.
virtual void resetChecksum ()
 Reset the current checksum.
virtual pos_type currentPosition ()
 Current position.
virtual void seek (pos_type off)
 Set the current position.
virtual void seekBegin (off_type off)
 Set the position relative from the start.
virtual void seekRelative (off_type off)
 Set the position relative to the current position.
virtual void seekEnd (off_type off)
 Set the position relative from the end.
virtual void rewind ()
 Rewind object to the beginning.

Protected Member Functions

QDPUtil::n_uint32_tinternalChecksum ()
 Get the current checksum to modify.
std::ostream & getOstream ()
 Get the internal output stream.
Protected Member Functions inherited from QDP::BinaryWriter
template<typename T>
void writePrimitive (const T &output)
 The universal data-writer.

Additional Inherited Members

Public Types inherited from QDP::BinaryWriter
typedef std::ostream::pos_type pos_type
typedef std::ostream::off_type off_type

Detailed Description

Binary file output class.

This class is used to write data to a binary file. The data in the file is big-endian. If the host nachine is little-endian, the data is byte-swapped. Output is done from the primary node only.

Files need to be opened before any of the write methods are used

The write methods are also wrapped by externally defined functions and << operators,

Definition at line 1440 of file qdp_io.h.

Constructor & Destructor Documentation

◆ BinaryFileWriter() [1/2]

QDP::BinaryFileWriter::BinaryFileWriter ( )
explicit

Definition at line 1395 of file qdp_io.cc.

◆ ~BinaryFileWriter()

QDP::BinaryFileWriter::~BinaryFileWriter ( )

Closes the last file opened

Definition at line 1447 of file qdp_io.cc.

References close().

◆ BinaryFileWriter() [2/2]

QDP::BinaryFileWriter::BinaryFileWriter ( const std::string & p)
explicit

Opens a file for writing.

Parameters
pThe name of the file

Definition at line 1397 of file qdp_io.cc.

References open().

Member Function Documentation

◆ close()

void QDP::BinaryFileWriter::close ( )

Closes the last file opened.

Definition at line 1409 of file qdp_io.cc.

References is_open(), and QDP::Layout::primaryNode().

Referenced by QDP::writeArchiv(), and ~BinaryFileWriter().

◆ flush()

void QDP::BinaryFileWriter::flush ( )
virtual

Flushes the buffer.

Implements QDP::BinaryWriter.

Definition at line 1437 of file qdp_io.cc.

References is_open(), and QDP::Layout::primaryNode().

◆ getOstream()

std::ostream & QDP::BinaryFileWriter::getOstream ( )
inlineprotectedvirtual

Get the internal output stream.

Implements QDP::BinaryWriter.

Definition at line 1479 of file qdp_io.h.

◆ internalChecksum()

QDPUtil::n_uint32_t & QDP::BinaryFileWriter::internalChecksum ( )
inlineprotectedvirtual

Get the current checksum to modify.

Implements QDP::BinaryWriter.

Definition at line 1476 of file qdp_io.h.

◆ is_open()

bool QDP::BinaryFileWriter::is_open ( )

Queries whether the file is open.

Returns
true if the file is open; false otherwise.

Definition at line 1422 of file qdp_io.cc.

References QDP::QDPInternal::broadcast(), QDP::Layout::primaryNode(), and QDP::QDP_isInitialized().

Referenced by close(), flush(), and open().

◆ open()

void QDP::BinaryFileWriter::open ( const std::string & p)

Opens a file for writing.

Parameters
pThe name of the file

Definition at line 1399 of file qdp_io.cc.

References is_open(), QDP::Layout::primaryNode(), and QDP::QDP_error_exit().

Referenced by BinaryFileWriter().


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