VTK  9.0.1
vtkSegYIOUtils.h
Go to the documentation of this file.
1 /*=========================================================================
2 
3  Program: Visualization Toolkit
4  Module: vtkSegYIOUtils.h
5 
6  Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
7  All rights reserved.
8  See Copyright.txt or http://www.kitware.com/Copyright.htm for details.
9 
10  This software is distributed WITHOUT ANY WARRANTY; without even
11  the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
12  PURPOSE. See the above copyright notice for more information.
13 
14 =========================================================================*/
15 
16 #ifndef vtkSegYIOUtils_h
17 #define vtkSegYIOUtils_h
18 
19 #include <fstream>
20 
22 {
23 public:
24  char readChar(std::istream& in);
25  short readShortInteger(std::streamoff pos, std::istream& in);
26  short readShortInteger(std::istream& in);
27  int readLongInteger(std::streamoff pos, std::istream& in);
28  int readLongInteger(std::istream& in);
29  float readFloat(std::istream& in);
30  float readIBMFloat(std::istream& in);
31  unsigned char readUChar(std::istream& in);
32  void swap(char* a, char* b);
34  std::streamoff getFileSize(std::istream& in);
35 
37 
38 private:
40  bool checkIfBigEndian()
41  {
42  unsigned short a = 0x1234;
43  if (*((unsigned char*)&a) == 0x12)
44  return true;
45  return false;
46  }
47 };
48 
49 #endif // vtkSegYIOUtils_h
50 // 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)