+/**
+ * \brief returns an hexadecimal representation of the DataEntry value
+ */
+std::string const &DataEntry::GetHexaRepresentation() const
+{
+ static std::ostringstream s2;
+ const VRKey &vr = GetVR();
+
+ s2.str("");
+ if (!StrHexaArea)
+ StrHexaArea = new std::string();
+ else
+ *StrHexaArea="";
+ if( !BinArea )
+ return *StrHexaArea;
+ // When short integer(s) are stored, convert the following (n * 2) characters
+ // as a displayable string, the values being separated by a back-slash
+
+ s2 << std::hex;
+
+ if( vr == "US" )
+ {
+ uint16_t *data=(uint16_t *)BinArea;
+ for (unsigned int i=0; i < GetValueCount(); i++)
+ {
+ s2 << std::setw( 2 ) << std::setfill( '0' );
+ if( i!=0 )
+ s2 << '\\';
+ s2 << data[i];
+ }
+ *StrHexaArea=s2.str();
+ }
+ else if (vr == "SS" )
+ {
+ int16_t *data=(int16_t *)BinArea;
+ for (unsigned int i=0; i < GetValueCount(); i++)
+ {
+ s2 << std::setw( 4 ) << std::setfill( '0' );
+ if( i!=0 )
+ s2 << '\\';
+ s2 << data[i];
+ }
+ *StrHexaArea=s2.str();
+ } // See above comment on multiple short integers (mutatis mutandis).
+ else if( vr == "UL" )
+ {
+ uint32_t *data=(uint32_t *)BinArea;
+ for (unsigned int i=0; i < GetValueCount(); i++)
+ {
+ s2 << std::setw( 4 ) << std::setfill( '0' );
+ if( i!=0 )
+ s2 << '\\';
+ s2 << data[i];
+ }
+ *StrHexaArea=s2.str();
+ }
+ else if( vr == "SL" )
+ {
+ int32_t *data=(int32_t *)BinArea;
+ for (unsigned int i=0; i < GetValueCount(); i++)
+ {
+ s2 << std::setw( 4 ) << std::setfill( '0' );
+ if( i!=0 )
+ s2 << '\\';
+ s2 << data[i];
+ }
+ *StrHexaArea=s2.str();
+ }
+ else if( vr == "FL" )
+ {
+ unsigned char *toto=(unsigned char *)BinArea;
+ for (unsigned int i=0; i < GetValueCount(); i++)
+ {
+ s2.str("");
+ if( i!=0 )
+ s2 << '\\';
+ unsigned int a4;
+ for(int iif=0; iif<4; iif++)
+ {
+ a4=toto[iif];
+ s2 << a4;
+ }
+ }
+ *StrHexaArea=s2.str();
+ }
+ else if( vr == "FD" )
+ {
+ //double *data=(double *)BinArea;
+ unsigned char *toto=(unsigned char *)BinArea;
+ for (unsigned int i=0; i < GetValueCount(); i++)
+ {
+ s2.str("");
+ if( i!=0 )
+ s2 << '\\';
+ //s2 << data[i];
+
+ unsigned int a4;
+ for(int iid=0; iid<8; iid++)
+ {
+ a4=toto[iid];
+ s2 << a4;
+ }
+
+ }
+ *StrHexaArea=s2.str();
+ }
+ else
+ {
+ unsigned int l = (Length > GDCM_MAX_LENGTH_TO_CONVERT_TO_HEXA) ? GDCM_MAX_LENGTH_TO_CONVERT_TO_HEXA : Length;
+ uint8_t *data=(uint8_t *)BinArea;
+ for (unsigned int i=0; i < l; i++)
+ {
+ if( i!=0 )
+ s2 << '\\';
+ s2 << std::setw( 2 ) << (int)(data[i]);
+ }
+ if (Length > 16)
+ s2 << "\\...";
+ *StrHexaArea=s2.str();
+ }
+ return *StrHexaArea;
+}