QDP++
QDP::BinaryReaderWriter Class Referenceabstract

Binary input/output base class. More...

#include <qdp_io.h>

Inheritance diagram for QDP::BinaryReaderWriter:
QDP::BinaryReader QDP::BinaryWriter QDP::BinaryBufferReaderWriter QDP::BinaryFileReaderWriter

Public Types

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

Public Member Functions

virtual ~BinaryReaderWriter ()
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.
Public Member Functions inherited from QDP::BinaryReader
virtual ~BinaryReader ()
virtual void readArrayPrimaryNode (char *output, size_t nbytes, size_t nmemb)
 Read data on the primary node only.
virtual void readArray (char *output, size_t nbytes, size_t nmemb)
 Read data on the primary node and broadcast to all nodes.
virtual void readArrayLittleEndian (char *output, size_t nbytes, size_t nmemb)
virtual void readArrayPrimaryNodeLittleEndian (char *output, size_t nbytes, size_t nmemb)
virtual void readDesc (std::string &result)
virtual void read (std::string &result, size_t nbytes)
 Read some max number of characters - 1 upto and excluding a newline.
virtual void read (char &result)
virtual void read (int &result)
virtual void read (unsigned int &result)
virtual void read (short int &result)
virtual void read (unsigned short int &result)
virtual void read (long int &result)
virtual void read (unsigned long int &result)
virtual void read (long long int &result)
virtual void read (float &result)
virtual void read (double &result)
virtual void read (bool &result)
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.
Public Member Functions inherited from QDP::BinaryWriter
 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 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.

Protected Member Functions

virtual QDPUtil::n_uint32_tinternalChecksum ()=0
 Get the current checksum to modify.
virtual std::istream & getIstream ()=0
 Get the internal input stream.
virtual std::ostream & getOstream ()=0
 Get the internal output stream.
virtual std::iostream & getIOstream ()=0
 Get the internal input/output stream.
Protected Member Functions inherited from QDP::BinaryReader
template<typename T>
void readPrimitive (T &output)
 The universal data-reader.
Protected Member Functions inherited from QDP::BinaryWriter
template<typename T>
void writePrimitive (const T &output)
 The universal data-writer.

Detailed Description

Binary input/output base class.

This class is used to read/write data from a binary object. The data in the file is assumed to be big-endian. If the host nachine is little-endian, the data is byte-swapped.

The read methods are also wrapped by externally defined functions and >> operators,

Definition at line 1498 of file qdp_io.h.

Member Typedef Documentation

◆ off_type

typedef std::iostream::off_type QDP::BinaryReaderWriter::off_type

Definition at line 1502 of file qdp_io.h.

◆ pos_type

typedef std::iostream::pos_type QDP::BinaryReaderWriter::pos_type

Definition at line 1501 of file qdp_io.h.

Constructor & Destructor Documentation

◆ ~BinaryReaderWriter()

virtual QDP::BinaryReaderWriter::~BinaryReaderWriter ( )
inlinevirtual

Shutdown the object

Definition at line 1508 of file qdp_io.h.

Member Function Documentation

◆ currentPosition()

std::istream::pos_type QDP::BinaryReaderWriter::currentPosition ( )
virtual

Current position.

Reimplemented from QDP::BinaryReader.

Definition at line 1482 of file qdp_io.cc.

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

◆ fail()

bool QDP::BinaryReaderWriter::fail ( )
virtual

Checks status of the previous IO operation.

Returns
true if some failure occurred in the previous IO operation

Reimplemented from QDP::BinaryReader.

Definition at line 1453 of file qdp_io.cc.

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

◆ getChecksum()

QDPUtil::n_uint32_t QDP::BinaryReaderWriter::getChecksum ( )
virtual

Get the current checksum.

Reimplemented from QDP::BinaryReader.

Definition at line 1465 of file qdp_io.cc.

References QDP::QDPInternal::broadcast(), and internalChecksum().

◆ getIOstream()

virtual std::iostream & QDP::BinaryReaderWriter::getIOstream ( )
protectedpure virtual

Get the internal input/output stream.

Implemented in QDP::BinaryBufferReaderWriter, and QDP::BinaryFileReaderWriter.

Referenced by currentPosition(), fail(), rewind(), seek(), seekBegin(), seekEnd(), and seekRelative().

◆ getIstream()

virtual std::istream & QDP::BinaryReaderWriter::getIstream ( )
protectedpure virtual

Get the internal input stream.

Implements QDP::BinaryReader.

Implemented in QDP::BinaryBufferReaderWriter, and QDP::BinaryFileReaderWriter.

◆ getOstream()

virtual std::ostream & QDP::BinaryReaderWriter::getOstream ( )
protectedpure virtual

Get the internal output stream.

Implements QDP::BinaryWriter.

Implemented in QDP::BinaryBufferReaderWriter, and QDP::BinaryFileReaderWriter.

◆ internalChecksum()

virtual QDPUtil::n_uint32_t & QDP::BinaryReaderWriter::internalChecksum ( )
protectedpure virtual

Get the current checksum to modify.

Implements QDP::BinaryReader.

Implemented in QDP::BinaryBufferReaderWriter, and QDP::BinaryFileReaderWriter.

Referenced by getChecksum(), resetChecksum(), rewind(), seek(), seekBegin(), seekEnd(), and seekRelative().

◆ resetChecksum()

void QDP::BinaryReaderWriter::resetChecksum ( )
virtual

Reset the current checksum.

Reimplemented from QDP::BinaryReader.

Definition at line 1476 of file qdp_io.cc.

References internalChecksum().

◆ rewind()

void QDP::BinaryReaderWriter::rewind ( )
virtual

Rewind object to the beginning.

Rewind.

The checksum is reset

Reimplemented from QDP::BinaryReader.

Definition at line 1529 of file qdp_io.cc.

References getIOstream(), internalChecksum(), and QDP::Layout::primaryNode().

◆ seek()

void QDP::BinaryReaderWriter::seek ( pos_type off)
virtual

Set the current position.

The checksum is reset

Definition at line 1493 of file qdp_io.cc.

References getIOstream(), internalChecksum(), and QDP::Layout::primaryNode().

◆ seekBegin()

void QDP::BinaryReaderWriter::seekBegin ( off_type off)
virtual

Set the position relative from the start.

The checksum is reset

Definition at line 1502 of file qdp_io.cc.

References getIOstream(), internalChecksum(), and QDP::Layout::primaryNode().

◆ seekEnd()

void QDP::BinaryReaderWriter::seekEnd ( off_type off)
virtual

Set the position relative from the end.

The checksum is reset

Definition at line 1520 of file qdp_io.cc.

References getIOstream(), internalChecksum(), and QDP::Layout::primaryNode().

◆ seekRelative()

void QDP::BinaryReaderWriter::seekRelative ( off_type off)
virtual

Set the position relative to the current position.

The checksum is reset

Definition at line 1511 of file qdp_io.cc.

References getIOstream(), internalChecksum(), and QDP::Layout::primaryNode().


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