gdcmDictEntry.h
Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015 #ifndef __gdcmDictEntry_h
00016 #define __gdcmDictEntry_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 DictEntry
00038 {
00039 public:
00040 DictEntry(const char *name = "", VR const &vr = VR::INVALID, VM const &vm = VM::VM0, bool ret = false):Name(name),ValueRepresentation(vr),ValueMultiplicity(vm),Retired(ret),GroupXX(false),ElementXX(false) {
00041
00042
00043
00044
00045
00046
00047 }
00048 #if 0
00049
00050 DictEntry(const char *name, const char *vr, const char *vm) {
00051 if(name) Name = name;
00052 ValueRepresentation = VR::GetVRType(vr);
00053 ValueMultiplicity = VM::GetVMType(vm);
00054 Retired = false;
00055 GroupXX = false;
00056 ElementXX = false;
00057 }
00058 #endif
00059
00060 friend std::ostream& operator<<(std::ostream& _os, const DictEntry &_val);
00061
00063 const VR &GetVR() const { return ValueRepresentation; }
00064 void SetVR(const VR & vr) { ValueRepresentation = vr; }
00065
00066
00067
00069 const VM &GetVM() const { return ValueMultiplicity; }
00070 void SetVM(VM const & vm) { ValueMultiplicity = vm; }
00071
00073 const char *GetName() const { return Name.c_str(); }
00074 void SetName(const char* name) { Name = name; }
00075
00077 const char *GetKeyword() const { return ""; }
00078
00080 bool GetRetired() const { return Retired; }
00081 void SetRetired(bool retired) { Retired = retired; }
00082
00083
00085 void SetGroupXX(bool v) { GroupXX = v; }
00086
00087
00089 void SetElementXX(bool v) { ElementXX = v; }
00090
00093 bool IsUnique() const { return ElementXX == false && GroupXX == false; }
00094
00095 private:
00096 std::string Name;
00097 VR ValueRepresentation;
00098 VM ValueMultiplicity;
00099 bool Retired : 1;
00100 bool GroupXX : 1;
00101 bool ElementXX : 1;
00102 };
00103
00104 #if 0
00105 class GDCM_EXPORT PrivateDictEntry : public DictEntry
00106 {
00107 public:
00108 PrivateDictEntry(const char *name = "", VR::VRType const &vr = VR::INVALID, VM::VMType const &vm = VM::VM0 , bool ret = false, const char *owner = ""):DictEntry(name,vr,vm,ret),Owner(owner) {}
00109 PrivateDictEntry(const char *name, const char *vr, const char *vm):DictEntry(name,vr,vm) {}
00110
00111 const char *GetOwner() const { return Owner.c_str(); }
00112 void SetOwner(const char *owner) { Owner = owner; }
00113
00114 private:
00115
00116 std::string Owner;
00117 };
00118 #endif
00119
00120
00121 inline std::ostream& operator<<(std::ostream& os, const DictEntry &val)
00122 {
00123 if( val.Name.empty() )
00124 {
00125 os << "[No name]";
00126 }
00127 else
00128 {
00129 os << val.Name;
00130 }
00131 os << "\t" << val.ValueRepresentation << "\t" << val.ValueMultiplicity;
00132 if( val.Retired )
00133 {
00134 os << "\t(RET)";
00135 }
00136 return os;
00137 }
00138
00139 }
00140
00141 #endif //__gdcmDictEntry_h