GDCM  2.2.0
gdcmSwapCode.h
Go to the documentation of this file.
00001 /*=========================================================================
00002 
00003   Program: GDCM (Grassroots DICOM). A DICOM library
00004 
00005   Copyright (c) 2006-2011 Mathieu Malaterre
00006   All rights reserved.
00007   See Copyright.txt or http://gdcm.sourceforge.net/Copyright.html for details.
00008 
00009      This software is distributed WITHOUT ANY WARRANTY; without even
00010      the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
00011      PURPOSE.  See the above copyright notice for more information.
00012 
00013 =========================================================================*/
00014 #ifndef GDCMSWAPCODE_H
00015 #define GDCMSWAPCODE_H
00016 
00017 #include "gdcmTypes.h"
00018 #include <iostream>
00019 
00020 namespace gdcm
00021 {
00022 
00027 class GDCM_EXPORT SwapCode
00028 {
00029 public:
00030   typedef enum {
00031     Unknown         = 0,
00032     LittleEndian    = 1234,
00033     BigEndian       = 4321,
00034     BadLittleEndian = 3412,
00035     BadBigEndian    = 2143
00036   } SwapCodeType;
00037 
00038   operator SwapCode::SwapCodeType() const { return SwapCodeValue; }
00039   SwapCode(SwapCodeType sc = Unknown):SwapCodeValue(sc) { }
00040   static const char* GetSwapCodeString(SwapCode const & sc);
00041 
00042   friend std::ostream& operator<<(std::ostream& os, const SwapCode& sc);
00043 protected:
00044   static int GetIndex(SwapCode const & sc);
00045 
00046 private:
00047   SwapCodeType SwapCodeValue;
00048 };
00049 //-----------------------------------------------------------------------------
00050 inline std::ostream& operator<<(std::ostream& os, const SwapCode& sc)
00051 {
00052   os << SwapCode::GetSwapCodeString(sc);
00053   return os;
00054 }
00055 
00056 } // end namespace gdcm
00057 
00058 #endif //GDCMSWAPCODE_H

Generated on Tue Mar 27 2012 13:33:40 for GDCM by doxygen 1.8.0
SourceForge.net Logo