]> Creatis software - gdcm.git/blob - src/gdcmObject.cxx
* Bug fix on field having a VR = 'UI'. Assume that is a string field
[gdcm.git] / src / gdcmObject.cxx
1 // gdcmObject.cxx
2 //-----------------------------------------------------------------------------
3 #include "gdcmObject.h"
4 #include "gdcmUtil.h"
5
6 //-----------------------------------------------------------------------------
7 // Constructor / Destructor
8 gdcmObject::gdcmObject(ListTag::iterator begin,ListTag::iterator end) 
9 {
10    beginObj=begin;
11    endObj=end;
12
13    if(beginObj==endObj)
14       dbg.Verbose(0, "gdcmObject::gdcmObject empty list");
15 }
16
17 gdcmObject::~gdcmObject(void) 
18 {
19 }
20
21 //-----------------------------------------------------------------------------
22 // Print
23 void gdcmObject::Print(std::ostream &os)
24 {
25    for(ListTag::iterator i=beginObj;i!=endObj;++i)
26    {
27       (*i)->SetPrintLevel(printLevel);
28       (*i)->Print(os);
29    }
30 }
31
32 //-----------------------------------------------------------------------------
33 // Public
34 std::string gdcmObject::GetEntryByNumber(guint16 group, guint16 element) 
35 {
36    for(ListTag::iterator i=beginObj;i!=endObj;++i)
37    {
38       if ( (*i)->GetGroup()==group && (*i)->GetElement()==element)
39          return (*i)->GetValue();
40    }
41    
42    return GDCM_UNFOUND;
43 }
44
45
46 std::string gdcmObject::GetEntryByName(TagName name) 
47 {
48    gdcmDict *PubDict=gdcmGlobal::GetDicts()->GetDefaultPubDict();
49    gdcmDictEntry *dictEntry = (*PubDict).GetDictEntryByName(name); 
50
51    if( dictEntry == NULL)
52       return GDCM_UNFOUND;
53    return GetEntryByNumber(dictEntry->GetGroup(),dictEntry->GetElement()); 
54 }
55
56 //-----------------------------------------------------------------------------
57 // Protected
58
59 //-----------------------------------------------------------------------------
60 // Private
61
62 //-----------------------------------------------------------------------------