GDCM 2.2.1

- Main Page
- Related Pages
- Namespaces
- Classes
- Files
- Examples

- File List
- File Members

gdcmSwapCode.h
Go to the documentation of this file.
1 /*=========================================================================
2
3 Program: GDCM (Grassroots DICOM). A DICOM library
4
5 Copyright (c) 2006-2011 Mathieu Malaterre
6 All rights reserved.
7 See Copyright.txt or http://gdcm.sourceforge.net/Copyright.html for details.
8
9 This software is distributed WITHOUT ANY WARRANTY; without even
10 the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
11 PURPOSE. See the above copyright notice for more information.
12
13 =========================================================================*/
14 #ifndef GDCMSWAPCODE_H
15 #define GDCMSWAPCODE_H
16
17 #include "gdcmTypes.h"
18 #include <iostream>
19
20 namespace gdcm
21 {
22
27 class GDCM_EXPORT SwapCode
28 {
29 public:
30 typedef enum {
31 Unknown = 0,
32 LittleEndian = 1234,
33 BigEndian = 4321,
34 BadLittleEndian = 3412,
35 BadBigEndian = 2143
36 } SwapCodeType;
37
38 operator SwapCode::SwapCodeType() const { return SwapCodeValue; }
39 SwapCode(SwapCodeType sc = Unknown):SwapCodeValue(sc) { }
40 static const char* GetSwapCodeString(SwapCode const & sc);
41
42 friend std::ostream& operator<<(std::ostream& os, const SwapCode& sc);
43 protected:
44 static int GetIndex(SwapCode const & sc);
45
46 private:
47 SwapCodeType SwapCodeValue;
48 };
49 //-----------------------------------------------------------------------------
50 inline std::ostream& operator<<(std::ostream& os, const SwapCode& sc)
51 {
52 os << SwapCode::GetSwapCodeString(sc);
53 return os;
54 }
55
56 } // end namespace gdcm
57
58 #endif //GDCMSWAPCODE_H