| 284 | //------------------------------------------------------------------------------ |
| 285 | template <typename T> |
| 286 | bool EnSightFile::ReadNumber(T* result, bool padBeginning /* = true*/, bool padEnd /* = true*/) |
| 287 | { |
| 288 | if (this->Format == FileType::ASCII) |
| 289 | { |
| 290 | auto line = this->ReadNextLine(); |
| 291 | stringTo(line.second, *result); |
| 292 | } |
| 293 | else |
| 294 | { |
| 295 | if (padBeginning) |
| 296 | { |
| 297 | assert(!this->InBlockRead); |
| 298 | this->MoveReadPosition(this->FortranSkipBytes); |
| 299 | } |
| 300 | if (!this->Stream->read((char*)result, sizeof(T))) |
| 301 | { |
| 302 | vtkGenericWarningMacro("read failed"); |
| 303 | return false; |
| 304 | } |
| 305 | if (padEnd) |
| 306 | { |
| 307 | assert(!this->InBlockRead); |
| 308 | this->MoveReadPosition(this->FortranSkipBytes); |
| 309 | } |
| 310 | if (this->ByteOrder == Endianness::Little) |
| 311 | { |
| 312 | vtkByteSwap::Swap4LE(result); |
| 313 | } |
| 314 | else if (this->ByteOrder == Endianness::Big) |
| 315 | { |
| 316 | vtkByteSwap::Swap4BE(result); |
| 317 | } |
| 318 | } |
| 319 | return true; |
| 320 | } |
| 321 | |
| 322 | //------------------------------------------------------------------------------ |
| 323 | template <typename T> |
no test coverage detected