USGS

Isis 3.0 Object Programmers' Reference

Home

EndianSwapper.h
Go to the documentation of this file.
1 
24 #ifndef EndianSwapper_h
25 #define EndianSwapper_h
26 
27 #include "IException.h"
28 
29 namespace Isis {
30 
53  class EndianSwapper {
54  private:
56  bool p_needSwap;
62 
68  union {
70  double p_double;
72  float p_float;
74  int p_int;
76  long long int p_longLongInt;
78  short int p_shortInt;
83  unsigned short int p_uShortInt;
85  char p_char[8];
86  } p_swapper;
87 
88  public:
89  EndianSwapper(QString inputEndian);
91  double Double(void *buf);
92  float Float(void *buf);
93  int ExportFloat(void *buf);
94  int Int(void *buf);
95  long long int LongLongInt(void *buf);
96  short int ShortInt(void *buf);
97  unsigned short int UnsignedShortInt(unsigned short int *buf);
98  bool willSwap() const {
99  return p_needSwap;
100  }
101  };
102 };
103 
104 #endif