1 /*=========================================================================
4 Module: $RCSfile: gdcmBinEntry.cxx,v $
6 Date: $Date: 2004/09/10 14:32:04 $
7 Version: $Revision: 1.25 $
9 Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
10 l'Image). All rights reserved. See Doc/License.txt or
11 http://www.creatis.insa-lyon.fr/Public/Gdcm/License.htm for details.
13 This software is distributed WITHOUT ANY WARRANTY; without even
14 the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
15 PURPOSE. See the above copyright notices for more information.
17 =========================================================================*/
19 #include "gdcmBinEntry.h"
20 #include "gdcmDebug.h"
23 //-----------------------------------------------------------------------------
24 // Constructor / Destructor
27 * \brief Constructor from a given gdcmBinEntry
29 gdcmBinEntry::gdcmBinEntry(gdcmDictEntry* e) : gdcmValEntry(e)
35 * \brief Constructor from a given gdcmBinEntry
36 * @param e Pointer to existing Doc entry
38 gdcmBinEntry::gdcmBinEntry(gdcmDocEntry* e) : gdcmValEntry(e->GetDictEntry())
40 UsableLength = e->GetLength();
41 ReadLength = e->GetReadLength();
42 ImplicitVR = e->IsImplicitVR();
43 Offset = e->GetOffset();
44 PrintLevel = e->GetPrintLevel();
45 SQDepthLevel = e->GetDepthLevel();
47 VoidArea = 0; // let's be carefull !
51 * \brief Canonical destructor.
53 gdcmBinEntry::~gdcmBinEntry()
58 VoidArea = 0; // let's be carefull !
63 //-----------------------------------------------------------------------------
66 * \brief canonical Printer
69 void gdcmBinEntry::Print(std::ostream &os)
71 gdcmDocEntry::Print(os);
73 void *voidArea = GetVoidArea();
76 //s << " [" << GDCM_BINLOADED
77 s << " [" << GetValue()
78 << "; length = " << GetLength() << "]";
82 if ( GetLength() == 0 )
88 //s << " [gdcm::Binary data NOT loaded]";
89 s << " [" <<GetValue() << "]";
97 * \brief canonical Writer
98 * @param fp already open file pointer
99 * @param filetype type of the file to be written
101 void gdcmBinEntry::Write(FILE *fp, FileType filetype)
103 gdcmDocEntry::Write(fp, filetype);
104 void *voidArea = GetVoidArea();
105 int lgr = GetLength();
108 // there is a 'non string' LUT, overlay, etc
109 fwrite ( voidArea,(size_t)lgr ,(size_t)1 ,fp); // Elem value
113 // nothing was loaded, but we need to skip space on disc
114 fseek(fp,(size_t)lgr,SEEK_CUR);
117 //-----------------------------------------------------------------------------
121 /// \brief Sets the value (non string) of the current Dicom Header Entry
122 void gdcmBinEntry::SetVoidArea(void* area)
129 //-----------------------------------------------------------------------------
132 //-----------------------------------------------------------------------------
135 //-----------------------------------------------------------------------------