Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015 #ifndef GDCMSWAPPER_H
00016 #define GDCMSWAPPER_H
00017
00018 #include "gdcmSwapCode.h"
00019
00020 namespace gdcm
00021 {
00022
00023
00024 #ifdef GDCM_WORDS_BIGENDIAN
00025 class SwapperDoOp
00026 {
00027 public:
00028 template <typename T> static T Swap(T val) {return val;}
00029 template <typename T> static void SwapArray(T *, unsigned int ) {}
00030 };
00031
00032 class SwapperNoOp
00033 {
00034 public:
00035 template <typename T> static T Swap(T val);
00036 template <typename T>
00037 static void SwapArray(T *array, unsigned int n)
00038 {
00039
00040 for(unsigned int i = 0; i < n; ++i)
00041 {
00042 array[i] = Swap<T>(array[i]);
00043 }
00044 }
00045 };
00046 #else
00047 class SwapperNoOp
00048 {
00049 public:
00050 template <typename T> static T Swap(T val) {return val;}
00051 template <typename T> static void SwapArray(T *, unsigned int ) {}
00052 };
00053
00054 class SwapperDoOp
00055 {
00056 public:
00057 template <typename T> static T Swap(T val);
00058 template <typename T>
00059 static void SwapArray(T *array, unsigned int n)
00060 {
00061
00062 for(unsigned int i = 0; i < n; ++i)
00063 {
00064 array[i] = Swap<T>(array[i]);
00065 }
00066 }
00067 };
00068 #endif
00069
00070
00071 }
00072
00073 #include "gdcmSwapper.txx"
00074
00075 #endif //GDCMSWAPPER_H