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 * \brief Canonical destructor.
26 gdcmValEntry::~gdcmValEntry (void) {
27 if (!voidArea) // will be in BinEntry
32 //-----------------------------------------------------------------------------
35 * \ingroup gdcmValEntry
36 * \brief canonical Printer
38 void gdcmValEntry::Print(std::ostream & os) {
42 unsigned short int g, e;
54 return; // just to avoid identing all the remaining code
59 gdcmTS * ts = gdcmGlobal::GetTS();
61 if (voidArea != NULL) { // should be moved in gdcmBinEntry Printer (when any)
62 s << " [gdcm::Non String Data Loaded in Unsecure Area ("
63 << GetLength() << ") ]";
67 v = GetValue(); // not applicable for SQ ...
68 d2 = CreateCleanString(v); // replace non printable characters by '.'
69 if( (GetLength()<=MAX_SIZE_PRINT_ELEMENT_VALUE) ||
71 (d2.find("gdcm::NotLoaded.") < d2.length()) )
72 s << " [" << d2 << "]";
74 s << " [gdcm::too long for print (" << GetLength() << ") ]";
77 // Display the UID value (instead of displaying only the rough code)
78 if (g == 0x0002) { // Any more to be displayed ?
79 if ( (e == 0x0010) || (e == 0x0002) )
80 s << " ==>\t[" << ts->GetValue(v) << "]";
83 if ( (e == 0x0016) || (e == 0x1150) )
84 s << " ==>\t[" << ts->GetValue(v) << "]";
87 if ( (e == 0x1510) || (e == 0x1512) )
88 s << " ==>\t[" << ts->GetValue(v) << "]";
92 //if (e == 0x0000) { // elem 0x0000 --> group length
93 if ( (vr == "UL") || (vr == "US") || (vr == "SL") || (vr == "SS") ) {
94 if (v == "4294967295") // to avoid troubles in convertion
95 sprintf (st," x(ffffffff)");
97 if ( GetLength() !=0 )
98 sprintf(st," x(%x)", atoi(v.c_str()));//FIXME
110 //-----------------------------------------------------------------------------
113 //-----------------------------------------------------------------------------
116 //-----------------------------------------------------------------------------
119 //-----------------------------------------------------------------------------