-//GenerateFreeTagKeyInGroup? What was it designed for ?!?
-/**
- * \brief Generate a free TagKey i.e. a TagKey that is not present
- * in the TagHt dictionary.
- * @param group The generated tag must belong to this group.
- * @return The element of tag with given group which is fee.
- */
-//uint32_t Document::GenerateFreeTagKeyInGroup(uint16_t group)
-//{
-// for (uint32_t elem = 0; elem < UINT32_MAX; elem++)
-// {
-// TagKey key = DictEntry::TranslateToKey(group, elem);
-// if (TagHT.count(key) == 0)
-// {
-// return elem;
-// }
-// }
-// return UINT32_MAX;
-//}
-
-/**
- * \brief Assuming the internal file pointer \ref Document::Fp
- * is placed at the beginning of a tag check whether this
- * tag is (TestGroup, TestElement).
- * \warning On success the internal file pointer \ref Document::Fp
- * is modified to point after the tag.
- * On failure (i.e. when the tag wasn't the expected tag
- * (TestGroup, TestElement) the internal file pointer
- * \ref Document::Fp is restored to it's original position.
- * @param testGroup The expected group of the tag.
- * @param testElement The expected Element of the tag.
- * @return True on success, false otherwise.
- */
-bool Document::ReadTag(uint16_t testGroup, uint16_t testElement)
-{
- long positionOnEntry = Fp->tellg();
- long currentPosition = Fp->tellg(); // On debugging purposes
-
- //// Read the Item Tag group and element, and make
- // sure they are what we expected:
- uint16_t itemTagGroup;
- uint16_t itemTagElement;
- try
- {
- itemTagGroup = ReadInt16();
- itemTagElement = ReadInt16();
- }
- catch ( FormatError e )
- {
- //std::cerr << e << std::endl;
- return false;
- }
- if ( itemTagGroup != testGroup || itemTagElement != testElement )
- {
- gdcmVerboseMacro( "Wrong Item Tag found:"
- << " We should have found tag ("
- << std::hex << testGroup << "," << testElement << ")" << std::endl
- << " but instead we encountered tag ("
- << std::hex << itemTagGroup << "," << itemTagElement << ")"
- << " at address: " << " 0x(" << (unsigned int)currentPosition << ")"
- ) ;
- Fp->seekg(positionOnEntry, std::ios::beg);
-
- return false;
- }
- return true;
-}
-
-/**
- * \brief Assuming the internal file pointer \ref Document::Fp
- * is placed at the beginning of a tag (TestGroup, TestElement),
- * read the length associated to the Tag.
- * \warning On success the internal file pointer \ref Document::Fp
- * is modified to point after the tag and it's length.
- * On failure (i.e. when the tag wasn't the expected tag
- * (TestGroup, TestElement) the internal file pointer
- * \ref Document::Fp is restored to it's original position.
- * @param testGroup The expected group of the tag.
- * @param testElement The expected Element of the tag.
- * @return On success returns the length associated to the tag. On failure
- * returns 0.
- */
-uint32_t Document::ReadTagLength(uint16_t testGroup, uint16_t testElement)
-{
-
- if ( !ReadTag(testGroup, testElement) )
- {
- return 0;
- }
-
- //// Then read the associated Item Length
- long currentPosition = Fp->tellg();
- uint32_t itemLength = ReadInt32();
- {
- gdcmVerboseMacro( "Basic Item Length is: "
- << itemLength << std::endl
- << " at address: " << std::hex << (unsigned int)currentPosition);
- }
- return itemLength;
-}
-
-/**
- * \brief When parsing the Pixel Data of an encapsulated file, read
- * the basic offset table (when present, and BTW dump it).
- */
-void Document::ReadAndSkipEncapsulatedBasicOffsetTable()
-{
- //// Read the Basic Offset Table Item Tag length...
- uint32_t itemLength = ReadTagLength(0xfffe, 0xe000);
-
- // When present, read the basic offset table itself.
- // Notes: - since the presence of this basic offset table is optional
- // we can't rely on it for the implementation, and we will simply
- // trash it's content (when present).
- // - still, when present, we could add some further checks on the
- // lengths, but we won't bother with such fuses for the time being.
- if ( itemLength != 0 )
- {
- char *basicOffsetTableItemValue = new char[itemLength + 1];
- Fp->read(basicOffsetTableItemValue, itemLength);
-
-#ifdef GDCM_DEBUG
- for (unsigned int i=0; i < itemLength; i += 4 )
- {
- uint32_t individualLength = str2num( &basicOffsetTableItemValue[i],
- uint32_t);
- gdcmVerboseMacro( "Read one length: " <<
- std::hex << individualLength );
- }
-#endif //GDCM_DEBUG
-
- delete[] basicOffsetTableItemValue;
- }
-}
-