]> Creatis software - gdcm.git/blob - src/gdcmElValSet.cxx
* src/gdcmHeader.cxx :
[gdcm.git] / src / gdcmElValSet.cxx
1 #include "gdcmlib.h"
2 #include "gdcmUtil.h"
3
4 void ElValSet::Add(ElValue * newElValue) {
5         tagHt[newElValue->GetKey()]   = newElValue;
6         NameHt[newElValue->GetName()] = newElValue;
7 }
8
9 void ElValSet::Print(ostream & os) {
10         for (TagElValueHT::iterator tag = tagHt.begin();
11                   tag != tagHt.end();
12                   ++tag){
13                 os << tag->first << ": ";
14                 os << "[" << tag->second->GetValue() << "]";
15                 os << "[" << tag->second->GetName()  << "]";
16                 os << "[" << tag->second->GetVR()    << "]" << endl;
17         }
18 }
19
20 void ElValSet::PrintByName(ostream & os) {
21         for (TagElValueNameHT::iterator tag = NameHt.begin();
22                   tag != NameHt.end();
23                   ++tag){
24                 os << tag->first << ": ";
25                 os << "[" << tag->second->GetValue() << "]";
26                 os << "[" << tag->second->GetKey()  << "]";
27                 os << "[" << tag->second->GetVR()    << "]" << endl;
28         }
29 }
30
31 string ElValSet::GetElValue(guint32 group, guint32 element) {
32         TagKey key = gdcmDictEntry::TranslateToKey(group, element);
33         if ( ! tagHt.count(key))
34                 return "UNFOUND";
35         if (tagHt.count(key) > 1)
36                 dbg.Verbose(0, "ElValSet::GetElValue",
37                             "multiple entries for this key (FIXME) !");
38         return tagHt.find(key)->second->GetValue();
39 }
40
41 string ElValSet::GetElValue(string TagName) {
42         if ( ! NameHt.count(TagName))
43                 return "UNFOUND";
44         if (NameHt.count(TagName) > 1)
45                 dbg.Verbose(0, "ElValSet::GetElValue",
46                             "multipe entries for this key (FIXME) !");
47         return NameHt.find(TagName)->second->GetValue();
48 }
49