QDP++
QDP::QDPFileWriter Class Reference

QIO writer class. More...

#include <qdp_qdpio.h>

Public Member Functions

 QDPFileWriter ()
 Partial constructor.
 ~QDPFileWriter ()
 Closes the last file opened.
 QDPFileWriter (XMLBufferWriter &xml, const std::string &path, QDP_volfmt_t qdp_volfmt, QDP_serialparallel_t qdp_serpar)
 Opens a file for writing and writes the file metadata.
 QDPFileWriter (XMLBufferWriter &xml, const std::string &path, QDP_volfmt_t qdp_volfmt, QDP_serialparallel_t qdp_serpar, const std::string &data_LFN)
 Opens a file for writing and writes the file metadata.
void open (XMLBufferWriter &xml, const std::string &path, QDP_volfmt_t qdp_volfmt, QDP_serialparallel_t qdp_serpar)
 Opens a file for writing and writes the file metadata.
void open (XMLBufferWriter &xml, const std::string &path, QDP_volfmt_t qdp_volfmt, QDP_serialparallel_t qdp_serpar, const std::string &data_LFN)
 Opens a file for writing and writes the file metadata.
 QDPFileWriter (XMLBufferWriter &xml, const std::string &path, QDP_volfmt_t qdp_volfmt, QDP_serialparallel_t qdp_serpar, QDP_filemode_t qdp_mode)
 Opens a file for writing and writes the file metadata.
 QDPFileWriter (XMLBufferWriter &xml, const std::string &path, QDP_volfmt_t qdp_volfmt, QDP_serialparallel_t qdp_serpar, QDP_filemode_t qdp_mode, const std::string &data_LFN)
 Opens a file for writing and writes the file metadata.
void open (XMLBufferWriter &xml, const std::string &path, QDP_volfmt_t qdp_volfmt, QDP_serialparallel_t qdp_serpar, QDP_filemode_t qdp_mode, const std::string &data_LFN)
 Opens a file for writing and writes the file metadata.
void close ()
 Closes the last file opened.
bool is_open ()
 Queries whether a file is open.
template<class T, class C>
void write (XMLBufferWriter &xml, const QDPType< T, C > &s1)
 Write a QDP object.
template<class T>
void write (XMLBufferWriter &xml, const OScalar< T > &s1)
 Writes an OScalar object.
template<class T>
void write (XMLBufferWriter &xml, const OLattice< T > &s1)
 Writes an OLattice object.
template<class T>
void write (XMLBufferWriter &xml, const OLattice< T > &s1, const multi1d< int > &lower_left, const multi1d< int > &upper_right)
 Writes a hypercube from an OLattice object.
template<class T>
void write (XMLBufferWriter &xml, const multi1d< OScalar< T > > &s1)
 Writes an array of objects all to a single record.
template<class T>
void write (XMLBufferWriter &xml, const multi1d< OLattice< T > > &s1)
 Writes an array of objects all to a single record.
template<class T>
void write (XMLBufferWriter &xml, const multi1d< OLattice< T > > &s1, const multi1d< int > &lower_left, const multi1d< int > &upper_right)
 Writes a hypercube of an array of objects all to a single record.
void write (XMLBufferWriter &xml, BinaryBufferWriter &s1)
 Writes an XML plus Binary writer pair.
bool bad () const
 Query whether an unrecoverable error has occurred.
void clear (QDP_iostate_t state=QDPIO_goodbit)
 Sets a new value for the control state ignoring the existing value.

Protected Member Functions

QIO_Writerget () const

Detailed Description

QIO writer class.

This is a QDP object wrapper around the QIO library.

QIO is a C library independent of QDP. It is designed to read/write SCIDAC format data files, which means a mixture of binary data and XML metadata together in the same file according to a scheme called Lime. There is a seperate independent library for handling general Lime files.

The data is written as a record in a Lime file. The user metadata (both file and record) is also written.

Data is stored in the file in big-endian format and any necessary byte-swapping is taken care of.

The status of the IO operations is monitored internally and can be queried.

Definition at line 508 of file qdp_qdpio.h.

Constructor & Destructor Documentation

◆ QDPFileWriter() [1/5]

QDP::QDPFileWriter::QDPFileWriter ( )

Partial constructor.

Definition at line 294 of file qdp_qdpio.cc.

◆ ~QDPFileWriter()

QDP::QDPFileWriter::~QDPFileWriter ( )

Closes the last file opened.

Definition at line 508 of file qdp_qdpio.cc.

References close().

◆ QDPFileWriter() [2/5]

QDP::QDPFileWriter::QDPFileWriter ( XMLBufferWriter & xml,
const std::string & path,
QDP_volfmt_t qdp_volfmt,
QDP_serialparallel_t qdp_serpar )

Opens a file for writing and writes the file metadata.

Also reads the file user metadata record.

Parameters
xmlContainer for the file metadata
pathThe name of the file
qdp_volfmtThe type of file to write.
qdp_serparSerial or parallel IO

Definition at line 335 of file qdp_qdpio.cc.

References open(), and QDP::QDPIO_OPEN.

◆ QDPFileWriter() [3/5]

QDP::QDPFileWriter::QDPFileWriter ( XMLBufferWriter & xml,
const std::string & path,
QDP_volfmt_t qdp_volfmt,
QDP_serialparallel_t qdp_serpar,
const std::string & data_LFN )

Opens a file for writing and writes the file metadata.

Also reads the file user metadata record.

Parameters
xmlContainer for the file metadata
pathThe name of the file
qdp_volfmtThe type of file to write.
qdp_serparSerial or parallel IO
data_LFNLFN for ILDG style output

Definition at line 344 of file qdp_qdpio.cc.

References open(), and QDP::QDPIO_OPEN.

◆ QDPFileWriter() [4/5]

QDP::QDPFileWriter::QDPFileWriter ( XMLBufferWriter & xml,
const std::string & path,
QDP_volfmt_t qdp_volfmt,
QDP_serialparallel_t qdp_serpar,
QDP_filemode_t qdp_mode )

Opens a file for writing and writes the file metadata.

Also reads the file user metadata record.

Parameters
xmlContainer for the file metadata
pathThe name of the file
qdp_volfmtThe type of file to write.
qdp_serparSerial or parallel IO
qdp_modeThe file opening mode

Definition at line 296 of file qdp_qdpio.cc.

References open().

◆ QDPFileWriter() [5/5]

QDP::QDPFileWriter::QDPFileWriter ( XMLBufferWriter & xml,
const std::string & path,
QDP_volfmt_t qdp_volfmt,
QDP_serialparallel_t qdp_serpar,
QDP_filemode_t qdp_mode,
const std::string & data_LFN )

Opens a file for writing and writes the file metadata.

Also reads the file user metadata record.

Parameters
xmlContainer for the file metadata
pathThe name of the file
qdp_volfmtThe type of file to write.
qdp_serparSerial or parallel IO
qdp_modeThe file opening mode
data_LFNThe ILDG Data LFN

Definition at line 305 of file qdp_qdpio.cc.

References open().

Member Function Documentation

◆ bad()

bool QDP::QDPFileWriter::bad ( ) const

Query whether an unrecoverable error has occurred.

Returns
True if an error has occured; false otherwise

Definition at line 501 of file qdp_qdpio.cc.

◆ clear()

void QDP::QDPFileWriter::clear ( QDP_iostate_t state = QDPIO_goodbit)

Sets a new value for the control state ignoring the existing value.

Parameters
stateThe new state (defaults to QDPIO_goodbit).

Definition at line 503 of file qdp_qdpio.cc.

Referenced by write(), write(), write(), write(), write(), write(), and write().

◆ close()

void QDP::QDPFileWriter::close ( )

Closes the last file opened.

Definition at line 487 of file qdp_qdpio.cc.

References is_open(), and QDP::QDPIO_badbit.

Referenced by QDP::close(), and ~QDPFileWriter().

◆ get()

QIO_Writer * QDP::QDPFileWriter::get ( ) const
inlineprotected

Definition at line 714 of file qdp_qdpio.h.

Referenced by write(), write(), write(), write(), write(), write(), and write().

◆ is_open()

bool QDP::QDPFileWriter::is_open ( )

Queries whether a file is open.

Returns
true if a file is open; false otherwise.

Definition at line 499 of file qdp_qdpio.cc.

Referenced by close(), and QDP::is_open().

◆ open() [1/3]

void QDP::QDPFileWriter::open ( XMLBufferWriter & xml,
const std::string & path,
QDP_volfmt_t qdp_volfmt,
QDP_serialparallel_t qdp_serpar )

Opens a file for writing and writes the file metadata.

Also reads the file user metadata record.

Parameters
xmlContainer for the file metadata
pathThe name of the file
qdp_volfmtThe type of file to write.
qdp_serparSerial or parallel IO

Definition at line 316 of file qdp_qdpio.cc.

References open(), and QDP::QDPIO_OPEN.

Referenced by open(), open(), QDPFileWriter(), QDPFileWriter(), QDPFileWriter(), and QDPFileWriter().

◆ open() [2/3]

void QDP::QDPFileWriter::open ( XMLBufferWriter & xml,
const std::string & path,
QDP_volfmt_t qdp_volfmt,
QDP_serialparallel_t qdp_serpar,
const std::string & data_LFN )

Opens a file for writing and writes the file metadata.

Also reads the file user metadata record.

Parameters
xmlContainer for the file metadata
pathThe name of the file
qdp_volfmtThe type of file to write.
qdp_serparSerial or parallel IO
data_LFNILDG DATA LFN if we need to add one

Definition at line 324 of file qdp_qdpio.cc.

References open(), and QDP::QDPIO_OPEN.

◆ open() [3/3]

◆ write() [1/2]

void QDP::QDPFileWriter::write ( XMLBufferWriter & rec_xml,
BinaryBufferWriter & s1 )

Writes an XML plus Binary writer pair.

Writes a BinaryBufferWriter object.

Parameters
xmlThe user record metadata.
slThe data
rec_xmlThe (user) record metadata.
slThe data

Definition at line 528 of file qdp_qdpio.cc.

References QDP::QDPIO::cerr, clear(), get(), QDP::Layout::primaryNode(), QDP::QDP_abort(), QDP::QDPIO_badbit, QDP::QDPOScalarFactoryGet(), QDP::BinaryBufferWriter::str(), and QDP::XMLBufferWriter::str().

◆ write() [2/2]

template<class T, class C>
void QDP::QDPFileWriter::write ( XMLBufferWriter & xml,
const QDPType< T, C > & s1 )
inline

Write a QDP object.

Parameters
xmlThe user record metadata.
slThe data

Definition at line 633 of file qdp_qdpio.h.

References write().

Referenced by write(), QDP::write(), QDP::write(), QDP::write(), QDP::write(), QDP::write(), QDP::write(), and QDP::write().


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