ByteSwap.hh 2.61 KB
Newer Older
Will Schroeder's avatar
Will Schroeder committed
1
2
/*=========================================================================

Ken Martin's avatar
Ken Martin committed
3
  Program:   Visualization Toolkit
Will Schroeder's avatar
Will Schroeder committed
4
5
6
7
8
  Module:    ByteSwap.hh
  Language:  C++
  Date:      $Date$
  Version:   $Revision$

Ken Martin's avatar
Ken Martin committed
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37

Copyright (c) 1993-1995 Ken Martin, Will Schroeder, Bill Lorensen.

This software is copyrighted by Ken Martin, Will Schroeder and Bill Lorensen.
The following terms apply to all files associated with the software unless
explicitly disclaimed in individual files. This copyright specifically does
not apply to the related textbook "The Visualization Toolkit" ISBN
013199837-4 published by Prentice Hall which is covered by its own copyright.

The authors hereby grant permission to use, copy, and distribute this
software and its documentation for any purpose, provided that existing
copyright notices are retained in all copies and that this notice is included
verbatim in any distributions. Additionally, the authors grant permission to
modify this software and its documentation for any purpose, provided that
such modifications are not distributed without the explicit consent of the
authors and that existing copyright notices are retained in all copies. Some
of the algorithms implemented by this software are patented, observe all
applicable patent law.

IN NO EVENT SHALL THE AUTHORS OR DISTRIBUTORS BE LIABLE TO ANY PARTY FOR
DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING OUT
OF THE USE OF THIS SOFTWARE, ITS DOCUMENTATION, OR ANY DERIVATIVES THEREOF,
EVEN IF THE AUTHORS HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

THE AUTHORS AND DISTRIBUTORS SPECIFICALLY DISCLAIM ANY WARRANTIES, INCLUDING,
BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
PARTICULAR PURPOSE, AND NON-INFRINGEMENT.  THIS SOFTWARE IS PROVIDED ON AN
"AS IS" BASIS, AND THE AUTHORS AND DISTRIBUTORS HAVE NO OBLIGATION TO PROVIDE
MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
Will Schroeder's avatar
Will Schroeder committed
38
39
40
41
42
or its contents may be copied, reproduced or altered in any way
without the express written consent of the authors.


=========================================================================*/
Ken Martin's avatar
Ken Martin committed
43
// .NAME vtkByteSwap - perform machine dependent byte swapping
Will Schroeder's avatar
Will Schroeder committed
44
// .SECTION Description
Ken Martin's avatar
Ken Martin committed
45
// vtkByteSwap is used by other classes to perform machine dependent byte
Will Schroeder's avatar
Will Schroeder committed
46
47
48
49
// swapping. Byte swapping is often used when reading or writing binary 
// files.
// .EXAMPLE STLRead.cc

Ken Martin's avatar
Ken Martin committed
50
51
#ifndef __vtkByteSwap_hh
#define __vtkByteSwap_hh
Will Schroeder's avatar
Will Schroeder committed
52

Ken Martin's avatar
Ken Martin committed
53
class vtkByteSwap
Will Schroeder's avatar
Will Schroeder committed
54
55
{
public:
Will Schroeder's avatar
Will Schroeder committed
56
  void Delete() {delete this;};
Ken Martin's avatar
Ken Martin committed
57
58
59
60
  void Swap4(char *c);
  void Swap4(float *p) {Swap4((char *)p);};
  void Swap4(int *i) {Swap4((char *)i);};
  void Swap4(unsigned long *i) {Swap4((char *)i);};
Will Schroeder's avatar
Will Schroeder committed
61
62
63
};

#endif