]> Creatis software - gdcm.git/blobdiff - src/gdcmVR.cxx
* src/gdcmDictEntry.h : now, the IsVRUnknown is correct
[gdcm.git] / src / gdcmVR.cxx
index 02eb2c893f34d1717cd805b9da998417e85e4a8f..66006a86f1971b9749ee32dfbca6a8e7b4f31169 100644 (file)
@@ -3,8 +3,8 @@
   Program:   gdcm
   Module:    $RCSfile: gdcmVR.cxx,v $
   Language:  C++
-  Date:      $Date: 2004/11/03 18:08:56 $
-  Version:   $Revision: 1.22 $
+  Date:      $Date: 2005/01/06 13:35:38 $
+  Version:   $Revision: 1.25 $
                                                                                 
   Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
   l'Image). All rights reserved. See Doc/License.txt or
@@ -117,10 +117,10 @@ bool VR::IsVROfGdcmBinaryRepresentable(VRKey const & tested)
    //std::cout << "VR::IsVROfGdcmBinaryRepresentable===================="
    //   << tested << std::endl;
 
-   if ( tested == "unkn")
+   if ( tested == GDCM_UNKNOWN)
       return true;
 
-   if ( ! Count(tested) )
+   if ( ! IsValidVR(tested) )
    {
       dbg.Verbose(0, "VR::IsVROfGdcmBinaryRepresentable: tested not a VR!");
       return false;
@@ -145,23 +145,41 @@ bool VR::IsVROfGdcmBinaryRepresentable(VRKey const & tested)
 bool VR::IsVROfGdcmStringRepresentable(VRKey const & tested)
 {
 
-   if ( ! Count(tested) )
+   if ( ! IsValidVR(tested) )
    {
       dbg.Verbose(0, "VR::IsVROfGdcmStringRepresentable: tested not a VR!");
       return false;
    }
 
-   if (tested == "AE" || tested == "AS" || tested == "DA" || tested == "PN" ||
-       tested == "UI" || tested == "TM" || tested == "SH" || tested == "LO" ||
-       tested == "CS" || tested == "IS" || tested == "LO" || tested == "LT" ||
-       tested == "SH" || tested == "ST" || tested == "DS" || tested == "SL" ||
-       tested == "SS" || tested == "UL" || tested == "US" || tested == "UN")
+   if ( tested == "AE" ||
+        tested == "AS" ||
+        tested == "CS" ||
+        tested == "DA" ||
+        tested == "DS" ||
+        tested == "IS" || 
+        tested == "LO" ||
+        tested == "LT" ||
+        tested == "PN" ||
+        tested == "SH" ||
+        tested == "SL" ||
+        tested == "SS" ||
+        tested == "ST" ||
+        tested == "TM" ||
+        tested == "UI" ||
+        tested == "UL" ||
+        tested == "UN" ||
+        tested == "US" )
    {
       return true;
    }
    return false;
 }
 
+bool VR::IsValidVR(VRKey const & key)
+{
+   return(vr.find(key)!=vr.end());
+}
+
 //-----------------------------------------------------------------------------
 // Protected