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