]> Creatis software - gdcm.git/blobdiff - src/gdcmDocEntry.cxx
Print() displays old key instead of new in order to make PrintHeader human readable
[gdcm.git] / src / gdcmDocEntry.cxx
index 208bd1e6e1e15251d4ae66387c97ee452a2cc92c..795782781a1cfe01aa565011a9ba01a4d7d160c9 100644 (file)
@@ -3,8 +3,8 @@
   Program:   gdcm
   Module:    $RCSfile: gdcmDocEntry.cxx,v $
   Language:  C++
-  Date:      $Date: 2004/09/03 15:09:30 $
-  Version:   $Revision: 1.17 $
+  Date:      $Date: 2004/09/24 11:34:21 $
+  Version:   $Revision: 1.21 $
                                                                                 
   Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
   l'Image). All rights reserved. See Doc/License.txt or
@@ -37,6 +37,7 @@ gdcmDocEntry::gdcmDocEntry(gdcmDictEntry* in)
 {
    ImplicitVR = false;
    DictEntry  = in;
+   SetKey( in->GetKey( ) );
    Offset     = 0 ; // To avoid further missprinting
 }
 
@@ -47,29 +48,28 @@ gdcmDocEntry::gdcmDocEntry(gdcmDictEntry* in)
  * \brief   Prints the common part of gdcmValEntry, gdcmBinEntry, gdcmSeqEntry
  * @param   os ostream we want to print in
  */
-void gdcmDocEntry::Print(std::ostream & os)
+void gdcmDocEntry::Print(std::ostream& os)
 {
    PrintLevel = 2; // FIXME
    
    size_t o;
    unsigned short int g, e;
-   char st[20];
+   char st[20],st2[10];
    TSKey v;
    std::string d2, vr;
    std::ostringstream s;
    uint32_t lgth;
-   char greltag[10];  //group element tag
 
    g  = GetGroup();
    e  = GetElement();
    o  = GetOffset();
    vr = GetVR();
-   sprintf(greltag,"%04x|%04x ",g,e);           
-   s << greltag ;
-       
+
+   sprintf(st2,"%04x|%04x", GetGroup(),GetElement());
+   s << st2;       
    if (PrintLevel >= 2)
    {
-      s << "lg : ";
+      s << " lg : ";
       lgth = GetReadLength(); // ReadLength, as opposed to UsableLength
       if (lgth == 0xffffffff)
       {
@@ -114,7 +114,7 @@ void gdcmDocEntry::Print(std::ostream & os)
  * @param fp already open file pointer
  * @param filetype type of the file to be written
  */
-void gdcmDocEntry::Write(FILE *fp, FileType filetype)
+void gdcmDocEntry::Write(FILEfp, FileType filetype)
 {
    uint32_t FFFF  = 0xffffffff;
    uint16_t group = GetGroup();
@@ -164,7 +164,7 @@ void gdcmDocEntry::Write(FILE *fp, FileType filetype)
          // Unknown was 'written'
          // deal with Little Endian            
          fwrite ( &shortLgr,(size_t)2 ,(size_t)1 ,fp);
-         fwrite ( &z,  (size_t)2 ,(size_t)1 ,fp);
+         fwrite ( &z,       (size_t)2 ,(size_t)1 ,fp);
       }
       else
       {