| 72 | |
| 73 | template <typename ValueT> |
| 74 | bool WriteSparseArrayBinary(const std::string& type_name, vtkArray* array, ostream& stream) |
| 75 | { |
| 76 | vtkSparseArray<ValueT>* const concrete_array = vtkSparseArray<ValueT>::SafeDownCast(array); |
| 77 | if (!concrete_array) |
| 78 | return false; |
| 79 | |
| 80 | // Write the array header ... |
| 81 | WriteHeader("vtk-sparse-array", type_name, array, stream, true); |
| 82 | WriteEndianOrderMark(stream); |
| 83 | |
| 84 | // Serialize the array nullptr value ... |
| 85 | stream.write(reinterpret_cast<const char*>(&concrete_array->GetNullValue()), sizeof(ValueT)); |
| 86 | |
| 87 | // Serialize the array coordinates ... |
| 88 | for (vtkIdType i = 0; i != array->GetDimensions(); ++i) |
| 89 | { |
| 90 | stream.write(reinterpret_cast<char*>(concrete_array->GetCoordinateStorage(i)), |
| 91 | concrete_array->GetNonNullSize() * sizeof(vtkIdType)); |
| 92 | } |
| 93 | |
| 94 | // Serialize the array values ... |
| 95 | stream.write(reinterpret_cast<char*>(concrete_array->GetValueStorage()), |
| 96 | concrete_array->GetNonNullSize() * sizeof(ValueT)); |
| 97 | |
| 98 | return true; |
| 99 | } |
| 100 | |
| 101 | template <> |
| 102 | bool WriteSparseArrayBinary<vtkStdString>( |
nothing calls this directly
no test coverage detected