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