TF++, Miscellaneous classes and modules in C++:
|
write FORTRAN binary data ,This class writes FORTRAN binary data. FORTRAN binary data is always written in chunks of several bytes, where each chunk is preceded and followed by a 4-byte integer byte-count. This class takes care of this structure of byte-counts. More...
#include <fortranio.h>
Public Member Functions | |
FortranBinOutput (std::ostream &os) | |
start writing to output stream os More... | |
~FortranBinOutput () | |
we need a flushing destructor More... | |
template<typename T > | |
void | put (const T &value) |
put a value to the output More... | |
void | end_block () |
finish data block More... | |
void | write_magic (const char *cmagic) |
write magic number (to separate block) More... | |
Private Member Functions | |
void | put_char (const char &c) |
put the next char to the output More... | |
void | put_chars (const char *buf, const int &n) |
put some chars to the output More... | |
Private Attributes | |
std::ostream & | Mostream |
The output stream to write to. More... | |
std::ostringstream | Mbuffer |
The buffering is done by a stringstream. More... | |
write FORTRAN binary data ,
This class writes FORTRAN binary data. FORTRAN binary data is always written in chunks of several bytes, where each chunk is preceded and followed by a 4-byte integer byte-count. This class takes care of this structure of byte-counts.
For convenient use we must buffer the output data. The user just pushes data to the stream and calls function end_block() after each data block. We will then write this block with a preceding and following byte-count. This implies the overhead string-streams introduce to this problem. However file I/O is not the part where we emphasize runtime efficiency.
By creating the object the writing process is initialized. Only basic put-functions (for char type) are provided. Use I/O operators for convenient access.
Definition at line 200 of file fortranio.h.