]> Creatis software - gdcm.git/commitdiff
ENH: Finally I got ArgMgr to be const string instead of char*... strcasecmp is POSIX...
authormalaterre <malaterre>
Thu, 26 Jan 2006 15:52:38 +0000 (15:52 +0000)
committermalaterre <malaterre>
Thu, 26 Jan 2006 15:52:38 +0000 (15:52 +0000)
13 files changed:
Dicts/CMakeLists.txt
Example/AnonymizeNoLoad.cxx
Example/MagnetomVisionToBrucker.cxx
Example/MakeDicomDir.cxx
Example/PatchHeader.cxx
Example/PhilipsToBrucker.cxx
Example/PhilipsToBrucker2.cxx
Example/PrintFile.cxx
Example/RawToDicom.cxx
Example/ReWrite.cxx
Example/exXCoherentFileSet.cxx
src/gdcmArgMgr.cxx
src/gdcmArgMgr.h

index c80ef577b0c69c6a12984014581c8886da3daa0d..ca7ee0f5feace1bbd7c829219df895a8075d6527 100644 (file)
@@ -5,10 +5,13 @@
 # Generate our own 'DICOM' dictionary, based on the following dictionaries:
 SET(ALL_DICTS
   dicomV3.dic
-  Papyrus.dic
-  NIH.dic     #the forbidden one...
-  SPI.dic
+  #Papyrus.dic
+  #NIH.dic     #the forbidden one...
+  #  SPI.dic
   #  PHILIPS-Intera.dic # uncomment me if you want
+  GEMS.dic
+  #GEMS-HiSpeed.dic
+  #  GEMS-Advance.dic
   )
 
 # Better solution
index 298e5dcee5ce2cee9c075d5e82306a5c75e2348b..b212f36b9dbd2b2dfc79390d8cc00b85a7e399d6 100644 (file)
@@ -3,8 +3,8 @@
   Program:   gdcm
   Module:    $RCSfile: AnonymizeNoLoad.cxx,v $
   Language:  C++
-  Date:      $Date: 2006/01/02 15:16:38 $
-  Version:   $Revision: 1.15 $
+  Date:      $Date: 2006/01/26 15:52:42 $
+  Version:   $Revision: 1.16 $
                                                                                 
   Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
   l'Image). All rights reserved. See Doc/License.txt or
@@ -60,8 +60,8 @@ int main(int argc, char *argv[])
    if (am->ArgMgrDefined("debug"))
       gdcm::Debug::DebugOn();
 
-   char *fileName = am->ArgMgrGetString("filein",(char *)0);
-   char *dirName  = am->ArgMgrGetString("dirin",(char *)0);
+   const char *fileName = am->ArgMgrGetString("filein");
+   const char *dirName  = am->ArgMgrGetString("dirin");
 
    if ( (fileName == 0 && dirName == 0)
         ||
index 684994cab11892c2e8344a86eb2fe573dc3e537c..cf3b7a48486f27b36c9de8de56ebba7a4f2870ed 100755 (executable)
@@ -3,8 +3,8 @@
   Program:   gdcm
   Module:    $RCSfile: MagnetomVisionToBrucker.cxx,v $
   Language:  C++
-  Date:      $Date: 2006/01/25 16:59:19 $
-  Version:   $Revision: 1.2 $
+  Date:      $Date: 2006/01/26 15:52:42 $
+  Version:   $Revision: 1.3 $
                                                                                 
   Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
   l'Image). All rights reserved. See Doc/License.txt or
@@ -108,11 +108,11 @@ int main(int argc, char *argv[])
       return 0;
    }
 
-   char *dirNamein;   
-   dirNamein  = am->ArgMgrGetString("dirin",(char *)"."); 
+   const char *dirNamein;   
+   dirNamein  = am->ArgMgrGetString("dirin","."); 
 
-   char *dirNameout;   
-   dirNameout  = am->ArgMgrGetString("dirout",(char *)".");  
+   const char *dirNameout;   
+   dirNameout  = am->ArgMgrGetString("dirout",".");  
    
    int loadMode = gdcm::LD_ALL;
    if ( am->ArgMgrDefined("noshadowseq") )
@@ -144,7 +144,7 @@ int main(int argc, char *argv[])
       return 0;         
    }
    
-   char *extent  = am->ArgMgrGetString("extent",".DCM");
+   const char *extent  = am->ArgMgrGetString("extent",".DCM");
    
    // if unused Param we give up
    if ( am->ArgMgrPrintUnusedLabels() )
index c72007169fb10fab9469d732779bd36ab9648818..2fc7051e17dea5693e1f34db09c39649bce0e4df 100644 (file)
@@ -3,8 +3,8 @@
   Program:   gdcm
   Module:    $RCSfile: MakeDicomDir.cxx,v $
   Language:  C++
-  Date:      $Date: 2006/01/18 10:20:56 $
-  Version:   $Revision: 1.19 $
+  Date:      $Date: 2006/01/26 15:52:42 $
+  Version:   $Revision: 1.20 $
                                                                                 
   Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
   l'Image). All rights reserved. See Doc/License.txt or
@@ -61,11 +61,11 @@ int main(int argc, char *argv[])
       return 0;
    }
 
-   char *dirName;   
-   dirName  = am->ArgMgrGetString("dirName",(char *)"."); 
+   const char *dirName;   
+   dirName  = am->ArgMgrGetString("dirName","."); 
 
-   char *name;
-   name  = am->ArgMgrGetString("name",(char *)"DICOMDIR");
+   const char *name;
+   name  = am->ArgMgrGetString("name","DICOMDIR");
    
    int loadMode = gdcm::LD_ALL;
    if ( am->ArgMgrDefined("noshadowseq") )
index e88de9161a81fa8211ccae3619e37539b92da934..f93cc5d348cce84839671b6fe18ca79a69b78089 100644 (file)
@@ -3,8 +3,8 @@
   Program:   gdcm
   Module:    $RCSfile: PatchHeader.cxx,v $
   Language:  C++
-  Date:      $Date: 2005/10/25 14:52:27 $
-  Version:   $Revision: 1.5 $
+  Date:      $Date: 2006/01/26 15:52:42 $
+  Version:   $Revision: 1.6 $
                                                                                 
   Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
   l'Image). All rights reserved. See Doc/License.txt or
@@ -192,8 +192,8 @@ int main(int argc, char *argv[])
       return 0;
    }
 
-   char *fileName = am->ArgMgrGetString("filein",(char *)0);
-   char *dirName  = am->ArgMgrGetString("dirin",(char *)0);
+   const char *fileName = am->ArgMgrGetString("filein");
+   const char *dirName  = am->ArgMgrGetString("dirin");
 
    if ( (fileName == 0 && dirName == 0)
         ||
index a532b83adb3a06ada8bd239402c88731dfd705c8..a1cbe760c4ca4ff6492046818e8c62d46d797d71 100755 (executable)
@@ -3,8 +3,8 @@
   Program:   gdcm
   Module:    $RCSfile: PhilipsToBrucker.cxx,v $
   Language:  C++
-  Date:      $Date: 2006/01/18 15:45:20 $
-  Version:   $Revision: 1.5 $
+  Date:      $Date: 2006/01/26 15:52:42 $
+  Version:   $Revision: 1.6 $
                                                                                 
   Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
   l'Image). All rights reserved. See Doc/License.txt or
@@ -92,11 +92,11 @@ int main(int argc, char *argv[])
       return 0;
    }
 
-   char *dirNamein;
-   dirNamein  = am->ArgMgrGetString("dirin",(char *)"."); 
+   const char *dirNamein;
+   dirNamein  = am->ArgMgrGetString("dirin","."); 
 
-   char *dirNameout;   
-   dirNameout  = am->ArgMgrGetString("dirout",(char *)".");  
+   const char *dirNameout;   
+   dirNameout  = am->ArgMgrGetString("dirout",".");  
    
    int loadMode = gdcm::LD_ALL;
    if ( am->ArgMgrDefined("noshadowseq") )
@@ -126,7 +126,7 @@ int main(int argc, char *argv[])
       return 0;         
    }
    
-   char *extent  = am->ArgMgrGetString("extent",".DCM");
+   const char *extent  = am->ArgMgrGetString("extent",".DCM");
         
    // if unused Param we give up
    if ( am->ArgMgrPrintUnusedLabels() )
index 3d818200af57bc2c07662bbb0eafc2fd098a736d..fb5ea0cfb14c5ae41e5332094c9171e5e75f4168 100755 (executable)
@@ -3,8 +3,8 @@
   Program:   gdcm
   Module:    $RCSfile: PhilipsToBrucker2.cxx,v $
   Language:  C++
-  Date:      $Date: 2006/01/25 17:02:00 $
-  Version:   $Revision: 1.9 $
+  Date:      $Date: 2006/01/26 15:52:43 $
+  Version:   $Revision: 1.10 $
                                                                                 
   Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
   l'Image). All rights reserved. See Doc/License.txt or
@@ -110,11 +110,11 @@ int main(int argc, char *argv[])
       return 0;
    }
 
-   char *dirNamein;   
-   dirNamein  = am->ArgMgrGetString("dirin",(char *)"."); 
+   const char *dirNamein;   
+   dirNamein  = am->ArgMgrGetString("dirin","."); 
 
-   char *dirNameout;   
-   dirNameout  = am->ArgMgrGetString("dirout",(char *)".");  
+   const char *dirNameout;   
+   dirNameout  = am->ArgMgrGetString("dirout",".");  
    
    int loadMode = gdcm::LD_ALL;
    if ( am->ArgMgrDefined("noshadowseq") )
@@ -146,7 +146,7 @@ int main(int argc, char *argv[])
       return 0;         
    }
    
-   char *extent  = am->ArgMgrGetString("extent",".DCM");
+   const char *extent  = am->ArgMgrGetString("extent",".DCM");
    
    // if unused Param we give up
    if ( am->ArgMgrPrintUnusedLabels() )
index f3b9da41aad9ae5526feac02a9e4be7375317a8b..a8c61272cae5bfee80e249794a850508cd0749a0 100644 (file)
@@ -3,8 +3,8 @@
   Program:   gdcm
   Module:    $RCSfile: PrintFile.cxx,v $
   Language:  C++
-  Date:      $Date: 2006/01/19 11:43:48 $
-  Version:   $Revision: 1.78 $
+  Date:      $Date: 2006/01/26 15:52:43 $
+  Version:   $Revision: 1.79 $
                                                                                 
   Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
   l'Image). All rights reserved. See Doc/License.txt or
@@ -151,8 +151,8 @@ int main(int argc, char *argv[])
       return 1;
    }
 
-   char *fileName = am->ArgMgrGetString("filein",(char *)0);
-   char *dirName  = am->ArgMgrGetString("dirin",(char *)0);
+   const char *fileName = am->ArgMgrGetString("filein");
+   const char *dirName  = am->ArgMgrGetString("dirin");
 
    if ( (fileName == 0 && dirName == 0) ||
         (fileName != 0 && dirName != 0) )
@@ -191,11 +191,11 @@ int main(int argc, char *argv[])
    bool showlut = ( 0 != am->ArgMgrDefined("SHOWLUT") );
 
    bool ddict = am->ArgMgrDefined("dict") ? true : false;
-   char *dict = 0;
+   const char *dict = 0;
 
    if (ddict)
    {
-     dict = am->ArgMgrGetString("dict",(char *)0);
+     dict = am->ArgMgrGetString("dict",0);
    }
 
    /* if unused Param we give up */
index f0c469aee6137dba578390505c8691825492ea03..9ad14ca1b64672e4afdc436c0f8b6c04cb133fc5 100755 (executable)
@@ -3,8 +3,8 @@
   Program:   gdcm
   Module:    $RCSfile: RawToDicom.cxx,v $
   Language:  C++
-  Date:      $Date: 2005/12/16 16:38:24 $
-  Version:   $Revision: 1.4 $
+  Date:      $Date: 2006/01/26 15:52:43 $
+  Version:   $Revision: 1.5 $
                                                                                 
   Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
   l'Image). All rights reserved. See Doc/License.txt or
@@ -61,11 +61,11 @@ int main(int argc, char *argv[])
       return 1;
    }
 
-   char *inputFileName  = am->ArgMgrGetString("filein",(char *)0);
-   char *outputFileName = am->ArgMgrGetString("fileout",(char *)0);   
-   //char *dirName        = am->ArgMgrGetString("dirin",(char *)0);
+   const char *inputFileName  = am->ArgMgrGetString("filein");
+   const char *outputFileName = am->ArgMgrGetString("fileout");
+   //const char *dirName        = am->ArgMgrGetString("dirin");
    
-   char *patientName = am->ArgMgrGetString("patientname",(char *)0);
+   const char *patientName = am->ArgMgrGetString("patientname");
    
    int nX = am->ArgMgrWantInt("rows", usage);
    int nY = am->ArgMgrWantInt("lines", usage);
index 9cdab8e3fafdbe770b8ca490bdb3a57c189c40be..1cabef1b08662ea4395dac370a2a6ad77a2d505f 100644 (file)
@@ -3,8 +3,8 @@
   Program:   gdcm
   Module:    $RCSfile: ReWrite.cxx,v $
   Language:  C++
-  Date:      $Date: 2005/11/07 09:53:53 $
-  Version:   $Revision: 1.16 $
+  Date:      $Date: 2006/01/26 15:52:43 $
+  Version:   $Revision: 1.17 $
                                                                                 
   Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
   l'Image). All rights reserved. See Doc/License.txt or
@@ -66,7 +66,7 @@ int main(int argc, char *argv[])
       return 0;
    }
 
-   char *mode = am->ArgMgrGetString("mode",(char *)"X");
+   const char *mode = am->ArgMgrGetString("mode","X");
 
    int loadMode = gdcm::LD_ALL;
    if ( am->ArgMgrDefined("noshadowseq") )
index db2dd0e107f150f894b84c0caef7ef576cb93036..567eff75e3778d4e90a08722afa3b3d3461ea679 100755 (executable)
@@ -3,8 +3,8 @@
   Program:   gdcm
   Module:    $RCSfile: exXCoherentFileSet.cxx,v $
   Language:  C++
-  Date:      $Date: 2005/11/14 15:55:17 $
-  Version:   $Revision: 1.6 $
+  Date:      $Date: 2006/01/26 15:52:43 $
+  Version:   $Revision: 1.7 $
                                                                                 
   Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
   l'Image). All rights reserved. See Doc/License.txt or
@@ -71,7 +71,7 @@ int main(int argc, char *argv[])
          loadMode |= gdcm::LD_NOSEQ;
    }
 
-   char *dirName  = am->ArgMgrGetString("dirin",(char *)0);
+   const char *dirName  = am->ArgMgrGetString("dirin");
    if (dirName == 0)
    {
        std::cout <<std::endl
index 32e3765ef519e0d623c9b9ad911003b087e294fb..d54aae7c3e85f7f6b1f7edf43bb31804c07babdf 100644 (file)
@@ -3,8 +3,8 @@
   Program:   gdcm
   Module:    $RCSfile: gdcmArgMgr.cxx,v $
   Language:  C++
-  Date:      $Date: 2005/12/22 14:46:06 $
-  Version:   $Revision: 1.16 $
+  Date:      $Date: 2006/01/26 15:52:56 $
+  Version:   $Revision: 1.17 $
   
   Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
   l'Image). All rights reserved. See Doc/License.txt or
@@ -277,7 +277,7 @@ float ArgMgr::ArgMgrGetFloat(const char *param, float defaultVal)
  * @param defaultVal default value
  * @return parameter value
  */
-char *ArgMgr::ArgMgrGetString(const char *param, char *defaultVal)
+const char *ArgMgr::ArgMgrGetString(const char *param, const char *defaultVal)
 {
    return    ( (ArgMgrDefined(param)) 
               ? (ArgMgrValue(param))
@@ -298,19 +298,20 @@ char *ArgMgr::ArgMgrGetString(const char *param, char *defaultVal)
 int ArgMgr::ArgMgrGetLabel (const char *param, char *liste, int val )
 {
   char *lab;
-  char *vallab;
+  const char *vallab;
   int i = 1;
   char *tmp;
   tmp = (char *) malloc(strlen(liste)+1);
   strcpy(tmp,liste);
 
-  if ( (vallab = ArgMgrGetString(param,(char *)NULL)) != 0 ) 
+  if ( (vallab = ArgMgrGetString(param,(const char *)NULL)) != 0 ) 
   { 
      for ( lab = strtok (tmp,"\\"); 
            lab != 0; 
            lab = strtok(0L,"\\"), i++ )
      { 
-        if ( strcmp(maj(lab),maj(vallab))==0)
+        // strcmp ignoring case
+        if( strcasecmp(lab, vallab) == 0)
            return i;
      } 
      val=0;
@@ -332,12 +333,12 @@ int ArgMgr::ArgMgrGetLabel (const char *param, char *liste, int val )
 int ArgMgr::ArgMgrWantLabel (const char *param, char *liste, const char **usage )
 {
    char *lab;
-   char *vallab;
+   const char *vallab;
    int i = 1;
    if ( (vallab = ArgMgrGetString(param,0)) != 0 ) 
    {
       for ( lab = strtok (liste,"\\"); lab != 0; lab = strtok(0L,"\\"), i++ )
-        if ( strcmp(maj(lab),maj(vallab))==0) 
+        if ( strcasecmp(lab,vallab)==0) 
            return i;
       return 0;
    }
index 18b6454cd8ac8eaa86951b35d99cc14b2c18de55..6f4ea8fdd581e0af76710b037551c24a20fd2904 100644 (file)
@@ -3,8 +3,8 @@
   Program:   gdcm
   Module:    $RCSfile: gdcmArgMgr.h,v $
   Language:  C++
-  Date:      $Date: 2005/08/28 16:56:05 $
-  Version:   $Revision: 1.10 $
+  Date:      $Date: 2006/01/26 15:52:56 $
+  Version:   $Revision: 1.11 $
   
   Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
   l'Image). All rights reserved. See Doc/License.txt or
@@ -63,7 +63,7 @@ public:
 
    int    ArgMgrGetInt   (const char *param, int);  // Gets an int   (with default value)
    float  ArgMgrGetFloat (const char *param, float);// Gets a float  (with default value)
-   char  *ArgMgrGetString(const char *param, char*);// Gets a string (with default value)
+   const char  *ArgMgrGetString(const char *param, const char* ext = 0);// Gets a string (with default value)
    int    ArgMgrGetLabel (const char *param, char *, int);
   
    int    ArgMgrWantInt   (const char *param, const char **usage);  // Demands an int