gdcmSwapper.h
Go to the documentation of this file.
/*=========================================================================
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 <typename T> static T Swap(T val) {return val;}
template <typename T> static void SwapArray(T *, size_t ) {}
};
class SwapperNoOp
{
public:
template <typename T> static T Swap(T val);
template <typename T>
static void SwapArray(T *array, size_t n)
{
// TODO: need to unroll loop:
for(size_t i = 0; i < n; ++i)
{
array[i] = Swap<T>(array[i]);
}
}
};
#else
class SwapperNoOp
{
public:
template <typename T> static T Swap(T val) {return val;}
template <typename T> static void SwapArray(T *, size_t ) {}
};
class SwapperDoOp
{
public:
template <typename T> static T Swap(T val);
template <typename T>
static void SwapArray(T *array, size_t n)
{
// TODO: need to unroll loop:
for(size_t i = 0; i < n; ++i)
{
array[i] = Swap<T>(array[i]);
}
}
};
#endif
} // end namespace gdcm
#include "gdcmSwapper.txx"
#endif //GDCMSWAPPER_H
gdcm::SwapperDoOp
Definition gdcmSwapper.h:54
gdcm::SwapperDoOp::SwapArray
static void SwapArray(T *array, size_t n)
Definition gdcmSwapper.h:58
gdcm::SwapperDoOp::Swap
static T Swap(T val)
gdcm::SwapperNoOp
Definition gdcmSwapper.h:47
gdcm::SwapperNoOp::Swap
static T Swap(T val)
Definition gdcmSwapper.h:49
gdcm::SwapperNoOp::SwapArray
static void SwapArray(T *, size_t)
Definition gdcmSwapper.h:50
gdcmSwapCode.h
gdcm
Definition gdcmASN1.h:21