]> Creatis software - gdcm.git/blobdiff - src/gdcmDocEntry.cxx
* src/gdcmDictEntry.h : now, the IsVRUnknown is correct
[gdcm.git] / src / gdcmDocEntry.cxx
index 46b77b93f267d3caf8c4a30e2524e89ec3112062..f954dfc242c22c3701d42509c78d03f44e2f0fe9 100644 (file)
@@ -3,8 +3,8 @@
   Program:   gdcm
   Module:    $RCSfile: gdcmDocEntry.cxx,v $
   Language:  C++
-  Date:      $Date: 2004/11/09 22:15:36 $
-  Version:   $Revision: 1.30 $
+  Date:      $Date: 2005/01/06 13:35:38 $
+  Version:   $Revision: 1.37 $
                                                                                 
   Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
   l'Image). All rights reserved. See Doc/License.txt or
@@ -18,6 +18,7 @@
 
 #include "gdcmDocEntry.h"
 #include "gdcmTS.h"
+#include "gdcmVR.h"
 #include "gdcmGlobal.h"
 #include "gdcmUtil.h"
 
@@ -43,6 +44,10 @@ DocEntry::DocEntry(DictEntry* in)
    DicomDict  = in;
    SetKey( in->GetKey( ) );
    Offset     = 0 ; // To avoid further missprinting
+
+   // init some variables
+   ReadLength = 0;
+   UsableLength = 0;
 }
 
 //-----------------------------------------------------------------------------
@@ -54,8 +59,6 @@ DocEntry::DocEntry(DictEntry* in)
  */
 void DocEntry::Print(std::ostream& os)
 {
-   PrintLevel = 2; // FIXME
-   
    size_t o;
    std::string st;
    TSKey v;
@@ -65,6 +68,8 @@ void DocEntry::Print(std::ostream& os)
 
    o  = GetOffset();
    vr = GetVR();
+   if(vr==GDCM_UNKNOWN)
+      vr="  ";
 
    s << DictEntry::TranslateToKey(GetGroup(),GetElement()); 
 
@@ -115,7 +120,7 @@ void DocEntry::Print(std::ostream& os)
  * @param fp already open file pointer
  * @param filetype type of the file to be written
  */
-void DocEntry::Write(std::ofstream* fp, FileType filetype)
+void DocEntry::WriteContent(std::ofstream* fp, FileType filetype)
 {
    uint32_t ffff  = 0xffffffff;
    uint16_t group = GetGroup();
@@ -160,7 +165,7 @@ void DocEntry::Write(std::ofstream* fp, FileType filetype)
       uint16_t z = 0;
       uint16_t shortLgr = lgr;
 
-      if (vr == "unkn")
+      if (vr == GDCM_UNKNOWN)
       {
          // Unknown was 'written'
          // deal with Little Endian            
@@ -241,12 +246,11 @@ uint32_t DocEntry::GetFullLength()
  */
 void DocEntry::Copy (DocEntry* e)
 {
-   DicomDict    = e->DicomDict;
+//   DicomDict    = e->DicomDict;
    UsableLength = e->UsableLength;
    ReadLength   = e->ReadLength;
    ImplicitVR   = e->ImplicitVR;
    Offset       = e->Offset;
-   PrintLevel   = e->PrintLevel;
    // TODO : remove DocEntry SQDepth
 }