]> Creatis software - gdcm.git/blobdiff - src/gdcmBinEntry.cxx
* Preparation of writing a gdcmHeader iterator: generalisation of gdcmTagKey
[gdcm.git] / src / gdcmBinEntry.cxx
index ef4f9652a9e15d54fb81badc6467b3c5849065e8..a010ff7217f4cd08d523ad3df22729ae78b87da2 100644 (file)
@@ -3,8 +3,8 @@
   Program:   gdcm
   Module:    $RCSfile: gdcmBinEntry.cxx,v $
   Language:  C++
-  Date:      $Date: 2004/08/16 16:30:32 $
-  Version:   $Revision: 1.22 $
+  Date:      $Date: 2004/09/13 12:10:53 $
+  Version:   $Revision: 1.26 $
                                                                                 
   Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
   l'Image). All rights reserved. See Doc/License.txt or
@@ -28,7 +28,7 @@
  */
 gdcmBinEntry::gdcmBinEntry(gdcmDictEntry* e) : gdcmValEntry(e)
 {
-   VoidArea = NULL;
+   VoidArea = 0;
 }
 
 /**
@@ -42,9 +42,10 @@ gdcmBinEntry::gdcmBinEntry(gdcmDocEntry* e) : gdcmValEntry(e->GetDictEntry())
    ImplicitVR   = e->IsImplicitVR();
    Offset       = e->GetOffset();
    PrintLevel   = e->GetPrintLevel();
-   SQDepthLevel = e->GetDepthLevel();
+   //FIXME
+   //SQDepthLevel = e->GetDepthLevel();
 
-   VoidArea = NULL; // let's be carefull !
+   VoidArea = 0; // let's be carefull !
 }
 
 /**
@@ -55,7 +56,7 @@ gdcmBinEntry::~gdcmBinEntry()
    if (VoidArea)
    {
       free (VoidArea);
-      VoidArea = NULL; // let's be carefull !
+      VoidArea = 0; // let's be carefull !
    }
 }
 
@@ -73,8 +74,9 @@ void gdcmBinEntry::Print(std::ostream &os)
    void *voidArea = GetVoidArea();
    if (voidArea)
    {
-      s << " [gdcm::Binary data loaded with length is "
-        << GetLength() << "]";
+      //s << " [" << GDCM_BINLOADED 
+      s << " [" << GetValue()
+        << "; length = " << GetLength() << "]";
    }
    else
    {
@@ -84,7 +86,8 @@ void gdcmBinEntry::Print(std::ostream &os)
       }
       else 
       {
-         s << " [gdcm::Binary data NOT loaded]";
+         //s << " [gdcm::Binary data NOT loaded]";
+         s << " [" <<GetValue() << "]";
       }
          
    }
@@ -93,7 +96,9 @@ void gdcmBinEntry::Print(std::ostream &os)
 
 /*
  * \brief   canonical Writer
- */
+ * @param fp already open file pointer
+ * @param filetype type of the file to be written
+*/
 void gdcmBinEntry::Write(FILE *fp, FileType filetype)
 {
    gdcmDocEntry::Write(fp, filetype);
@@ -104,10 +109,24 @@ void gdcmBinEntry::Write(FILE *fp, FileType filetype)
       // there is a 'non string' LUT, overlay, etc
       fwrite ( voidArea,(size_t)lgr ,(size_t)1 ,fp); // Elem value
    }
+   else
+   {
+    // nothing was loaded, but we need to skip space on disc
+      fseek(fp,(size_t)lgr,SEEK_CUR); 
+   }
 }
 //-----------------------------------------------------------------------------
 // Public
 
+
+/// \brief Sets the value (non string) of the current Dicom Header Entry
+void gdcmBinEntry::SetVoidArea( void* area )  
+{ 
+   if (VoidArea)
+      free(VoidArea);
+   VoidArea = area;  
+}
+
 //-----------------------------------------------------------------------------
 // Protected