USGS

Isis 3.0 Developer's Reference (API)

Home

EndianSwapper.h

Go to the documentation of this file.
00001 
00024 #ifndef EndianSwapper_h
00025 #define EndianSwapper_h
00026 
00027 #include "IException.h"
00028 
00029 namespace Isis {
00030 
00053   class EndianSwapper {
00054     private:
00056       bool p_needSwap;
00061       int p_swapDirection;
00062 
00068       union {
00070         double p_double;
00072         float p_float;
00074         int p_int;
00076         long long int p_longLongInt;
00078         short int p_shortInt;
00083         unsigned short int p_uShortInt;
00085         char p_char[8];
00086       } p_swapper;
00087 
00088     public:
00089       EndianSwapper(QString inputEndian);
00090       ~EndianSwapper();
00091       double Double(void *buf);
00092       float Float(void *buf);
00093       int ExportFloat(void *buf);
00094       int Int(void *buf);
00095       long long int LongLongInt(void *buf);
00096       short int ShortInt(void *buf);
00097       unsigned short int UnsignedShortInt(unsigned short int *buf);
00098       bool willSwap() const {
00099         return p_needSwap;
00100       }
00101   };
00102 };
00103 
00104 #endif