]> Creatis software - gdcm.git/commitdiff
* src/gdcmDictGroupName.cxx : amelioration of print
authorregrain <regrain>
Wed, 6 Apr 2005 08:59:46 +0000 (08:59 +0000)
committerregrain <regrain>
Wed, 6 Apr 2005 08:59:46 +0000 (08:59 +0000)
   * Testing/TestDictGroupName.cxx : amelioration of code. Bug fix
   -- BeNours

Testing/TestDictGroupName.cxx
src/gdcmDictGroupName.cxx

index d8ee70160cd13a5b48c08541be6968ae447e7545..d8f41c61af4a83389ee274e6801200df72deaac3 100644 (file)
@@ -3,8 +3,8 @@
   Program:   gdcm
   Module:    $RCSfile: TestDictGroupName.cxx,v $
   Language:  C++
-  Date:      $Date: 2005/04/05 10:56:24 $
-  Version:   $Revision: 1.1 $
+  Date:      $Date: 2005/04/06 08:59:46 $
+  Version:   $Revision: 1.2 $
                                                                                 
   Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
   l'Image). All rights reserved. See Doc/License.txt or
 #include "gdcmGlobal.h"
 #include "gdcmCommon.h"
 
+#include <iomanip>
+
+int CompareDictGroupName(gdcm::DictGroupName &groupName,
+                         uint16_t group,std::string ref)
+{
+   std::string val = groupName.GetName(group);
+   std::cout << "Group : 0x" << std::hex << std::setw(4) << group 
+             << std::dec << " : " << val << " - " 
+             << (bool)(val==ref) << std::endl;
+
+   return val!=ref;
+}
+
 int TestDictGroupName(int , char *[])
 {
    gdcm::DictGroupName groupName;
    groupName.Print( std::cout );
 
+   int ret = 0;
+
    std::cout << std::endl;
-   std::cout << "Group : 0x0002 : " << groupName.GetName(0x0002) << " - " 
-             << (bool)(groupName.GetName(0x0002)=="Meta Elements") << std::endl;
-   std::cout << "Group : 0x0007 : " << groupName.GetName(0x0007) << " - " 
-             << (bool)(groupName.GetName(0x0007)==gdcm::GDCM_UNFOUND) << std::endl;
+   ret += CompareDictGroupName(groupName,0x0002,"Meta Elements");
+   ret += CompareDictGroupName(groupName,0x7fe0,"Pixels");
+   ret += CompareDictGroupName(groupName,0x0007,gdcm::GDCM_UNFOUND);
 
-   return groupName.GetName( 0x7fe0 ) != "";
+   return ret;
 }
index 680c199d85ab1573d30bbdeddae61c94e4aaf573..3095a4388dbfc0f333d2a6e13aa2071ae00e51a9 100644 (file)
@@ -3,8 +3,8 @@
   Program:   gdcm
   Module:    $RCSfile: gdcmDictGroupName.cxx,v $
   Language:  C++
-  Date:      $Date: 2005/04/05 10:56:25 $
-  Version:   $Revision: 1.1 $
+  Date:      $Date: 2005/04/06 08:59:46 $
+  Version:   $Revision: 1.2 $
                                                                                 
   Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
   l'Image). All rights reserved. See Doc/License.txt or
@@ -23,6 +23,7 @@
 
 #include <fstream>
 #include <iostream>
+#include <iomanip>
 
 namespace gdcm 
 {
@@ -107,8 +108,8 @@ void DictGroupName::Print(std::ostream &os)
 
    for (DictGroupNameHT::iterator it = groupName.begin(); it != groupName.end(); ++it)
    {
-      s << "DictGroupName : " << std::hex << it->first << std::dec 
-        << " = " << it->second << std::endl;
+      s << "DictGroupName : 0x" << std::hex << std::setw(4) << it->first 
+        << std::dec << " = " << it->second << std::endl;
    }
    os << s.str();
 }