TF++, Miscellaneous classes and modules in C++:

◆ finish_block()

void tfxx::fortranio::FortranBinInput::finish_block ( )
private

finish open block

Definition at line 93 of file fortranio.cc.

References tfxx::ioswap::IOUnion< T >::bytes, extract_next_char(), Mistream, Mnbytes, Mnremain, Mswap, tfxx::ioswap::swap(), TFXX_assert, and tfxx::ioswap::IOUnion< T >::value.

Referenced by match_magic(), and ~FortranBinInput().

94  {
95  // do we have to read any more from current block?
96  while (Mnremain>0) { this->extract_next_char(); }
97  // had this block finite size? Then read end count and compare
98  if (Mnbytes>0) {
100  Mistream.read(buf.bytes, sizeof(int));
101  int endcount=buf.value;
102  if (Mswap) { endcount=tfxx::ioswap::swap(buf.value); }
103  TFXX_assert((Mnbytes == endcount),
104  "FortranBinInput (finish_block): "
105  "bount count at end of block does not match!");
106  }
107  // we do not open a new block - indicate by zero blocksize
108  Mnbytes=0;
109  }
#define TFXX_assert(C, M)
Check an assertion and report by throwing an exception.
Definition: error.h:175
char extract_next_char()
return next element from input stream
Definition: fortranio.cc:114
std::istream & Mistream
The input stream to read from.
Definition: fortranio.h:169
long int Mnremain
Number of bytes still to read from current block.
Definition: fortranio.h:175
char bytes[sizeof(T)]
Definition: bytesex.h:100
T swap(const T &value)
How to swap any generic type.
Definition: bytesex.h:138
bool Mswap
Has byte swapping to be performed.
Definition: fortranio.h:171
long int Mnbytes
Number of bytes expected in current block.
Definition: fortranio.h:173
Here is the call graph for this function:
Here is the caller graph for this function: