Program: gdcm
Module: $RCSfile: gdcmDocEntry.cxx,v $
Language: C++
- Date: $Date: 2004/10/22 03:05:41 $
- Version: $Revision: 1.28 $
+ Date: $Date: 2004/12/03 20:16:57 $
+ Version: $Revision: 1.34 $
Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
l'Image). All rights reserved. See Doc/License.txt or
#include "gdcmDocEntry.h"
#include "gdcmTS.h"
+#include "gdcmVR.h"
#include "gdcmGlobal.h"
#include "gdcmUtil.h"
DicomDict = in;
SetKey( in->GetKey( ) );
Offset = 0 ; // To avoid further missprinting
+
+ // init some variables
+ ReadLength = 0;
+ UsableLength = 0;
+ PrintLevel = 0;
}
//-----------------------------------------------------------------------------
PrintLevel = 2; // FIXME
size_t o;
- unsigned short int g, e;
std::string st;
TSKey v;
std::string d2, vr;
std::ostringstream s;
uint32_t lgth;
- g = GetGroup();
- e = GetElement();
o = GetOffset();
vr = GetVR();
* @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();
//
// ----------- Writes the common part
//
- fp->write ((char*) &group,(size_t)2 ); //group
- fp->write ( (char*)&el, (size_t)2 ); //element
-
+ binary_write( *fp, group); //group
+ binary_write( *fp, el); //element
+
if ( filetype == ExplicitVR )
{
// Special case of delimiters:
// TODO : verify if the Sequence Delimitor Item was forced during Parsing
- int ff = 0xffffffff;
- fp->write ((char*)&ff,(size_t)4 );
+ uint32_t ff = 0xffffffff;
+ binary_write(*fp, ff);
return;
}
{
// Unknown was 'written'
// deal with Little Endian
- fp->write ( (char*)&shortLgr,(size_t)2 );
- fp->write ( (char*)&z, (size_t)2 );
+ binary_write(*fp, shortLgr);
+ binary_write(*fp, z);
}
else
{
- fp->write (vr.c_str(),(size_t)2 );
-
+ binary_write(*fp, vr);
+ assert( vr.size() == 2 );
if ( (vr == "OB") || (vr == "OW") || (vr == "SQ") || (vr == "UN") )
{
- fp->write ( (char*)&z, (size_t)2 );
+ binary_write(*fp, z);
if (vr == "SQ")
{
// we set SQ length to ffffffff
// and we shall write a Sequence Delimitor Item
// at the end of the Sequence!
- fp->write ( (char*)&ffff,(size_t)4 );
+ binary_write(*fp, ffff);
}
else
{
- fp->write ( (char*)&lgr,(size_t)4 );
+ binary_write(*fp, lgr);
}
}
else
{
- fp->write ( (char*)&shortLgr,(size_t)2 );
+ binary_write(*fp, shortLgr);
}
}
}
{
if (vr == "SQ")
{
- fp->write ( (char*)&ffff,(size_t)4 );
+ binary_write(*fp, ffff);
}
else
{
- fp->write ( (char*)&lgr,(size_t)4 );
+ binary_write(*fp, lgr);
}
}
}
*/
void DocEntry::Copy (DocEntry* e)
{
- DicomDict = e->DicomDict;
+// DicomDict = e->DicomDict;
UsableLength = e->UsableLength;
ReadLength = e->ReadLength;
ImplicitVR = e->ImplicitVR;