QDP++
QDP::XMLFileWriter Class Reference

Writes XML metadata to a file. More...

#include <qdp_xmlio.h>

Inheritance diagram for QDP::XMLFileWriter:
QDP::XMLWriter

Public Member Functions

 XMLFileWriter ()
 XMLFileWriter (const std::string &filename, bool write_prologue=true)
 Constructor from a filename.
 ~XMLFileWriter ()
bool is_open ()
 Queries whether the binary file is open.
void open (const std::string &filename, bool write_prologue=true)
 Opens a file.
void flush ()
 Flush the buffer.
bool fail () const
 Return true if some failure occurred in previous IO operation.
void close ()
 Closes the last file opened.
Public Member Functions inherited from QDP::XMLWriter
 XMLWriter ()
virtual ~XMLWriter ()
virtual void openSimple (const std::string &tagname)
 Writes an opening XML tag.
virtual void closeSimple ()
virtual void openStruct (const std::string &tagname)
 Writes an opening XML tag.
virtual void closeStruct ()
void openTag (const std::string &tagname)
 Writes an opening XML tag.
void openTag (const std::string &nsprefix, const std::string &tagname)
 Writes an opening XML tag.
void openTag (const std::string &tagname, XMLWriterAPI::AttributeList &al)
 Writes an opening XML tag.
void openTag (const std::string &nsprefix, const std::string &tagname, XMLWriterAPI::AttributeList &al)
 Writes an opening XML tag.
void closeTag ()
 Closes a tag.
void emptyTag (const std::string &tagname)
 Writes an empty tag.
void emptyTag (const std::string &nsprefix, const std::string &tagname)
 Writes an empty tag.
void emptyTag (const std::string &tagname, XMLWriterAPI::AttributeList &al)
 Writes an empty tag.
void emptyTag (const std::string &nsprefix, const std::string &tagname, XMLWriterAPI::AttributeList &al)
 Writes an empty tag.
void write (const std::string &output)
 Write tag contents.
void write (const int &output)
 Write tag contents.
void write (const unsigned int &output)
 Write tag contents.
void write (const short int &output)
 Write tag contents.
void write (const unsigned short int &output)
 Write tag contents.
void write (const long int &output)
 Write tag contents.
void write (const unsigned long int &output)
 Write tag contents.
void write (const float &output)
 Write tag contents.
void write (const double &output)
 Write tag contents.
void write (const bool &output)
 Write tag contents.
void writeXML (const std::string &output)

Detailed Description

Writes XML metadata to a file.

Definition at line 1066 of file qdp_xmlio.h.

Constructor & Destructor Documentation

◆ XMLFileWriter() [1/2]

QDP::XMLFileWriter::XMLFileWriter ( )

Definition at line 1319 of file qdp_xmlio.cc.

◆ XMLFileWriter() [2/2]

QDP::XMLFileWriter::XMLFileWriter ( const std::string & filename,
bool write_prologue = true )
inlineexplicit

Constructor from a filename.

Parameters
filenameThe name of the file
write_prologueWhether to write the standard opening line of XML files. Defaults to true.

Definition at line 1078 of file qdp_xmlio.h.

References open().

◆ ~XMLFileWriter()

QDP::XMLFileWriter::~XMLFileWriter ( )

Definition at line 1391 of file qdp_xmlio.cc.

References close().

Member Function Documentation

◆ close()

void QDP::XMLFileWriter::close ( )

Closes the last file opened.

Definition at line 1339 of file qdp_xmlio.cc.

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

Referenced by ~XMLFileWriter().

◆ fail()

bool QDP::XMLFileWriter::fail ( ) const

Return true if some failure occurred in previous IO operation.

Definition at line 1376 of file qdp_xmlio.cc.

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

◆ flush()

void QDP::XMLFileWriter::flush ( )

Flush the buffer.

Definition at line 1366 of file qdp_xmlio.cc.

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

◆ is_open()

bool QDP::XMLFileWriter::is_open ( )

Queries whether the binary file is open.

Returns
true if the binary file is open; false otherwise.

Definition at line 1349 of file qdp_xmlio.cc.

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

Referenced by close(), and flush().

◆ open()

void QDP::XMLFileWriter::open ( const std::string & filename,
bool write_prologue = true )

Opens a file.

Parameters
filenameThe name of the file
write_prologueWhether to write the standard opening line of XML files. Defaults to true.

Definition at line 1321 of file qdp_xmlio.cc.

References QDP::QDPIO::cerr, QDP::Layout::primaryNode(), and QDP::QDP_abort().

Referenced by XMLFileWriter().


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