MrSID Decode SDK for LiDAR Reference Manual  1.1.2.4045
Endian Class Reference

Endian is a helper class that figures out the host's byte order. More...

#include <Endian.h>

Public Member Functions

 Endian (void)
 
bool isHostBigEndian (void) const
 Determine if the host is big endian. More...
 
bool isHostLittleEndian (void) const
 Determine if the host is little endian. More...
 

Static Public Member Functions

template<size_t size>
static void swap (void *buffer)
 Swap byte order. More...
 
static void swap (void *buffer, size_t size)
 Swap byte order. More...
 

Protected Attributes

union {
   int   word
 
   char   byte [sizeof(int)]
 
}; 
 

Detailed Description

The Endian class is used to figure out if the host is big or little endian and swap between byte orders.

Definition at line 30 of file Endian.h.

Constructor & Destructor Documentation

Endian::Endian ( void  )
inline

Definition at line 33 of file Endian.h.

Member Function Documentation

bool Endian::isHostBigEndian ( void  ) const
inline

This method returns true when the host is big endian. The compiler should be able the optimize this function call away.

Definition at line 41 of file Endian.h.

References byte.

bool Endian::isHostLittleEndian ( void  ) const
inline

This method returns true when the host is little endian. The compiler should be able the optimize this function call away.

Definition at line 48 of file Endian.h.

References byte.

template<size_t size>
static void Endian::swap ( void *  buffer)
inlinestatic

This method swaps the byte order of the buffer.

Parameters
sizethe length of the buffer (in most cases it is a power of 2)
bufferthe data to be swapped

Definition at line 59 of file Endian.h.

static void Endian::swap ( void *  buffer,
size_t  size 
)
inlinestatic

This method swaps the byte order of the buffer.

Parameters
bufferthe data to be swapped
sizethe length of the buffer (in most cases it is a power of 2)

Definition at line 79 of file Endian.h.

Member Data Documentation

const { ... }
char Endian::byte[sizeof(int)]

Definition at line 92 of file Endian.h.

Referenced by isHostBigEndian(), and isHostLittleEndian().

int Endian::word

Definition at line 92 of file Endian.h.


The documentation for this class was generated from the following file:

LizardTech