]> Creatis software - gdcm.git/blobdiff - src/gdcmHeaderEntry.cxx
*** empty log message ***
[gdcm.git] / src / gdcmHeaderEntry.cxx
index e53120744a3385ac0f75921753cd04a5ca6439f3..b3dd2ef2254b2a9e3aae7f5488c96686300e0973 100644 (file)
@@ -13,6 +13,9 @@
 #endif
 #include <iomanip> // for std::ios::left, ...
 
+
+#define MAX_SIZE_PRINT_ELEMENT_VALUE 64
+
 //-----------------------------------------------------------------------------
 // Constructor / Destructor
 /**
  */
 gdcmHeaderEntry::gdcmHeaderEntry(gdcmDictEntry* in) {
        ImplicitVR = false;
+       voidArea = NULL; // unsecure memory area to hold 'non string' values
        entry = in;
 }
 
 //-----------------------------------------------------------------------------
 // Print
+/**
+ * \ingroup gdcmHeaderEntry
+ * \brief   canonical Printer
+ */
 void gdcmHeaderEntry::Print(std::ostream & os) {
    size_t o;
    unsigned short int g, e;
@@ -37,6 +45,7 @@ void gdcmHeaderEntry::Print(std::ostream & os) {
    std::ostringstream s;
    guint32 lgth;
    char greltag[10];  //group element tag
+
    g  = GetGroup();
    e  = GetElement();
    v  = GetValue();
@@ -48,7 +57,7 @@ void gdcmHeaderEntry::Print(std::ostream & os) {
    d2 = _CreateCleanString(v);  // replace non printable characters by '.'
    if (printLevel>=2) { 
       s << "lg : ";
-      lgth = GetReadLength();
+      lgth = GetReadLength(); // ReadLength, as opposed to UsableLength
       if (lgth == 0xffffffff) {
          sprintf(st,"x(ffff)");  // I said : "x(ffff)" !
          s.setf(std::ios::left);
@@ -76,14 +85,24 @@ void gdcmHeaderEntry::Print(std::ostream & os) {
    if (printLevel>=1) {      
       s.setf(std::ios::left);
       s << std::setw(66-GetName().length()) << " ";             
-   } 
-     
-   s << "[" << GetName()<< "]";       
-   if( (GetLength()<64) || (printLevel>=3) )
-      s << " [" << d2 << "]";
-   else
-      s << " [ gdcm::too long for print (" << GetLength() << ") ]";
+   }
+    
+   s << "[" << GetName()<< "]";
 
+   if (voidArea != NULL) {
+       s << " [gdcm::Non String Data Loaded in Unsecure Area (" 
+         << GetLength() << ") ]";
+   } 
+   
+   else {             
+      if( (GetLength()<MAX_SIZE_PRINT_ELEMENT_VALUE) || 
+          (printLevel>=3)  || 
+          (d2.find("gdcm::NotLoaded.") < d2.length()) )
+         s << " [" << d2 << "]";
+      else 
+         s << " [gdcm::too long for print (" << GetLength() << ") ]";
+   }
+   
    // Display the UID value (instead of displaying the rough code)  
    if (g == 0x0002) {  // Any more to be displayed ?
       if ( (e == 0x0010) || (e == 0x0002) )