]> Creatis software - gdcm.git/blob - src/gdcmObject.cxx
* gdcmDirList : to parse a hard drive directory in recursive (or not)
[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    if(printLevel>=0)
26    {
27       for(ListTag::iterator i=beginObj;i!=endObj;++i)
28       {
29          (*i)->SetPrintLevel(printLevel);
30          (*i)->Print(os);
31       }
32    }
33 }
34
35 //-----------------------------------------------------------------------------
36 // Public
37 std::string gdcmObject::GetEntryByNumber(guint16 group, guint16 element) 
38 {
39    for(ListTag::iterator i=beginObj;i!=endObj;++i)
40    {
41       if ( (*i)->GetGroup()==group && (*i)->GetElement()==element)
42          return (*i)->GetValue();
43    }
44    
45    return GDCM_UNFOUND;
46 }
47
48
49 std::string gdcmObject::GetEntryByName(TagName name) 
50 {
51    gdcmDict *PubDict=gdcmGlobal::GetDicts()->GetDefaultPubDict();
52    gdcmDictEntry *dictEntry = (*PubDict).GetDictEntryByName(name); 
53
54    if( dictEntry == NULL)
55       return GDCM_UNFOUND;
56    return GetEntryByNumber(dictEntry->GetGroup(),dictEntry->GetElement()); 
57 }
58
59 //-----------------------------------------------------------------------------
60 // Protected
61
62 //-----------------------------------------------------------------------------
63 // Private
64
65 //-----------------------------------------------------------------------------