2 //-----------------------------------------------------------------------------
4 #include "gdcmValEntry.h"
6 #include "gdcmGlobal.h"
10 #define MAX_SIZE_PRINT_ELEMENT_VALUE 128
12 //-----------------------------------------------------------------------------
13 // Constructor / Destructor
15 * \ingroup gdcmValEntry
16 * \brief Constructor from a given gdcmDictEntry
17 * @param e Pointer to existing dictionary entry
19 gdcmValEntry::gdcmValEntry(gdcmDictEntry* e) : gdcmDocEntry(e) {
20 voidArea = NULL; // will be in BinEntry ?
24 * \ingroup gdcmValEntry
25 * \brief Constructor from a given gdcmDocEntry
26 * @param e Pointer to existing Doc entry
28 gdcmValEntry::gdcmValEntry(gdcmDocEntry* e) : gdcmDocEntry(e->GetDictEntry()){
29 this->UsableLength = e->GetLength();
30 this->ReadLength = e->GetReadLength();
31 this->ImplicitVR = e->IsImplicitVR();
32 this->Offset = e->GetOffset();
33 this->printLevel = e->GetPrintLevel();
34 this->SQDepthLevel = e->GetDepthLevel();
36 this->voidArea = NULL; // will be in BinEntry ?
41 * \brief Canonical destructor.
43 gdcmValEntry::~gdcmValEntry (void) {
44 if (!voidArea) // will be in BinEntry
49 //-----------------------------------------------------------------------------
52 * \ingroup gdcmValEntry
53 * \brief canonical Printer
55 void gdcmValEntry::Print(std::ostream & os) {
59 unsigned short int g, e;
71 return; // just to avoid identing all the remaining code
76 gdcmTS * ts = gdcmGlobal::GetTS();
78 if (voidArea != NULL) { // should be moved in gdcmBinEntry Printer (when any)
79 s << " [gdcm::Non String Data Loaded in Unsecure Area ("
80 << GetLength() << ") ]";
84 v = GetValue(); // not applicable for SQ ...
85 d2 = CreateCleanString(v); // replace non printable characters by '.'
86 if( (GetLength()<=MAX_SIZE_PRINT_ELEMENT_VALUE) ||
88 (d2.find("gdcm::NotLoaded.") < d2.length()) )
89 s << " [" << d2 << "]";
91 s << " [gdcm::too long for print (" << GetLength() << ") ]";
94 // Display the UID value (instead of displaying only the rough code)
95 if (g == 0x0002) { // Any more to be displayed ?
96 if ( (e == 0x0010) || (e == 0x0002) )
97 s << " ==>\t[" << ts->GetValue(v) << "]";
100 if ( (e == 0x0016) || (e == 0x1150) )
101 s << " ==>\t[" << ts->GetValue(v) << "]";
104 if ( (e == 0x1510) || (e == 0x1512) )
105 s << " ==>\t[" << ts->GetValue(v) << "]";
109 //if (e == 0x0000) { // elem 0x0000 --> group length
110 if ( (vr == "UL") || (vr == "US") || (vr == "SL") || (vr == "SS") ) {
111 if (v == "4294967295") // to avoid troubles in convertion
112 sprintf (st," x(ffffffff)");
114 if ( GetLength() !=0 )
115 sprintf(st," x(%x)", atoi(v.c_str()));//FIXME
127 //-----------------------------------------------------------------------------
130 //-----------------------------------------------------------------------------
133 //-----------------------------------------------------------------------------
136 //-----------------------------------------------------------------------------