LAMA
|
XDR file stream class to access XDR files Supported data types: (unsigned) int, (unsigned) long, float, double. More...
#include <XDRFileStream.hpp>
Public Member Functions | |
XDRFileStream (const std::string &filename, const std::ios_base::openmode openmode) | |
The default constructor creates a XDR stream in the specified openmode. | |
virtual | ~XDRFileStream () |
The default destructor destroys the XDR stream if the file has been opened. | |
template<typename T > | |
void | read (T *const input, const std::streamsize n) |
Reads Values(s) of Type T from the XDR stream. | |
template<typename T > | |
void | read (T *const input) |
Reads Values(s) of Type T from the XDR stream. | |
template<typename T > | |
void | write (T *const input, const std::streamsize n) |
Writes Values of Type T to the XDR stream. | |
template<typename T > | |
void | write (T *const input) |
Writes Values of Type T to the XDR stream. | |
bool | is_open () |
Checks if the vector file could be opened. | |
void | close () |
Destroys the XDR stream if it has been opened. | |
Private Member Functions | |
void | openFilePointer (const std::string filename, const std::ios_base::openmode openmode) |
template<typename T > | |
void | xdrRead (T *const data) |
template<typename T > | |
void | xdrWrite (const T *const data) |
template<typename T > | |
int | getSize (const T) |
bool | isLittleEndian () |
Private Attributes | |
std::string | m_filename |
std::fstream | m_filestream |
std::ios_base::openmode | m_openmode |
XDR file stream class to access XDR files Supported data types: (unsigned) int, (unsigned) long, float, double.
lama::XDRFileStream::XDRFileStream | ( | const std::string & | filename, |
const std::ios_base::openmode | openmode | ||
) |
The default constructor creates a XDR stream in the specified openmode.
(in/out)
[in] | filename | Includes (the path and) the file name. |
[in] | openmode | Openmode of the XDR stream defined in standard C++ I/O openmode (std::ios::in or std::ios::out). The binary (std::ios::in) mode is automatically added. |
References openFilePointer().
lama::XDRFileStream::~XDRFileStream | ( | ) | [virtual] |
The default destructor destroys the XDR stream if the file has been opened.
References close().
void lama::XDRFileStream::close | ( | ) |
Destroys the XDR stream if it has been opened.
References is_open(), and m_filestream.
Referenced by ~XDRFileStream().
int lama::XDRFileStream::getSize | ( | const T | ) | [private] |
References LAMA_THROWEXCEPTION.
Referenced by xdrRead(), and xdrWrite().
bool lama::XDRFileStream::is_open | ( | ) |
Checks if the vector file could be opened.
References m_filestream.
Referenced by close(), xdrRead(), and xdrWrite().
bool lama::XDRFileStream::isLittleEndian | ( | ) | [private] |
Referenced by xdrRead(), and xdrWrite().
void lama::XDRFileStream::openFilePointer | ( | const std::string | filename, |
const std::ios_base::openmode | openmode | ||
) | [private] |
References m_filename, m_filestream, and m_openmode.
Referenced by XDRFileStream().
void lama::XDRFileStream::read | ( | T *const | input, |
const std::streamsize | n | ||
) |
Reads Values(s) of Type T from the XDR stream.
[out] | input | Data pointer for the data which should be read from the XDR stream. |
[in] | n | Number of values which should be read to the input field. |
References LAMA_THROWEXCEPTION, m_openmode, and xdrRead().
Referenced by read(), and lama::readData().
void lama::XDRFileStream::read | ( | T *const | input | ) |
Reads Values(s) of Type T from the XDR stream.
[out] | input | Data pointer for the data which should be read from the XDR stream. |
References read().
void lama::XDRFileStream::write | ( | T *const | input, |
const std::streamsize | n | ||
) |
Writes Values of Type T to the XDR stream.
[in] | output | Data pointer for the data which should be written to the XDR stream. |
[in] | n | Number of values which should be written to the output |
References LAMA_THROWEXCEPTION, m_openmode, and xdrWrite().
Referenced by write(), lama::StorageIO< T >::writeCSRToXDRFile(), and lama::writeData().
void lama::XDRFileStream::write | ( | T *const | input | ) |
Writes Values of Type T to the XDR stream.
[in] | output | Data pointer for the data which should be written to the XDR stream. |
References write().
void lama::XDRFileStream::xdrRead | ( | T *const | data | ) | [private] |
References getSize(), is_open(), isLittleEndian(), LAMA_THROWEXCEPTION, and m_filestream.
Referenced by read().
void lama::XDRFileStream::xdrWrite | ( | const T *const | data | ) | [private] |
References lama::abs(), getSize(), is_open(), isLittleEndian(), LAMA_THROWEXCEPTION, and m_filestream.
Referenced by write().
std::string lama::XDRFileStream::m_filename [private] |
Referenced by openFilePointer().
std::fstream lama::XDRFileStream::m_filestream [private] |
Referenced by close(), is_open(), openFilePointer(), xdrRead(), and xdrWrite().
std::ios_base::openmode lama::XDRFileStream::m_openmode [private] |
Referenced by openFilePointer(), read(), and write().