X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=blobdiff_plain;f=src%2FgdcmBinEntry.cxx;h=de10fd2a9d84fb6e6ad0191ac489d75f7d29f90a;hb=ab62b1a706df8e2ab1fbf26fa5037d6c22293655;hp=9d09f7ad7b37d5874edd3e66495e432afefde90a;hpb=0b36f4932e894a1dde4a80e614755816b4b29218;p=gdcm.git diff --git a/src/gdcmBinEntry.cxx b/src/gdcmBinEntry.cxx index 9d09f7ad..de10fd2a 100644 --- a/src/gdcmBinEntry.cxx +++ b/src/gdcmBinEntry.cxx @@ -1,35 +1,110 @@ -// gdcmBinEntry.cxx -//----------------------------------------------------------------------------- -// +/*========================================================================= + + Program: gdcm + Module: $RCSfile: gdcmBinEntry.cxx,v $ + Language: C++ + Date: $Date: 2004/08/01 03:20:23 $ + 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 + http://www.creatis.insa-lyon.fr/Public/Gdcm/License.htm for details. + + This software is distributed WITHOUT ANY WARRANTY; without even + the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR + PURPOSE. See the above copyright notices for more information. + +=========================================================================*/ + #include "gdcmBinEntry.h" -#include "gdcmTS.h" -#include "gdcmGlobal.h" -#include "gdcmUtil.h" +#include "gdcmDebug.h" //----------------------------------------------------------------------------- // Constructor / Destructor + /** - * \ingroup gdcmBinEntry * \brief Constructor from a given gdcmBinEntry - * @param in Pointer to existing dictionary entry */ -gdcmBinEntry::gdcmBinEntry() : gdcmDocEntry( ) { +gdcmBinEntry::gdcmBinEntry(gdcmDictEntry* e) : gdcmValEntry(e) +{ + voidArea = NULL; +} +/** + * \brief Constructor from a given gdcmBinEntry + * @param e Pointer to existing Doc entry + */ +gdcmBinEntry::gdcmBinEntry(gdcmDocEntry* e) : gdcmValEntry(e->GetDictEntry()) +{ + UsableLength = e->GetLength(); + ReadLength = e->GetReadLength(); + ImplicitVR = e->IsImplicitVR(); + Offset = e->GetOffset(); + PrintLevel = e->GetPrintLevel(); + SQDepthLevel = e->GetDepthLevel(); + voidArea = NULL; // let's be carefull ! } - +/** + * \brief Canonical destructor. + */ +gdcmBinEntry::~gdcmBinEntry() +{ + if (voidArea) + { + free (voidArea); + voidArea = NULL; // let's be carefull ! + } +} //----------------------------------------------------------------------------- // Print /* - * \ingroup gdcmDocEntry * \brief canonical Printer */ +void gdcmBinEntry::Print(std::ostream &os) +{ + gdcmDocEntry::Print(os); + std::ostringstream s; + void *voidArea = GetVoidArea(); + if (voidArea) + { + s << " [gdcm::Binary data loaded with length is " + << GetLength() << "]"; + } + else + { + if ( GetLength() == 0 ) + { + s << " []"; + } + else + { + s << " [gdcm::Binary data NOT loaded]"; + } + + } + os << s.str(); +} +/* + * \brief canonical Writer + */ +void gdcmBinEntry::Write(FILE *fp, FileType filetype) +{ + gdcmDocEntry::Write(fp, filetype); + void *voidArea = GetVoidArea(); + int lgr = GetLength(); + if (voidArea) + { + // there is a 'non string' LUT, overlay, etc + fwrite ( voidArea,(size_t)lgr ,(size_t)1 ,fp); // Elem value + } +} //----------------------------------------------------------------------------- // Public @@ -38,5 +113,5 @@ gdcmBinEntry::gdcmBinEntry() : gdcmDocEntry( ) { //----------------------------------------------------------------------------- // Private - + //-----------------------------------------------------------------------------