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