6 TagElValueHT & ElValSet::GetTagHt(void) {
10 void ElValSet::Add(ElValue * newElValue) {
11 tagHt[newElValue->GetKey()] = newElValue;
12 NameHt[newElValue->GetName()] = newElValue;
15 void ElValSet::Print(ostream & os) {
16 for (TagElValueHT::iterator tag = tagHt.begin();
19 os << tag->first << ": ";
20 os << "[" << tag->second->GetValue() << "]";
21 os << "[" << tag->second->GetName() << "]";
22 os << "[" << tag->second->GetVR() << "]" << endl;
26 void ElValSet::PrintByName(ostream & os) {
27 for (TagElValueNameHT::iterator tag = NameHt.begin();
30 os << tag->first << ": ";
31 os << "[" << tag->second->GetValue() << "]";
32 os << "[" << tag->second->GetKey() << "]";
33 os << "[" << tag->second->GetVR() << "]" << endl;
37 ElValue* ElValSet::GetElementByNumber(guint32 group, guint32 element) {
38 TagKey key = gdcmDictEntry::TranslateToKey(group, element);
39 if ( ! tagHt.count(key))
41 if (tagHt.count(key) > 1)
42 dbg.Verbose(0, "ElValSet::GetElementByNumber",
43 "multiple entries for this key (FIXME) !");
44 return tagHt.find(key)->second;
47 ElValue* ElValSet::GetElementByName(string TagName) {
48 if ( ! NameHt.count(TagName))
50 if (NameHt.count(TagName) > 1)
51 dbg.Verbose(0, "ElValSet::GetElement",
52 "multipe entries for this key (FIXME) !");
53 return NameHt.find(TagName)->second;
56 string ElValSet::GetElValueByNumber(guint32 group, guint32 element) {
57 TagKey key = gdcmDictEntry::TranslateToKey(group, element);
58 if ( ! tagHt.count(key))
59 return "gdcm::Unfound";
60 if (tagHt.count(key) > 1)
61 dbg.Verbose(0, "ElValSet::GetElValueByNumber",
62 "multiple entries for this key (FIXME) !");
63 return tagHt.find(key)->second->GetValue();
66 int ElValSet::SetElValueByNumber(string content, guint32 group, guint32 element) {
67 TagKey key = gdcmDictEntry::TranslateToKey(group, element);
68 if ( ! tagHt.count(key))
70 if (tagHt.count(key) > 1) {
71 dbg.Verbose(0, "ElValSet::SetElValueByNumber",
72 "multiple entries for this key (FIXME) !");
76 tagHt[key]->SetValue(content);
80 string ElValSet::GetElValueByName(string TagName) {
81 if ( ! NameHt.count(TagName))
82 return "gdcm::Unfound";
83 if (NameHt.count(TagName) > 1)
84 dbg.Verbose(0, "ElValSet::GetElValue",
85 "multipe entries for this key (FIXME) !");
86 return NameHt.find(TagName)->second->GetValue();
89 int ElValSet::SetElValueByName(string content, string TagName) {
90 if ( ! NameHt.count(TagName))
92 if (NameHt.count(TagName) > 1) {
93 dbg.Verbose(0, "ElValSet::SetElValue",
94 "multipe entries for this key (FIXME) !");
97 NameHt.find(TagName)->second->SetValue(content);