Main Page | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Class Members | File Members | Related Pages

vtkByteSwap.h

Go to the documentation of this file.
00001 /*=========================================================================
00002 
00003   Program:   Visualization Toolkit
00004   Module:    $RCSfile: vtkByteSwap.h,v $
00005 
00006   Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
00007   All rights reserved.
00008   See Copyright.txt or http://www.kitware.com/Copyright.htm for details.
00009 
00010      This software is distributed WITHOUT ANY WARRANTY; without even
00011      the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
00012      PURPOSE.  See the above copyright notice for more information.
00013 
00014 =========================================================================*/
00026 #ifndef __vtkByteSwap_h
00027 #define __vtkByteSwap_h
00028 
00029 #include "vtkObject.h"
00030 
00031 class VTK_COMMON_EXPORT vtkByteSwap : public vtkObject
00032 {
00033 public:
00034   static vtkByteSwap *New();
00035   vtkTypeRevisionMacro(vtkByteSwap,vtkObject);
00036 
00037   //BTX
00039 
00042 #define VTK_BYTE_SWAP_DECL(T)                                                   \
00043   static void SwapLE(T* p);                                                     \
00044   static void SwapBE(T* p);                                                     \
00045   static void SwapLERange(T* p, vtkIdType num);                                 \
00046   static void SwapBERange(T* p, vtkIdType num);                                 \
00047   static void SwapLERangeWrite(const T* p, vtkIdType num, FILE* file);          \
00048   static void SwapBERangeWrite(const T* p, vtkIdType num, FILE* file);          \
00049   static void SwapLERangeWrite(const T* p, vtkIdType num, ostream* os);         \
00050   static void SwapBERangeWrite(const T* p, vtkIdType num, ostream* os)
00051   VTK_BYTE_SWAP_DECL(float);
00052   VTK_BYTE_SWAP_DECL(double);
00053   VTK_BYTE_SWAP_DECL(char);
00054   VTK_BYTE_SWAP_DECL(short);
00055   VTK_BYTE_SWAP_DECL(int);
00056   VTK_BYTE_SWAP_DECL(long);
00057   VTK_BYTE_SWAP_DECL(signed char);
00058   VTK_BYTE_SWAP_DECL(unsigned char);
00059   VTK_BYTE_SWAP_DECL(unsigned short);
00060   VTK_BYTE_SWAP_DECL(unsigned int);
00061   VTK_BYTE_SWAP_DECL(unsigned long);
00062 #if defined(VTK_DECL_USE_LONG_LONG)
00063   VTK_BYTE_SWAP_DECL(long long);
00064   VTK_BYTE_SWAP_DECL(unsigned long long);
00066 #endif
00067 #if defined(VTK_DECL_USE___INT64)
00068   VTK_BYTE_SWAP_DECL(__int64);
00069   VTK_BYTE_SWAP_DECL(unsigned __int64);
00070 #endif
00071 #undef VTK_BYTE_SWAP_DECL
00072   //ETX
00073 
00075 
00076   static void Swap2LE(void* p);
00077   static void Swap4LE(void* p);
00078   static void Swap8LE(void* p);
00080 
00082 
00084   static void Swap2LERange(void* p, int num);
00085   static void Swap4LERange(void* p, int num);
00086   static void Swap8LERange(void* p, int num);
00088 
00090 
00093   static void SwapWrite2LERange(const void* p, int num, FILE* f);
00094   static void SwapWrite4LERange(const void* p, int num, FILE* f);
00095   static void SwapWrite8LERange(const void* p, int num, FILE* f);
00096   static void SwapWrite2LERange(const void* p, int num, ostream* os);
00097   static void SwapWrite4LERange(const void* p, int num, ostream* os);
00098   static void SwapWrite8LERange(const void* p, int num, ostream* os);
00100 
00102 
00103   static void Swap2BE(void* p);
00104   static void Swap4BE(void* p);
00105   static void Swap8BE(void* p);
00107 
00109 
00110   static void Swap2BERange(void* p, int num);
00111   static void Swap4BERange(void* p, int num);
00112   static void Swap8BERange(void* p, int num);
00114 
00116 
00119   static void SwapWrite2BERange(const void* p, int num, FILE* f);
00120   static void SwapWrite4BERange(const void* p, int num, FILE* f);
00121   static void SwapWrite8BERange(const void* p, int num, FILE* f);
00122   static void SwapWrite2BERange(const void* p, int num, ostream* os);
00123   static void SwapWrite4BERange(const void* p, int num, ostream* os);
00124   static void SwapWrite8BERange(const void* p, int num, ostream* os);
00126 
00129   static void SwapVoidRange(void *buffer, int numWords, int wordSize);
00130 
00131 protected:
00132   vtkByteSwap();
00133   ~vtkByteSwap();
00134 
00135 private:
00136   vtkByteSwap(const vtkByteSwap&);  // Not implemented.
00137   void operator=(const vtkByteSwap&);  // Not implemented.
00138 };
00139 
00140 #endif

Generated on Mon Jan 21 23:07:16 2008 for VTK by  doxygen 1.4.3-20050530