]> Creatis software - gdcm.git/blob - src/gdcmElValSet.cxx
Commenataires?
[gdcm.git] / src / gdcmElValSet.cxx
1 // gdcmElValSet.cxx
2
3 #include "gdcm.h"
4 #include "gdcmUtil.h"
5
6 TagElValueHT & ElValSet::GetTagHt(void) {
7         return tagHt;
8 }
9
10 void ElValSet::Add(ElValue * newElValue) {
11         tagHt[newElValue->GetKey()]   = newElValue;
12         NameHt[newElValue->GetName()] = newElValue;
13 }
14
15 void ElValSet::Print(ostream & os) {
16         for (TagElValueHT::iterator tag = tagHt.begin();
17                   tag != tagHt.end();
18                   ++tag){
19                 os << tag->first << ": ";
20                 os << "[" << tag->second->GetValue() << "]";
21                 os << "[" << tag->second->GetName()  << "]";
22                 os << "[" << tag->second->GetVR()    << "]" << endl;
23         }
24 }
25
26 void ElValSet::PrintByName(ostream & os) {
27         for (TagElValueNameHT::iterator tag = NameHt.begin();
28                   tag != NameHt.end();
29                   ++tag){
30                 os << tag->first << ": ";
31                 os << "[" << tag->second->GetValue() << "]";
32                 os << "[" << tag->second->GetKey()  << "]";
33                 os << "[" << tag->second->GetVR()    << "]" << endl;
34         }
35 }
36
37 ElValue* ElValSet::GetElementByNumber(guint32 group, guint32 element) {
38         TagKey key = gdcmDictEntry::TranslateToKey(group, element);
39         if ( ! tagHt.count(key))
40                 return (ElValue*)0;
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;
45 }
46
47 ElValue* ElValSet::GetElementByName(string TagName) {
48    if ( ! NameHt.count(TagName))
49       return (ElValue*)0;
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;
54 }
55
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();
64 }
65
66 string ElValSet::GetElValueByName(string TagName) {
67         if ( ! NameHt.count(TagName))
68                 return "gdcm::Unfound";
69         if (NameHt.count(TagName) > 1)
70                 dbg.Verbose(0, "ElValSet::GetElValue",
71                             "multipe entries for this key (FIXME) !");
72         return NameHt.find(TagName)->second->GetValue();
73 }
74