00001 // gdcmObject.cxx 00002 //----------------------------------------------------------------------------- 00003 #include "gdcmObject.h" 00004 #include "gdcmUtil.h" 00005 00006 //----------------------------------------------------------------------------- 00007 // Constructor / Destructor 00014 gdcmObject::gdcmObject(ListTag::iterator begin,ListTag::iterator end) 00015 { 00016 beginObj=begin; 00017 endObj=end; 00018 00019 if(beginObj==endObj) 00020 dbg.Verbose(0, "gdcmObject::gdcmObject empty list"); 00021 } 00022 00027 gdcmObject::~gdcmObject(void) 00028 { 00029 } 00030 00031 //----------------------------------------------------------------------------- 00032 // Print 00038 void gdcmObject::Print(std::ostream &os) 00039 { 00040 if(printLevel>=0) 00041 { 00042 for(ListTag::iterator i=beginObj;i!=endObj;++i) 00043 { 00044 (*i)->SetPrintLevel(printLevel); 00045 (*i)->Print(os); 00046 } 00047 } 00048 } 00049 00050 //----------------------------------------------------------------------------- 00051 // Public 00057 std::string gdcmObject::GetEntryByNumber(guint16 group, guint16 element) 00058 { 00059 for(ListTag::iterator i=beginObj;i!=endObj;++i) 00060 { 00061 if ( (*i)->GetGroup()==group && (*i)->GetElement()==element) 00062 return (*i)->GetValue(); 00063 } 00064 00065 return GDCM_UNFOUND; 00066 } 00067 00074 std::string gdcmObject::GetEntryByName(TagName name) 00075 { 00076 gdcmDict *PubDict=gdcmGlobal::GetDicts()->GetDefaultPubDict(); 00077 gdcmDictEntry *dictEntry = (*PubDict).GetDictEntryByName(name); 00078 00079 if( dictEntry == NULL) 00080 return GDCM_UNFOUND; 00081 return GetEntryByNumber(dictEntry->GetGroup(),dictEntry->GetElement()); 00082 } 00083 00089 TagHeaderEntryHT gdcmObject::GetEntry(void) 00090 { 00091 TagHeaderEntryHT HT; 00092 00093 for(ListTag::iterator it=beginObj;it!=endObj;++it) 00094 { 00095 HT.insert( PairHT( (*it)->GetKey(),(*it)) ); 00096 } 00097 00098 return(HT); 00099 } 00100 00106 ListTag gdcmObject::GetListEntry(void) 00107 { 00108 ListTag list; 00109 00110 for(ListTag::iterator it=beginObj;it!=endObj;++it) 00111 { 00112 list.push_back(*it); 00113 } 00114 00115 return(list); 00116 } 00117 00118 //----------------------------------------------------------------------------- 00119 // Protected 00120 00121 //----------------------------------------------------------------------------- 00122 // Private 00123 00124 //-----------------------------------------------------------------------------