Isis 3.0
Back | 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 
54  class EndianSwapper {
55  private:
57  bool p_needSwap;
62  int p_swapDirection;
63 
69  union {
71  double p_double;
73  float p_float;
75  int p_int;
77  long long int p_longLongInt;
79  short int p_shortInt;
84  unsigned short int p_uShortInt;
86  char p_char[8];
87  } p_swapper;
88 
89  public:
90  EndianSwapper(QString inputEndian);
92  double Double(void *buf);
93  float Float(void *buf);
94  int ExportFloat(void *buf);
95  int Int(void *buf);
96  long long int LongLongInt(void *buf);
97  short int ShortInt(void *buf);
98  unsigned short int UnsignedShortInt(void *buf);
99  bool willSwap() const {
100  return p_needSwap;
101  }
102  };
103 };
104 
105 #endif
float Float(void *buf)
Swaps a floating point value.
Definition: EndianSwapper.cpp:94
char p_char[8]
Union containing the output value in byte format.
Definition: EndianSwapper.h:86
long long int p_longLongInt
Union containing the output 8 byte integer value with swapped bytes.
Definition: EndianSwapper.h:77
int p_int
Union containing the output 4 byte integer value with swapped bytes.
Definition: EndianSwapper.h:75
unsigned short int UnsignedShortInt(void *buf)
Swaps an unsigned short integer value.
Definition: EndianSwapper.cpp:191
bool willSwap() const
Definition: EndianSwapper.h:99
double p_double
Union containing the output double precision value with swapped bytes.
Definition: EndianSwapper.h:71
long long int LongLongInt(void *buf)
Swaps an 8 byte integer value.
Definition: EndianSwapper.cpp:146
short int p_shortInt
Union containing the output 2 byte integer value with swapped bytes.
Definition: EndianSwapper.h:79
double Double(void *buf)
Swaps a double precision value.
Definition: EndianSwapper.cpp:71
Byte swapper.
Definition: EndianSwapper.h:54
float p_float
Union containing the output floating point value with swapped bytes.
Definition: EndianSwapper.h:73
~EndianSwapper()
Destroys the EndianSwapper object.
Definition: EndianSwapper.cpp:62
int ExportFloat(void *buf)
Swaps a floating point value for Exporting.
Definition: EndianSwapper.cpp:115
short int ShortInt(void *buf)
Swaps a short integer value.
Definition: EndianSwapper.cpp:168
EndianSwapper(QString inputEndian)
Constructs an EndianSwapper object, determining whether swapping of bytes actually needs to occur and...
Definition: EndianSwapper.cpp:39
unsigned short int p_uShortInt
Union containing the output unsigned short integer value with swapped bytes.
Definition: EndianSwapper.h:84
int Int(void *buf)
Swaps a 4 byte integer value.
Definition: EndianSwapper.cpp:124

U.S. Department of the Interior | U.S. Geological Survey
ISIS | Privacy & Disclaimers | Astrogeology Research Program
To contact us, please post comments and questions on the ISIS Support Center
File Modified: 07/12/2023 23:17:47