]> Creatis software - gdcm.git/blobdiff - src/gdcmDictEntry.cxx
Now gdcmParse.cxx is 80 characters line long.
[gdcm.git] / src / gdcmDictEntry.cxx
index 5bcacb34fbe1960b1d907bdef4eec08229a56372..1e135cb65dae7045e178320209bfad79d0e3628b 100644 (file)
@@ -1,14 +1,29 @@
-#include "gdcmlib.h"
+// gdcmDictEntry.cxx
+
+//This is needed when compiling in debug mode
+#ifdef _MSC_VER
+// 'identifier' : class 'type' needs to have dll-interface to be used by
+// clients of class 'type2'
+#pragma warning ( disable : 4251 )
+// 'identifier' : identifier was truncated to 'number' characters in the
+// debug information
+#pragma warning ( disable : 4786 )
+#endif //_MSC_VER
+
+#include <stdio.h>    // FIXME For sprintf
+#include "gdcmDictEntry.h"
+#include "gdcmUtil.h"
+
 
 gdcmDictEntry::gdcmDictEntry(guint16 InGroup, guint16 InElement,
-                             string  InVr, string InFourth, string InName) 
-{
-       group = InGroup;
-       element = InElement;
-       vr = InVr;
-       fourth = InFourth;
-       name = InName;
-       key = TranslateToKey(group, element);
+                             std::string  InVr, std::string InFourth,
+                             std::string  InName) {
+       group           = InGroup;
+       element         = InElement;
+       vr              = InVr;
+       fourth          = InFourth;
+       name            = InName;
+       key             = TranslateToKey(group, element);
 }
 
 TagKey gdcmDictEntry::TranslateToKey(guint16 group, guint16 element) {
@@ -21,3 +36,23 @@ TagKey gdcmDictEntry::TranslateToKey(guint16 group, guint16 element) {
        key = trash;  // Convertion through assignement
        return key;
 }
+
+/**
+ * \ingroup     gdcmDictEntry
+ * \brief       If-and only if-the vr is unset then overwrite it.
+ * @param NewVr New vr to be set.
+ */
+void gdcmDictEntry::SetVR(std::string NewVr) {
+       if ( IsVrUnknown() )
+               vr = NewVr;
+       else {
+               dbg.Error(true, "gdcmDictEntry::SetVR",
+                         "Overwriting vr might compromise a dictionary");
+       }
+}
+
+bool gdcmDictEntry::IsVrUnknown() {
+       if ( vr == "Unknown" )
+               return true;
+       return false;
+}