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) {
24 * \brief Canonical destructor.
26 gdcmValEntry::~gdcmValEntry (void) {
27 if (!voidArea) // will be in BinEntry
32 //-----------------------------------------------------------------------------
37 * \ingroup gdcmValEntry
38 * \brief canonical Printer
40 void gdcmValEntry::Print(std::ostream & os) {
44 unsigned short int g, e;
56 return; // just to avoid identing all the remaining code
61 gdcmTS * ts = gdcmGlobal::GetTS();
63 if (voidArea != NULL) { // should be moved in gdcmBinEntry Printer (when any)
64 s << " [gdcm::Non String Data Loaded in Unsecure Area ("
65 << GetLength() << ") ]";
69 v = GetValue(); // not applicable for SQ ...
70 d2 = CreateCleanString(v); // replace non printable characters by '.'
71 if( (GetLength()<=MAX_SIZE_PRINT_ELEMENT_VALUE) ||
73 (d2.find("gdcm::NotLoaded.") < d2.length()) )
74 s << " [" << d2 << "]";
76 s << " [gdcm::too long for print (" << GetLength() << ") ]";
79 // Display the UID value (instead of displaying only the rough code)
80 if (g == 0x0002) { // Any more to be displayed ?
81 if ( (e == 0x0010) || (e == 0x0002) )
82 s << " ==>\t[" << ts->GetValue(v) << "]";
85 if ( (e == 0x0016) || (e == 0x1150) )
86 s << " ==>\t[" << ts->GetValue(v) << "]";
89 if ( (e == 0x1510) || (e == 0x1512) )
90 s << " ==>\t[" << ts->GetValue(v) << "]";
94 //if (e == 0x0000) { // elem 0x0000 --> group length
95 if ( (vr == "UL") || (vr == "US") || (vr == "SL") || (vr == "SS") ) {
96 if (v == "4294967295") // to avoid troubles in convertion
97 sprintf (st," x(ffffffff)");
99 if ( GetLength() !=0 )
100 sprintf(st," x(%x)", atoi(v.c_str()));//FIXME
112 //-----------------------------------------------------------------------------
115 //-----------------------------------------------------------------------------
118 //-----------------------------------------------------------------------------
121 //-----------------------------------------------------------------------------