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