|
QDP++
|
Binary writer base class. More...
#include <qdp_io.h>
Public Types | |
| typedef std::ostream::pos_type | pos_type |
| typedef std::ostream::off_type | off_type |
Public Member Functions | |
| BinaryWriter () | |
| Default constructor. | |
| virtual | ~BinaryWriter () |
| virtual void | flush ()=0 |
| Flushes the buffer. | |
| 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 | |
| template<typename T> | |
| void | writePrimitive (const T &output) |
| The universal data-writer. | |
| virtual QDPUtil::n_uint32_t & | internalChecksum ()=0 |
| Get the current checksum to modify. | |
| virtual std::ostream & | getOstream ()=0 |
| Get the internal output stream. | |
Binary writer base class.
This class is used to write data to a binary object. The data in the object is big-endian. If the host machine is little-endian, the data is byte-swapped. Output is done from the primary node only.
Writer object need to be opened before any of the write methods are used. In the case of files, the files need to be opened first
The write methods are also wrapped by externally defined functions and << operators,
| typedef std::ostream::off_type QDP::BinaryWriter::off_type |
| typedef std::ostream::pos_type QDP::BinaryWriter::pos_type |
|
inlinevirtual |
|
virtual |
Current position.
Reimplemented in QDP::BinaryReaderWriter.
Definition at line 1033 of file qdp_io.cc.
References QDP::QDPInternal::broadcast(), getOstream(), and QDP::Layout::primaryNode().
|
virtual |
Checks status of the previous IO operation.
Reimplemented in QDP::BinaryReaderWriter.
Definition at line 1015 of file qdp_io.cc.
References QDP::QDPInternal::broadcast(), getOstream(), and QDP::Layout::primaryNode().
Referenced by QDP::writeArchiv().
|
pure virtual |
Flushes the buffer.
Implemented in QDP::BinaryBufferReaderWriter, QDP::BinaryBufferWriter, QDP::BinaryFileReaderWriter, and QDP::BinaryFileWriter.
|
virtual |
Get the current checksum.
Reimplemented in QDP::BinaryReaderWriter.
Definition at line 1188 of file qdp_io.cc.
References QDP::QDPInternal::broadcast(), and internalChecksum().
|
protectedpure virtual |
Get the internal output stream.
Implemented in QDP::BinaryBufferReaderWriter, QDP::BinaryBufferWriter, QDP::BinaryFileReaderWriter, QDP::BinaryFileWriter, and QDP::BinaryReaderWriter.
Referenced by currentPosition(), fail(), rewind(), seek(), seekBegin(), seekEnd(), seekRelative(), and writeArrayPrimaryNode().
|
protectedpure virtual |
Get the current checksum to modify.
Implemented in QDP::BinaryBufferReaderWriter, QDP::BinaryBufferWriter, QDP::BinaryFileReaderWriter, QDP::BinaryFileWriter, and QDP::BinaryReaderWriter.
Referenced by getChecksum(), resetChecksum(), rewind(), seek(), seekBegin(), seekEnd(), seekRelative(), and writeArrayPrimaryNode().
|
virtual |
Reset the current checksum.
Reimplemented in QDP::BinaryReaderWriter.
Definition at line 1027 of file qdp_io.cc.
References internalChecksum().
|
virtual |
Rewind object to the beginning.
Rewind.
The checksum is reset
Reimplemented in QDP::BinaryReaderWriter.
Definition at line 1080 of file qdp_io.cc.
References getOstream(), internalChecksum(), and QDP::Layout::primaryNode().
|
virtual |
Set the current position.
The checksum is reset
Definition at line 1044 of file qdp_io.cc.
References getOstream(), internalChecksum(), and QDP::Layout::primaryNode().
|
virtual |
Set the position relative from the start.
The checksum is reset
Definition at line 1053 of file qdp_io.cc.
References getOstream(), internalChecksum(), and QDP::Layout::primaryNode().
|
virtual |
Set the position relative from the end.
The checksum is reset
Definition at line 1071 of file qdp_io.cc.
References getOstream(), internalChecksum(), and QDP::Layout::primaryNode().
|
virtual |
Set the position relative to the current position.
The checksum is reset
Definition at line 1062 of file qdp_io.cc.
References getOstream(), internalChecksum(), and QDP::Layout::primaryNode().
|
virtual |
Definition at line 1148 of file qdp_io.cc.
References writePrimitive().
|
virtual |
Definition at line 1108 of file qdp_io.cc.
References writePrimitive().
|
virtual |
|
virtual |
Definition at line 1144 of file qdp_io.cc.
References writePrimitive().
|
virtual |
Definition at line 1140 of file qdp_io.cc.
References writePrimitive().
|
virtual |
Definition at line 1112 of file qdp_io.cc.
References writePrimitive().
|
virtual |
Definition at line 1128 of file qdp_io.cc.
References writePrimitive().
|
virtual |
Definition at line 1136 of file qdp_io.cc.
References writePrimitive().
|
virtual |
Definition at line 1120 of file qdp_io.cc.
References writePrimitive().
|
virtual |
A newline is appended to the written string.
Definition at line 1096 of file qdp_io.cc.
References write(), and writeArray().
Referenced by write(), write(), QDP::write(), QDP::write(), QDP::write(), QDP::write(), QDP::write(), QDP::write(), QDP::write(), QDP::write(), QDP::write(), QDP::write(), QDP::write(), QDP::write(), and QDP::write().
|
virtual |
Definition at line 1116 of file qdp_io.cc.
References writePrimitive().
|
virtual |
Definition at line 1132 of file qdp_io.cc.
References writePrimitive().
|
virtual |
Definition at line 1124 of file qdp_io.cc.
References writePrimitive().
|
virtual |
Write data from the primary node.
| output | The data to write |
| nbytes | The size in bytes of each datum |
| The | number of data. |
Definition at line 1182 of file qdp_io.cc.
References writeArrayPrimaryNode().
Referenced by write(), QDP::write(), QDP::writeArchivHeader(), writeDesc(), QDP::writeOLattice(), writePrimitive(), and QDP::LatticeTimeSliceIO::writeSlice().
|
virtual |
Write data on the primary node only.
| output | The location to which data is read |
| nbytes | The size in bytes of each datum |
| The | number of data. |
Definition at line 1159 of file qdp_io.cc.
References QDPUtil::big_endian(), QDPUtil::byte_swap(), QDPUtil::crc32(), getOstream(), internalChecksum(), and QDP::Layout::primaryNode().
Referenced by QDP::writeArchiv(), writeArray(), QDP::writeOLattice(), QDP::writeOLattice(), and QDP::LatticeTimeSliceIO::writeOLatticeSlice().
|
virtual |
Writes a fixed length of characters like an array.
Definition at line 1089 of file qdp_io.cc.
References writeArray(), and writePrimitive().
Referenced by QDP::writeDesc().
|
protected |
The universal data-writer.
All the write functions call this.
| output | The location of the datum to be written. |
Definition at line 1154 of file qdp_io.cc.
References writeArray().
Referenced by write(), write(), write(), write(), write(), write(), write(), write(), write(), write(), write(), and writeDesc().