GDCM 2.0.17
|
00001 /*========================================================================= 00002 00003 Program: GDCM (Grassroots DICOM). A DICOM library 00004 Module: $URL$ 00005 00006 Copyright (c) 2006-2010 Mathieu Malaterre 00007 All rights reserved. 00008 See Copyright.txt or http://gdcm.sourceforge.net/Copyright.html for details. 00009 00010 This software is distributed WITHOUT ANY WARRANTY; without even 00011 the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR 00012 PURPOSE. See the above copyright notice for more information. 00013 00014 =========================================================================*/ 00015 #ifndef GDCMCSAHEADERDICTENTRY_H 00016 #define GDCMCSAHEADERDICTENTRY_H 00017 00018 #include "gdcmVR.h" 00019 #include "gdcmVM.h" 00020 00021 #include <string> 00022 #include <iostream> 00023 #include <iomanip> 00024 00025 namespace gdcm 00026 { 00037 class GDCM_EXPORT CSAHeaderDictEntry 00038 { 00039 public: 00040 CSAHeaderDictEntry(const char *name = "", VR const &vr = VR::INVALID, VM const &vm = VM::VM0, const char *desc = ""):Name(name),ValueRepresentation(vr),ValueMultiplicity(vm),Description(desc) { 00041 } 00042 00043 friend std::ostream& operator<<(std::ostream& _os, const CSAHeaderDictEntry &_val); 00044 00046 const VR &GetVR() const { return ValueRepresentation; } 00047 void SetVR(const VR & vr) { ValueRepresentation = vr; } 00048 00050 const VM &GetVM() const { return ValueMultiplicity; } 00051 void SetVM(VM const & vm) { ValueMultiplicity = vm; } 00052 00054 const char *GetName() const { return Name.c_str(); } 00055 void SetName(const char* name) { Name = name; } 00056 00058 const char *GetDescription() const { return Description.c_str(); } 00059 void SetDescription(const char* desc) { Description = desc; } 00060 00061 bool operator<(const CSAHeaderDictEntry &entry) const 00062 { 00063 return strcmp(GetName(),entry.GetName()) < 0; 00064 } 00065 00066 private: 00067 std::string Name; 00068 VR ValueRepresentation; 00069 VM ValueMultiplicity; 00070 std::string Description; 00071 std::string Type; // TODO 00072 }; 00073 00074 00075 //----------------------------------------------------------------------------- 00076 inline std::ostream& operator<<(std::ostream& os, const CSAHeaderDictEntry &val) 00077 { 00078 if( val.Name.empty() ) 00079 { 00080 os << "[No name]"; 00081 } 00082 else 00083 { 00084 os << val.Name; 00085 } 00086 os << "\t" << val.ValueRepresentation << "\t" << val.ValueMultiplicity; 00087 if( !val.Description.empty() ) 00088 { 00089 os << "\t" << val.Description; 00090 } 00091 return os; 00092 } 00093 00094 } // end namespace gdcm 00095 00096 #endif //GDCMCSAHEADERDICTENTRY_H