VTK  9.3.20240418
vtkSegYIOUtils.h
Go to the documentation of this file.
1 // SPDX-FileCopyrightText: Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
2 // SPDX-License-Identifier: BSD-3-Clause
3 
4 #ifndef vtkSegYIOUtils_h
5 #define vtkSegYIOUtils_h
6 
7 #include "vtkABINamespace.h"
8 
9 #include <fstream>
10 
11 VTK_ABI_NAMESPACE_BEGIN
13 {
14 public:
15  char readChar(std::istream& in);
16  short readShortInteger(std::streamoff pos, std::istream& in);
17  short readShortInteger(std::istream& in);
18  int readLongInteger(std::streamoff pos, std::istream& in);
19  int readLongInteger(std::istream& in);
20  float readFloat(std::istream& in);
21  float readIBMFloat(std::istream& in);
22  unsigned char readUChar(std::istream& in);
23  void swap(char* a, char* b);
25  std::streamoff getFileSize(std::istream& in);
26 
28 
29 private:
31  bool checkIfBigEndian()
32  {
33  unsigned short a = 0x1234;
34  if (*(reinterpret_cast<unsigned char*>(&a)) == 0x12)
35  return true;
36  return false;
37  }
38 };
39 
40 VTK_ABI_NAMESPACE_END
41 #endif // vtkSegYIOUtils_h
42 // VTK-HeaderTest-Exclude: vtkSegYIOUtils.h
float readFloat(std::istream &in)
int readLongInteger(std::streamoff pos, std::istream &in)
static vtkSegYIOUtils * Instance()
float readIBMFloat(std::istream &in)
std::streamoff getFileSize(std::istream &in)
void swap(char *a, char *b)
char readChar(std::istream &in)
short readShortInteger(std::streamoff pos, std::istream &in)
int readLongInteger(std::istream &in)
unsigned char readUChar(std::istream &in)
short readShortInteger(std::istream &in)