MCPcopy Create free account
hub / github.com/Kitware/VTK / ReadNumber

Method ReadNumber

IO/EnSight/core/EnSightFile.h:286–320  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

284//------------------------------------------------------------------------------
285template <typename T>
286bool 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//------------------------------------------------------------------------------
323template <typename T>

Callers 12

ReadArrayMethod · 0.95
ReadMeasuredGeometryMethod · 0.80
ReadVariableArrayMethod · 0.80
ReadPartIdMethod · 0.80
ReadNSidedSectionMethod · 0.80
SkipNFacedSectionMethod · 0.80
SkipNSidedSectionMethod · 0.80
ReadNFacedSectionMethod · 0.80

Calls 5

ReadNextLineMethod · 0.95
MoveReadPositionMethod · 0.95
stringToFunction · 0.85
assertFunction · 0.50
readMethod · 0.45

Tested by

no test coverage detected