Main Page   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members   File Members   Search  

LESwaps Class Reference

This class is used to access data which stored in big endian order regardless of the conventions of the platform. More...

#include <LESwaps.h>

List of all members.

Static Public Methods

le_bool isBigEndian ()
 This method detects the endian-ness of the platform by casting a pointer to a word to a pointer to a byte. More...

le_uint16 swapWord (le_uint16 value)
 This method the byte swap required on little endian platforms to correctly access a word. More...

le_uint32 swapLong (le_uint32 value)
 This method does the byte swapping required on little endian platforms to correctly access a long. More...


Detailed Description

This class is used to access data which stored in big endian order regardless of the conventions of the platform.

It has been designed to automatically detect the endian-ness of the platform, so that a compilation flag is not needed.

All methods are static and inline in an attempt to induce the compiler to do most of the calculations at compile time.

Definition at line 32 of file LESwaps.h.


Member Function Documentation

le_bool LESwaps::isBigEndian   [inline, static]
 

This method detects the endian-ness of the platform by casting a pointer to a word to a pointer to a byte.

On big endian platforms the FF will be in the byte with the lowest address. On little endian platforms, the FF will be in the byte with the highest address.

Returns:
true if the platform is big endian

Definition at line 45 of file LESwaps.h.

le_uint32 LESwaps::swapLong le_uint32    value [inline, static]
 

This method does the byte swapping required on little endian platforms to correctly access a long.

Parameters:
value  - the long to be byte swapped
Returns:
the byte swapped long

Definition at line 74 of file LESwaps.h.

le_uint16 LESwaps::swapWord le_uint16    value [inline, static]
 

This method the byte swap required on little endian platforms to correctly access a word.

Parameters:
value  - the word to be byte swapped
Returns:
the byte swapped word

Definition at line 61 of file LESwaps.h.

Referenced by swapLong().


The documentation for this class was generated from the following file:
Generated on Mon Dec 3 19:00:53 2001 for ICU 2.0 by doxygen1.2.11.1 written by Dimitri van Heesch, © 1997-2001