Isis 3 Programmer Reference
|
Byte swapper. More...
#include <EndianSwapper.h>
Public Member Functions | |
EndianSwapper (QString inputEndian) | |
Constructs an EndianSwapper object, determining whether swapping of bytes actually needs to occur and sets the direction of swapping. More... | |
~EndianSwapper () | |
Destroys the EndianSwapper object. More... | |
double | Double (void *buf) |
Swaps a double precision value. More... | |
float | Float (void *buf) |
Swaps a floating point value. More... | |
int | ExportFloat (void *buf) |
Swaps a floating point value for Exporting. More... | |
int | Int (void *buf) |
Swaps a 4 byte integer value. More... | |
uint32_t | Uint32_t (void *buf) |
Swaps a 32bit unsigned integer. More... | |
long long int | LongLongInt (void *buf) |
Swaps an 8 byte integer value. More... | |
short int | ShortInt (void *buf) |
Swaps a short integer value. More... | |
unsigned short int | UnsignedShortInt (void *buf) |
Swaps an unsigned short integer value. More... | |
bool | willSwap () const |
Private Attributes | |
bool | p_needSwap |
Indicates whether bytes need to be swapped. More... | |
int | p_swapDirection |
Indicates which direction to increment the pointer for swapping. More... | |
union { | |
uint32_t p_uint32 | |
Union containing the output uint32_t value with swapped bytes. More... | |
double p_double | |
Union containing the output double precision value with swapped bytes. More... | |
float p_float | |
Union containing the output floating point value with swapped bytes. More... | |
int p_int | |
Union containing the output 4 byte integer value with swapped bytes. More... | |
long long int p_longLongInt | |
Union containing the output 8 byte integer value with swapped bytes. More... | |
short int p_shortInt | |
Union containing the output 2 byte integer value with swapped bytes. More... | |
unsigned short int p_uShortInt | |
Union containing the output unsigned short integer value with swapped bytes. More... | |
char p_char [8] | |
Union containing the output value in byte format. More... | |
} | p_swapper |
Union containing the output double precision value, floating point value, short integer value, unsigned short integer value and byte format - all with swapped bytes. More... | |
Byte swapper.
This class is used to swap bytes on data that is from a different machine architecture.
2003-05-16 Stuart Sides modified schema from astrogeology...isis.astrogeology.
2004-03-18 Stuart Sides used Endian.h instead of the linux gcc endian.h to figure the system's endian type.
2008-08-14 Christopher Austin - Added ExportFloat() for exporting real data to the non-native endians. i.e. exporting to msb on a lsb system
2009-04-16 Steven Lambright - Added Int and LongLongInt. Long was not added because it is 4 bytes on 32-bit linux and 8 bytes on 64-bit linux.
2016-04-21 Makayla Shepherd - Added UnsignedWord pixel type handling.
2018-01-29 Adam Goins - Added uint32_t behavior to EndianSwapper.
Definition at line 55 of file EndianSwapper.h.
Isis::EndianSwapper::EndianSwapper | ( | QString | inputEndian | ) |
Constructs an EndianSwapper object, determining whether swapping of bytes actually needs to occur and sets the direction of swapping.
inputEndian | Byte order of input value (MSB or LSB). |
Definition at line 39 of file EndianSwapper.cpp.
References _FILEINFO_, Isis::IsLsb(), and Isis::IsMsb().
Isis::EndianSwapper::~EndianSwapper | ( | ) |
Destroys the EndianSwapper object.
Definition at line 62 of file EndianSwapper.cpp.
double Isis::EndianSwapper::Double | ( | void * | buf | ) |
Swaps a double precision value.
buf | Input double precision value to swap. |
Definition at line 71 of file EndianSwapper.cpp.
Referenced by Isis::ImportPdsTable::extractBinary(), Isis::ExportPdsTable::Pack(), Isis::ProcessImport::ProcessBil(), Isis::ProcessImport::ProcessBip(), and Isis::ProcessImport::ProcessBsq().
int Isis::EndianSwapper::ExportFloat | ( | void * | buf | ) |
Swaps a floating point value for Exporting.
Definition at line 115 of file EndianSwapper.cpp.
Referenced by Isis::ProcessExport::isisOut32().
float Isis::EndianSwapper::Float | ( | void * | buf | ) |
Swaps a floating point value.
buf | Input floating point value to swap. |
Definition at line 94 of file EndianSwapper.cpp.
Referenced by Isis::ImportPdsTable::extractBinary(), Isis::ExportPdsTable::Pack(), Isis::ProcessImport::ProcessBil(), Isis::ProcessImport::ProcessBip(), and Isis::ProcessImport::ProcessBsq().
int Isis::EndianSwapper::Int | ( | void * | buf | ) |
Swaps a 4 byte integer value.
buf | Input integer value to swap. |
Definition at line 124 of file EndianSwapper.cpp.
Referenced by Isis::ImportPdsTable::extractBinary(), Isis::ExportPdsTable::Pack(), Isis::ProcessImport::ProcessBil(), Isis::ProcessImport::ProcessBip(), and Isis::ProcessImport::ProcessBsq().
long long int Isis::EndianSwapper::LongLongInt | ( | void * | buf | ) |
Swaps an 8 byte integer value.
buf | Input integer value to swap. |
Definition at line 168 of file EndianSwapper.cpp.
short int Isis::EndianSwapper::ShortInt | ( | void * | buf | ) |
Swaps a short integer value.
buf | Input short integer value to swap. |
Definition at line 190 of file EndianSwapper.cpp.
Referenced by Isis::ProcessExport::isisOut16s(), Isis::ProcessImport::ProcessBil(), Isis::ProcessImport::ProcessBip(), and Isis::ProcessImport::ProcessBsq().
uint32_t Isis::EndianSwapper::Uint32_t | ( | void * | buf | ) |
Swaps a 32bit unsigned integer.
buf | Input uint32 integer value to swap. |
Definition at line 146 of file EndianSwapper.cpp.
Referenced by Isis::ProcessImport::ProcessBil(), Isis::ProcessImport::ProcessBip(), Isis::ProcessImport::ProcessBsq(), Isis::ControlNetVersioner::readProtobufV0005(), and Isis::ControlNetVersioner::writeFirstPoint().
unsigned short int Isis::EndianSwapper::UnsignedShortInt | ( | void * | buf | ) |
Swaps an unsigned short integer value.
buf | Input unsigned short integer value to swap. |
Definition at line 213 of file EndianSwapper.cpp.
Referenced by Isis::ProcessExport::isisOut16u(), Isis::ProcessImport::ProcessBil(), Isis::ProcessImport::ProcessBip(), and Isis::ProcessImport::ProcessBsq().
char Isis::EndianSwapper::p_char[8] |
Union containing the output value in byte format.
Definition at line 89 of file EndianSwapper.h.
double Isis::EndianSwapper::p_double |
Union containing the output double precision value with swapped bytes.
Definition at line 74 of file EndianSwapper.h.
float Isis::EndianSwapper::p_float |
Union containing the output floating point value with swapped bytes.
Definition at line 76 of file EndianSwapper.h.
int Isis::EndianSwapper::p_int |
Union containing the output 4 byte integer value with swapped bytes.
Definition at line 78 of file EndianSwapper.h.
long long int Isis::EndianSwapper::p_longLongInt |
Union containing the output 8 byte integer value with swapped bytes.
Definition at line 80 of file EndianSwapper.h.
|
private |
Indicates whether bytes need to be swapped.
Definition at line 58 of file EndianSwapper.h.
short int Isis::EndianSwapper::p_shortInt |
Union containing the output 2 byte integer value with swapped bytes.
Definition at line 82 of file EndianSwapper.h.
|
private |
Indicates which direction to increment the pointer for swapping.
(Possible values: -1,1)
Definition at line 63 of file EndianSwapper.h.
union { ... } Isis::EndianSwapper::p_swapper |
Union containing the output double precision value, floating point value, short integer value, unsigned short integer value and byte format - all with swapped bytes.
uint32_t Isis::EndianSwapper::p_uint32 |
Union containing the output uint32_t value with swapped bytes.
Definition at line 72 of file EndianSwapper.h.
unsigned short int Isis::EndianSwapper::p_uShortInt |
Union containing the output unsigned short integer value with swapped bytes.
Definition at line 87 of file EndianSwapper.h.