VTK
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  int readShortInteger(int pos, std::ifstream& in);
25  int readLongInteger(int pos, std::ifstream& in);
26  int readLongInteger(std::ifstream& in);
27  float readFloat(std::ifstream& in);
28  float readIBMFloat(std::ifstream& in);
29  char readChar(std::ifstream& in);
30  unsigned char readUChar(std::ifstream& in);
31  void swap(char* a, char* b);
33  static vtkSegYIOUtils* Instance();
34  int getFileSize(std::ifstream& in);
35 
36 private:
38  bool checkIfBigEndian()
39  {
40  ushort a = 0x1234;
41  if (*((unsigned char*)&a) == 0x12)
42  return true;
43  return false;
44  }
45 };
46 
47 #endif // vtkSegYIOUtils_h
48 // VTK-HeaderTest-Exclude: vtkSegYIOUtils.h
float readFloat(std::ifstream &in)
static vtkSegYIOUtils * Instance()
int readLongInteger(int pos, std::ifstream &in)
float readIBMFloat(std::ifstream &in)
char readChar(std::ifstream &in)
int readShortInteger(int pos, std::ifstream &in)
int getFileSize(std::ifstream &in)
unsigned char readUChar(std::ifstream &in)
void swap(char *a, char *b)