Main Page Class Hierarchy Alphabetical List Compound List File List Compound Members File Members Related Pages

# vtkByteSwap Class Reference

`#include <vtkByteSwap.h>`

Inheritance diagram for vtkByteSwap:

[legend]
Collaboration diagram for vtkByteSwap:

[legend]
List of all members.

## Detailed Description

perform machine dependent byte swapping

Date:
  2003/02/11 13:41:50

Revision:
  1.52

vtkByteSwap is used by other classes to perform machine dependent byte swapping. Byte swapping is often used when reading or writing binary files.

Created by:
  - Schroeder, Will

CVS contributions (if > 5%):
  - Lee, Jeff (43%)
  - Martin, Ken (26%)
  - Lorensen, Bill (7%)
  - Blue, Rusty (7%)
  - Schroeder, Will (6%)

CVS logs (CVSweb):
  - .`h` (`/Common/vtkByteSwap.h)`
  - .`cxx` (`/Common/vtkByteSwap.cxx)`

Tests:
  vtkByteSwap (Tests)

Definition at line 49 of file vtkByteSwap.h.

## Public Types

typedef vtkObject | Superclass

## Public Methods

virtual const char * | GetClassName ()
virtual int | IsA (const char *type)

## Static Public Methods

vtkByteSwap * | New ()
int | IsTypeOf (const char *type)
vtkByteSwap * | SafeDownCast (vtkObject *o)
void | SwapVoidRange (void *buffer, int numWords, int wordSize)
void | Swap2LE (short *s)
void | Swap2LE (unsigned short *s)
void | Swap4LE (char *c)
void | Swap4LE (float *p)
void | Swap4LE (int *i)
void | Swap4LE (unsigned int *i)
void | Swap4LE (long *i)
void | Swap4LE (unsigned long *i)
void | Swap8LE (char *c)
void | Swap8LE (double *d)
void | Swap2LERange (char *c, int num)
void | Swap2LERange (short *i, int num)
void | Swap4LERange (char *c, int num)
void | Swap4LERange (unsigned char *c, int num)
void | Swap4LERange (float *p, int num)
void | Swap4LERange (int *i, int num)
void | Swap4LERange (unsigned int *i, int num)
void | Swap4LERange (long *i, int num)
void | Swap4LERange (unsigned long *i, int num)
void | Swap8LERange (char *c, int num)
void | Swap8LERange (double *d, int num)
void | Swap2BE (short *s)
void | Swap2BE (unsigned short *s)
void | Swap4BE (char *c)
void | Swap4BE (float *p)
void | Swap4BE (int *i)
void | Swap4BE (unsigned int *i)
void | Swap4BE (long *i)
void | Swap4BE (unsigned long *i)
void | Swap8BE (char *c)
void | Swap8BE (double *d)
void | Swap2BERange (char *c, int num)
void | Swap2BERange (short *i, int num)
void | Swap4BERange (char *c, int num)
void | Swap4BERange (float *p, int num)
void | Swap4BERange (int *i, int num)
void | Swap4BERange (unsigned int *i, int num)
void | Swap4BERange (long *i, int num)
void | Swap4BERange (unsigned long *i, int num)
void | Swap8BERange (char *c, int num)
void | Swap8BERange (double *d, int num)
void | SwapWrite2BERange (char *c, int num, FILE *fp)
void | SwapWrite2BERange (short *i, int num, FILE *fp)
void | SwapWrite4BERange (char *c, int num, FILE *fp)
void | SwapWrite4BERange (float *p, int num, FILE *fp)
void | SwapWrite4BERange (int *i, int num, FILE *fp)
void | SwapWrite4BERange (unsigned int *i, int num, FILE *fp)
void | SwapWrite4BERange (unsigned long *i, int num, FILE *fp)
void | SwapWrite4BERange (long *i, int num, FILE *fp)
void | SwapWrite8BERange (char *c, int num, FILE *fp)
void | SwapWrite8BERange (double *d, int num, FILE *fp)
void | SwapWrite2BERange (char *c, int num, ostream *fp)
void | SwapWrite2BERange (short *i, int num, ostream *fp)
void | SwapWrite4BERange (char *c, int num, ostream *fp)
void | SwapWrite4BERange (float *p, int num, ostream *fp)
void | SwapWrite4BERange (int *i, int num, ostream *fp)
void | SwapWrite4BERange (unsigned int *i, int num, ostream *fp)
void | SwapWrite4BERange (unsigned long *i, int num, ostream *fp)
void | SwapWrite4BERange (long *i, int num, ostream *fp)
void | SwapWrite8BERange (char *c, int num, ostream *fp)
void | SwapWrite8BERange (double *d, int num, ostream *fp)

## Protected Methods

| vtkByteSwap ()
| ~vtkByteSwap ()

## Member Typedef Documentation

typedef vtkObject vtkByteSwap::Superclass

| Reimplemented from vtkObject. Definition at line 53 of file vtkByteSwap.h.

## Constructor & Destructor Documentation

vtkByteSwap::vtkByteSwap | ( |  | ) | `[inline, protected]`

| Definition at line 255 of file vtkByteSwap.h.

vtkByteSwap::~vtkByteSwap | ( |  | ) | `[inline, protected]`

| Definition at line 256 of file vtkByteSwap.h.

## Member Function Documentation

vtkByteSwap* vtkByteSwap::New | ( |  | ) | `[static]`

| Create an object with Debug turned off, modified time initialized to zero, and reference counting on. Reimplemented from vtkObject.

virtual const char* vtkByteSwap::GetClassName | ( |  | ) | `[virtual]`

| Reimplemented from vtkObject.

int vtkByteSwap::IsTypeOf | ( | const char * | type | ) | `[static]`

| Return 1 if this class type is the same type of (or a subclass of) the named class. Returns 0 otherwise. This method works in combination with vtkTypeRevisionMacro found in vtkSetGet.h. Reimplemented from vtkObject.

virtual int vtkByteSwap::IsA | ( | const char * | type | ) | `[virtual]`

| Return 1 if this class is the same type of (or a subclass of) the named class. Returns 0 otherwise. This method works in combination with vtkTypeRevisionMacro found in vtkSetGet.h. Reimplemented from vtkObject.

vtkByteSwap* vtkByteSwap::SafeDownCast | ( | vtkObject * | o | ) | `[static]`

| Reimplemented from vtkObject.

void vtkByteSwap::Swap2LE | ( | short * | s | ) | `[static]`

| Swap 2 byte word to be LE.

void vtkByteSwap::Swap2LE | ( | unsigned short * | s | ) | `[static]`

| Swap 2 byte word to be LE.

void vtkByteSwap::Swap4LE | ( | char * | c | ) | `[static]`

| Swap four byte word to be LE. Referenced by Swap4LE().

void vtkByteSwap::Swap4LE | ( | float * | p | ) | `[inline, static]`

| Swap four byte word to be LE. Definition at line 64 of file vtkByteSwap.h. References Swap4LE().

void vtkByteSwap::Swap4LE | ( | int * | i | ) | `[inline, static]`

| Swap four byte word to be LE. Definition at line 65 of file vtkByteSwap.h. References Swap4LE().

void vtkByteSwap::Swap4LE | ( | unsigned int * | i | ) | `[inline, static]`

| Swap four byte word to be LE. Definition at line 66 of file vtkByteSwap.h. References Swap4LE().

void vtkByteSwap::Swap4LE | ( | long * | i | ) | `[inline, static]`

| Swap four byte word to be LE. Definition at line 67 of file vtkByteSwap.h. References Swap4LE().

void vtkByteSwap::Swap4LE | ( | unsigned long * | i | ) | `[inline, static]`

| Swap four byte word to be LE. Definition at line 68 of file vtkByteSwap.h. References Swap4LE().

void vtkByteSwap::Swap8LE | ( | char * | c | ) | `[static]`

| Swap eight byte word to be LE. Currently implemented for doubles, but will be necessary for 64bit integers? 16bit chars? Referenced by Swap8LE().

void vtkByteSwap::Swap8LE | ( | double * | d | ) | `[inline, static]`

| Swap eight byte word to be LE. Currently implemented for doubles, but will be necessary for 64bit integers? 16bit chars? Definition at line 75 of file vtkByteSwap.h. References Swap8LE().

void vtkByteSwap::Swap2LERange | ( | char * | c,
|  | int | num
| ) | `[static]`

| Swap bunch of bytes to LE. Num is the number of two byte words to swap. Referenced by Swap2LERange().

void vtkByteSwap::Swap2LERange | ( | short * | i,
|  | int | num
| ) | `[inline, static]`

| Swap bunch of bytes to LE. Num is the number of two byte words to swap. Definition at line 82 of file vtkByteSwap.h. References Swap2LERange().

void vtkByteSwap::Swap4LERange | ( | char * | c,
|  | int | num
| ) | `[static]`

| Swap bunch of bytes to be LE. Num is the number of four byte words to swap. Referenced by Swap4LERange().

void vtkByteSwap::Swap4LERange | ( | unsigned char * | c,
|  | int | num
| ) | `[inline, static]`

| Swap bunch of bytes to be LE. Num is the number of four byte words to swap. Definition at line 90 of file vtkByteSwap.h. References Swap4LERange().

void vtkByteSwap::Swap4LERange | ( | float * | p,
|  | int | num
| ) | `[inline, static]`

| Swap bunch of bytes to be LE. Num is the number of four byte words to swap. Definition at line 92 of file vtkByteSwap.h. References Swap4LERange().

void vtkByteSwap::Swap4LERange | ( | int * | i,
|  | int | num
| ) | `[inline, static]`

| Swap bunch of bytes to be LE. Num is the number of four byte words to swap. Definition at line 94 of file vtkByteSwap.h. References Swap4LERange().

void vtkByteSwap::Swap4LERange | ( | unsigned int * | i,
|  | int | num
| ) | `[inline, static]`

| Swap bunch of bytes to be LE. Num is the number of four byte words to swap. Definition at line 96 of file vtkByteSwap.h. References Swap4LERange().

void vtkByteSwap::Swap4LERange | ( | long * | i,
|  | int | num
| ) | `[inline, static]`

| Swap bunch of bytes to be LE. Num is the number of four byte words to swap. Definition at line 98 of file vtkByteSwap.h. References Swap4LERange().

void vtkByteSwap::Swap4LERange | ( | unsigned long * | i,
|  | int | num
| ) | `[inline, static]`

| Swap bunch of bytes to be LE. Num is the number of four byte words to swap. Definition at line 100 of file vtkByteSwap.h. References Swap4LERange().

void vtkByteSwap::Swap8LERange | ( | char * | c,
|  | int | num
| ) | `[static]`

| Swap bunch of bytes to be LE. Num is the number of eight byte words to swap. Currently implemented for doubles... Referenced by Swap8LERange().

void vtkByteSwap::Swap8LERange | ( | double * | d,
|  | int | num
| ) | `[inline, static]`

| Swap bunch of bytes to be LE. Num is the number of eight byte words to swap. Currently implemented for doubles... Definition at line 108 of file vtkByteSwap.h. References Swap8LERange().

void vtkByteSwap::Swap2BE | ( | short * | s | ) | `[static]`

| Swap 2 byte word to BE.

void vtkByteSwap::Swap2BE | ( | unsigned short * | s | ) | `[static]`

| Swap 2 byte word to BE.

void vtkByteSwap::Swap4BE | ( | char * | c | ) | `[static]`

| For writing, swap four byte word to be BE. For reading, swap four byte word from BE to machine's internal representation. Referenced by Swap4BE().

void vtkByteSwap::Swap4BE | ( | float * | p | ) | `[inline, static]`

| For writing, swap four byte word to be BE. For reading, swap four byte word from BE to machine's internal representation. Definition at line 122 of file vtkByteSwap.h. References Swap4BE().

void vtkByteSwap::Swap4BE | ( | int * | i | ) | `[inline, static]`

| For writing, swap four byte word to be BE. For reading, swap four byte word from BE to machine's internal representation. Definition at line 123 of file vtkByteSwap.h. References Swap4BE().

void vtkByteSwap::Swap4BE | ( | unsigned int * | i | ) | `[inline, static]`

| For writing, swap four byte word to be BE. For reading, swap four byte word from BE to machine's internal representation. Definition at line 124 of file vtkByteSwap.h. References Swap4BE().

void vtkByteSwap::Swap4BE | ( | long * | i | ) | `[inline, static]`

| For writing, swap four byte word to be BE. For reading, swap four byte word from BE to machine's internal representation. Definition at line 125 of file vtkByteSwap.h. References Swap4BE().

void vtkByteSwap::Swap4BE | ( | unsigned long * | i | ) | `[inline, static]`

| For writing, swap four byte word to be BE. For reading, swap four byte word from BE to machine's internal representation. Definition at line 126 of file vtkByteSwap.h. References Swap4BE().

void vtkByteSwap::Swap8BE | ( | char * | c | ) | `[static]`

| For writing, swap eight byte word to be BE. For reading, swap eight byte word from BE to machine's internal representation. Referenced by Swap8BE().

void vtkByteSwap::Swap8BE | ( | double * | d | ) | `[inline, static]`

| For writing, swap eight byte word to be BE. For reading, swap eight byte word from BE to machine's internal representation. Definition at line 133 of file vtkByteSwap.h. References Swap8BE().

void vtkByteSwap::Swap2BERange | ( | char * | c,
|  | int | num
| ) | `[static]`

| Swap bunch of bytes to BE. Num is the number of two byte words to swap. Referenced by Swap2BERange().

void vtkByteSwap::Swap2BERange | ( | short * | i,
|  | int | num
| ) | `[inline, static]`

| Swap bunch of bytes to BE. Num is the number of two byte words to swap. Definition at line 140 of file vtkByteSwap.h. References Swap2BERange().

void vtkByteSwap::Swap4BERange | ( | char * | c,
|  | int | num
| ) | `[static]`

| Swap bunch of bytes to be BE. Num is the number of four byte words to swap. Referenced by Swap4BERange().

void vtkByteSwap::Swap4BERange | ( | float * | p,
|  | int | num
| ) | `[inline, static]`

| Swap bunch of bytes to be BE. Num is the number of four byte words to swap. Definition at line 148 of file vtkByteSwap.h. References Swap4BERange().

void vtkByteSwap::Swap4BERange | ( | int * | i,
|  | int | num
| ) | `[inline, static]`

| Swap bunch of bytes to be BE. Num is the number of four byte words to swap. Definition at line 150 of file vtkByteSwap.h. References Swap4BERange().

void vtkByteSwap::Swap4BERange | ( | unsigned int * | i,
|  | int | num
| ) | `[inline, static]`

| Swap bunch of bytes to be BE. Num is the number of four byte words to swap. Definition at line 152 of file vtkByteSwap.h. References Swap4BERange().

void vtkByteSwap::Swap4BERange | ( | long * | i,
|  | int | num
| ) | `[inline, static]`

| Swap bunch of bytes to be BE. Num is the number of four byte words to swap. Definition at line 154 of file vtkByteSwap.h. References Swap4BERange().

void vtkByteSwap::Swap4BERange | ( | unsigned long * | i,
|  | int | num
| ) | `[inline, static]`

| Swap bunch of bytes to be BE. Num is the number of four byte words to swap. Definition at line 156 of file vtkByteSwap.h. References Swap4BERange().

void vtkByteSwap::Swap8BERange | ( | char * | c,
|  | int | num
| ) | `[static]`

| Swap bunch of bytes to be BE. Num is the number of eight byte words to swap. Referenced by Swap8BERange().

void vtkByteSwap::Swap8BERange | ( | double * | d,
|  | int | num
| ) | `[inline, static]`

| Swap bunch of bytes to be BE. Num is the number of eight byte words to swap. Definition at line 169 of file vtkByteSwap.h. References Swap8BERange().

void vtkByteSwap::SwapWrite2BERange | ( | char * | c,
|  | int | num,
|  | FILE * | fp
| ) | `[static]`

| Swap bunch of bytes to BE. Num is the number of two byte words to swap. The results are written out to file to prevent having to keep the swapped copy in memory. Referenced by SwapWrite2BERange().

void vtkByteSwap::SwapWrite2BERange | ( | short * | i,
|  | int | num,
|  | FILE * | fp
| ) | `[inline, static]`

| Swap bunch of bytes to BE. Num is the number of two byte words to swap. The results are written out to file to prevent having to keep the swapped copy in memory. Definition at line 178 of file vtkByteSwap.h. References SwapWrite2BERange().

void vtkByteSwap::SwapWrite4BERange | ( | char * | c,
|  | int | num,
|  | FILE * | fp
| ) | `[static]`

| Swap bunch of bytes to BE. Num is the number of four byte words to swap. The results are written out to file to prevent having to keep the swapped copy in memory. Referenced by SwapWrite4BERange().

void vtkByteSwap::SwapWrite4BERange | ( | float * | p,
|  | int | num,
|  | FILE * | fp
| ) | `[inline, static]`

| Swap bunch of bytes to BE. Num is the number of four byte words to swap. The results are written out to file to prevent having to keep the swapped copy in memory. Definition at line 187 of file vtkByteSwap.h. References SwapWrite4BERange().

void vtkByteSwap::SwapWrite4BERange | ( | int * | i,
|  | int | num,
|  | FILE * | fp
| ) | `[inline, static]`

| Swap bunch of bytes to BE. Num is the number of four byte words to swap. The results are written out to file to prevent having to keep the swapped copy in memory. Definition at line 189 of file vtkByteSwap.h. References SwapWrite4BERange().

void vtkByteSwap::SwapWrite4BERange | ( | unsigned int * | i,
|  | int | num,
|  | FILE * | fp
| ) | `[inline, static]`

| Swap bunch of bytes to BE. Num is the number of four byte words to swap. The results are written out to file to prevent having to keep the swapped copy in memory. Definition at line 191 of file vtkByteSwap.h. References SwapWrite4BERange().

void vtkByteSwap::SwapWrite4BERange | ( | unsigned long * | i,
|  | int | num,
|  | FILE * | fp
| ) | `[inline, static]`

| Swap bunch of bytes to BE. Num is the number of four byte words to swap. The results are written out to file to prevent having to keep the swapped copy in memory. Definition at line 193 of file vtkByteSwap.h. References SwapWrite4BERange().

void vtkByteSwap::SwapWrite4BERange | ( | long * | i,
|  | int | num,
|  | FILE * | fp
| ) | `[inline, static]`

| Swap bunch of bytes to BE. Num is the number of four byte words to swap. The results are written out to file to prevent having to keep the swapped copy in memory. Definition at line 195 of file vtkByteSwap.h. References SwapWrite4BERange().

void vtkByteSwap::SwapWrite8BERange | ( | char * | c,
|  | int | num,
|  | FILE * | fp
| ) | `[static]`

| Swap bunch of bytes to BE. Num is the number of eight byte words to swap. The results are written out to file to prevent having to keep the swapped copy in memory. Implemented for doubles for now. Referenced by SwapWrite8BERange().

void vtkByteSwap::SwapWrite8BERange | ( | double * | d,
|  | int | num,
|  | FILE * | fp
| ) | `[inline, static]`

| Swap bunch of bytes to BE. Num is the number of eight byte words to swap. The results are written out to file to prevent having to keep the swapped copy in memory. Implemented for doubles for now. Definition at line 207 of file vtkByteSwap.h. References SwapWrite8BERange().

void vtkByteSwap::SwapWrite2BERange | ( | char * | c,
|  | int | num,
|  | ostream * | fp
| ) | `[static]`

| Swap bunch of bytes to BE. Num is the number of two byte words to swap. The results are written out to stream to prevent having to keep the swapped copy in memory.

void vtkByteSwap::SwapWrite2BERange | ( | short * | i,
|  | int | num,
|  | ostream * | fp
| ) | `[inline, static]`

| Swap bunch of bytes to BE. Num is the number of two byte words to swap. The results are written out to stream to prevent having to keep the swapped copy in memory. Definition at line 216 of file vtkByteSwap.h. References SwapWrite2BERange().

void vtkByteSwap::SwapWrite4BERange | ( | char * | c,
|  | int | num,
|  | ostream * | fp
| ) | `[static]`

| Swap bunch of bytes to BE. Num is the number of four byte words to swap. The results are written out to stream to prevent having to keep the swapped copy in memory.

void vtkByteSwap::SwapWrite4BERange | ( | float * | p,
|  | int | num,
|  | ostream * | fp
| ) | `[inline, static]`

| Swap bunch of bytes to BE. Num is the number of four byte words to swap. The results are written out to stream to prevent having to keep the swapped copy in memory. Definition at line 225 of file vtkByteSwap.h. References SwapWrite4BERange().

void vtkByteSwap::SwapWrite4BERange | ( | int * | i,
|  | int | num,
|  | ostream * | fp
| ) | `[inline, static]`

| Swap bunch of bytes to BE. Num is the number of four byte words to swap. The results are written out to stream to prevent having to keep the swapped copy in memory. Definition at line 227 of file vtkByteSwap.h. References SwapWrite4BERange().

void vtkByteSwap::SwapWrite4BERange | ( | unsigned int * | i,
|  | int | num,
|  | ostream * | fp
| ) | `[inline, static]`

| Swap bunch of bytes to BE. Num is the number of four byte words to swap. The results are written out to stream to prevent having to keep the swapped copy in memory. Definition at line 229 of file vtkByteSwap.h. References SwapWrite4BERange().

void vtkByteSwap::SwapWrite4BERange | ( | unsigned long * | i,
|  | int | num,
|  | ostream * | fp
| ) | `[inline, static]`

| Swap bunch of bytes to BE. Num is the number of four byte words to swap. The results are written out to stream to prevent having to keep the swapped copy in memory. Definition at line 231 of file vtkByteSwap.h. References SwapWrite4BERange().

void vtkByteSwap::SwapWrite4BERange | ( | long * | i,
|  | int | num,
|  | ostream * | fp
| ) | `[inline, static]`

| Swap bunch of bytes to BE. Num is the number of four byte words to swap. The results are written out to stream to prevent having to keep the swapped copy in memory. Definition at line 233 of file vtkByteSwap.h. References SwapWrite4BERange().

void vtkByteSwap::SwapWrite8BERange | ( | char * | c,
|  | int | num,
|  | ostream * | fp
| ) | `[static]`

| Swap bunch of bytes to BE. Num is the number of eight byte words to swap. The results are written out to stream to prevent having to keep the swapped copy in memory.

void vtkByteSwap::SwapWrite8BERange | ( | double * | d,
|  | int | num,
|  | ostream * | fp
| ) | `[inline, static]`

| Swap bunch of bytes to BE. Num is the number of eight byte words to swap. The results are written out to stream to prevent having to keep the swapped copy in memory. Definition at line 245 of file vtkByteSwap.h. References SwapWrite8BERange().

void vtkByteSwap::SwapVoidRange | ( | void * | buffer,
|  | int | numWords,
|  | int | wordSize
| ) | `[static]`

| Swaps the bytes of a buffer. Uses an arbitrary word size, but assumes the word size is divisible by two.

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

- Common/vtkByteSwap.h