- }
-
- // When the length is zero things are easy:
- if ( length == 0 )
- {
- ((gdcmValEntry *)entry)->SetValue("");
- return;
- }
-
- // The elements whose length is bigger than the specified upper bound
- // are not loaded. Instead we leave a short notice of the offset of
- // the element content and it's length.
-
- std::ostringstream s;
- if (length > MaxSizeLoadEntry)
- {
- if (gdcmBinEntry* binEntryPtr = dynamic_cast< gdcmBinEntry* >(entry) )
- {
- s << "gdcm::NotLoaded (BinEntry)";
- s << " Address:" << (long)entry->GetOffset();
- s << " Length:" << entry->GetLength();
- s << " x(" << std::hex << entry->GetLength() << ")";
- binEntryPtr->SetValue(s.str());
- }
- // to be sure we are at the end of the value ...
- fseek(Fp, (long)entry->GetOffset()+(long)entry->GetLength(), SEEK_SET);
- // Following return introduced by JPR on version 1.25. Since the
- // treatement of a ValEntry is never executed (doh!) this means
- // we were lucky up to now because we NEVER encountered a ValEntry
- // whose length was bigger thant MaxSizeLoadEntry !? I can't believe
- // this could ever work...
- return; //FIXME FIXME FIXME FIXME JPR ????
-
- // Be carefull : a BinEntry IS_A ValEntry ...
- if (gdcmValEntry* valEntryPtr = dynamic_cast< gdcmValEntry* >(entry) )
- {
- s << "gdcm::NotLoaded. (ValEntry)";
- s << " Address:" << (long)entry->GetOffset();
- s << " Length:" << entry->GetLength();
- s << " x(" << std::hex << entry->GetLength() << ")";
- valEntryPtr->SetValue(s.str());
- }
- // to be sure we are at the end of the value ...
- fseek(Fp,(long)entry->GetOffset()+(long)entry->GetLength(),SEEK_SET);
-
- return;
- }
-
- // When we find a BinEntry not very much can be done :
- if (gdcmBinEntry* binEntryPtr = dynamic_cast< gdcmBinEntry* >(entry) )
- {
-
- LoadEntryVoidArea(binEntryPtr);
- s << "gdcm::Loaded (BinEntry)";
- binEntryPtr->SetValue(s.str());
- return;
- }
-
- /// \todo Any compacter code suggested (?)
- if ( IsDocEntryAnInteger(entry) )
- {
- uint32_t NewInt;
- std::ostringstream s;
- int nbInt;
- // When short integer(s) are expected, read and convert the following
- // n *two characters properly i.e. consider them as short integers as
- // opposed to strings.
- // Elements with Value Multiplicity > 1
- // contain a set of integers (not a single one)
- if (vr == "US" || vr == "SS")
- {
- nbInt = length / 2;
- NewInt = ReadInt16();
- s << NewInt;
- if (nbInt > 1)
- {
- for (int i=1; i < nbInt; i++)
- {
- s << '\\';
- NewInt = ReadInt16();
- s << NewInt;
- }
- }
- }
- // See above comment on multiple integers (mutatis mutandis).
- else if (vr == "UL" || vr == "SL")
- {
- nbInt = length / 4;
- NewInt = ReadInt32();
- s << NewInt;
- if (nbInt > 1)
- {
- for (int i=1; i < nbInt; i++)
- {
- s << '\\';
- NewInt = ReadInt32();
- s << NewInt;
- }
- }
- }
-#ifdef GDCM_NO_ANSI_STRING_STREAM
- s << std::ends; // to avoid oddities on Solaris
-#endif //GDCM_NO_ANSI_STRING_STREAM