]> Creatis software - gdcm.git/blobdiff - src/gdcmDict.cxx
Commenataires?
[gdcm.git] / src / gdcmDict.cxx
index 8b42624d8924da9e841ddcf64e8d2b393c451ded..32cc12467410975dd91ebb1ae9c0f8dd8fa22977 100644 (file)
@@ -1,11 +1,12 @@
+// gdcmDict.cxx
+
 #include <fstream>
-#include "gdcmlib.h"
+#include "gdcm.h"
 #include "gdcmUtil.h"
 
-gdcmDict::gdcmDict(char * FileName) {
+gdcmDict::gdcmDict(const char* FileName) {
        std::ifstream from(FileName);
-       dbg.Error(!from, "gdcmDictSet::gdcmDictSet:",
-                 "can't open dictionary");
+       dbg.Error(!from, "gdcmDict::gdcmDict: can't open dictionary", FileName);
        guint16 group, element;
        // CLEANME : use defines for all those constants
        char buff[1024];
@@ -38,8 +39,14 @@ void gdcmDict::Print(ostream& os) {
     }
 }
 
+// renvoie une ligne de Dictionnaire Dicom à partir de (numGroup, numElement)
+
 gdcmDictEntry * gdcmDict::GetTag(guint32 group, guint32 element) {
        TagKey key = gdcmDictEntry::TranslateToKey(group, element);
-       TagHT::iterator found = entries.find(key);
-       return found->second;
+       if ( ! entries.count(key))
+               return (gdcmDictEntry*)0; 
+       if (entries.count(key) > 1)
+               dbg.Verbose(0, "gdcmDict::GetTag", 
+                           "multiple entries for this key (FIXME) !");
+       return entries.find(key)->second;
 }