| 1493 | // General templated function to read data of various types. |
| 1494 | template <class T> |
| 1495 | int vtkReadBinaryData(istream* IS, T* data, vtkIdType numTuples, vtkIdType numComp) |
| 1496 | { |
| 1497 | if (numTuples == 0 || numComp == 0) |
| 1498 | { |
| 1499 | // nothing to read here. |
| 1500 | return 1; |
| 1501 | } |
| 1502 | char line[256]; |
| 1503 | |
| 1504 | // suck up newline |
| 1505 | IS->getline(line, 256); |
| 1506 | IS->read((char*)data, sizeof(T) * numComp * numTuples); |
| 1507 | if (IS->eof()) |
| 1508 | { |
| 1509 | vtkGenericWarningMacro(<< "Error reading binary data!"); |
| 1510 | return 0; |
| 1511 | } |
| 1512 | return 1; |
| 1513 | } |
| 1514 | |
| 1515 | // General templated function to read data of various types. |
| 1516 | template <class T> |