/*========================================================================= Program: GDCM (Grassroots DICOM). A DICOM library Copyright (c) 2006-2011 Mathieu Malaterre All rights reserved. See Copyright.txt or http://gdcm.sourceforge.net/Copyright.html for details. This software is distributed WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the above copyright notice for more information. =========================================================================*/ #ifndef GDCMSWAPPER_H #define GDCMSWAPPER_H #include "gdcmSwapCode.h" namespace gdcm { #ifdef GDCM_WORDS_BIGENDIAN class SwapperDoOp { public: template static T Swap(T val) {return val;} template static void SwapArray(T *, size_t ) {} }; class SwapperNoOp { public: template static T Swap(T val); template static void SwapArray(T *array, size_t n) { // TODO: need to unroll loop: for(size_t i = 0; i < n; ++i) { array[i] = Swap(array[i]); } } }; #else class SwapperNoOp { public: template static T Swap(T val) {return val;} template static void SwapArray(T *, size_t ) {} }; class SwapperDoOp { public: template static T Swap(T val); template static void SwapArray(T *array, size_t n) { // TODO: need to unroll loop: for(size_t i = 0; i < n; ++i) { array[i] = Swap(array[i]); } } }; #endif } // end namespace gdcm #include "gdcmSwapper.txx" #endif //GDCMSWAPPER_H