]> Creatis software - gdcm.git/blobdiff - src/gdcmBinEntry.cxx
Last modif before gdcmPixelData class introduction :
[gdcm.git] / src / gdcmBinEntry.cxx
index de10fd2a9d84fb6e6ad0191ac489d75f7d29f90a..092c1ee18cd14d6407e7b2cb12ad41f4b354a441 100644 (file)
@@ -3,8 +3,8 @@
   Program:   gdcm
   Module:    $RCSfile: gdcmBinEntry.cxx,v $
   Language:  C++
-  Date:      $Date: 2004/08/01 03:20:23 $
-  Version:   $Revision: 1.21 $
+  Date:      $Date: 2004/09/20 18:14:23 $
+  Version:   $Revision: 1.28 $
                                                                                 
   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 !
 }
 
 /**
@@ -52,10 +53,10 @@ gdcmBinEntry::gdcmBinEntry(gdcmDocEntry* e) : gdcmValEntry(e->GetDictEntry())
  */
 gdcmBinEntry::~gdcmBinEntry()
 {
-   if (voidArea)
+   if (VoidArea)
    {
-      free (voidArea);
-      voidArea = NULL; // let's be carefull !
+      free (VoidArea);
+      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