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 = "", const char *keyword = "", VR const &vr = VR::INVALID, VM const &vm = VM::VM0, bool ret = false):
00041 Name(name),
00042 Keyword(keyword),
00043 ValueRepresentation(vr),
00044 ValueMultiplicity(vm),
00045 Retired(ret),
00046 GroupXX(false),
00047 ElementXX(false)
00048 {
00049 }
00050
00051 friend std::ostream& operator<<(std::ostream& _os, const DictEntry &_val);
00052
00054 const VR &GetVR() const { return ValueRepresentation; }
00055 void SetVR(const VR & vr) { ValueRepresentation = vr; }
00056
00057
00058
00060 const VM &GetVM() const { return ValueMultiplicity; }
00061 void SetVM(VM const & vm) { ValueMultiplicity = vm; }
00062
00064 const char *GetName() const { return Name.c_str(); }
00065 void SetName(const char* name) { Name = name; }
00066
00068 const char *GetKeyword() const { return Keyword.c_str(); }
00069 void SetKeyword(const char* keyword) { Keyword = keyword; }
00070
00072 bool GetRetired() const { return Retired; }
00073 void SetRetired(bool retired) { Retired = retired; }
00074
00075
00077 void SetGroupXX(bool v) { GroupXX = v; }
00078
00079
00081 void SetElementXX(bool v) { ElementXX = v; }
00082
00085 bool IsUnique() const { return ElementXX == false && GroupXX == false; }
00086
00087 private:
00088
00089 static bool CheckKeywordAgainstName(const char *name, const char *keyword);
00090
00091 private:
00092 std::string Name;
00093 std::string Keyword;
00094 VR ValueRepresentation;
00095 VM ValueMultiplicity;
00096 bool Retired : 1;
00097 bool GroupXX : 1;
00098 bool ElementXX : 1;
00099 };
00100
00101 #if 0
00102 class GDCM_EXPORT PrivateDictEntry : public DictEntry
00103 {
00104 public:
00105 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) {}
00106 PrivateDictEntry(const char *name, const char *vr, const char *vm):DictEntry(name,vr,vm) {}
00107
00108 const char *GetOwner() const { return Owner.c_str(); }
00109 void SetOwner(const char *owner) { Owner = owner; }
00110
00111 private:
00112
00113 std::string Owner;
00114 };
00115 #endif
00116
00117
00118 inline std::ostream& operator<<(std::ostream& os, const DictEntry &val)
00119 {
00120 if( val.Name.empty() )
00121 {
00122 os << "[No name]";
00123 }
00124 else
00125 {
00126 os << val.Name;
00127 }
00128 os << "\t" << val.ValueRepresentation << "\t" << val.ValueMultiplicity;
00129 if( val.Retired )
00130 {
00131 os << "\t(RET)";
00132 }
00133 return os;
00134 }
00135
00136 }
00137
00138 #endif //GDCMDICTENTRY_H