| 808 | |
| 809 | |
| 810 | E_Condition DcmDicomDir::convertTreeToLinear(Uint32 beginOfDataSet, |
| 811 | E_TransferSyntax oxfer, |
| 812 | E_EncodingType enctype, |
| 813 | DcmSequenceOfItems &unresRecs ) |
| 814 | { |
| 815 | Bdebug((1, "dcdicdir:DcmDicomDir::convertTreeToLinear(beginOfDataSet=%ld)", |
| 816 | beginOfDataSet )); |
| 817 | |
| 818 | E_Condition l_error = EC_Normal; |
| 819 | DcmDataset &dset = this->getDataset(); // existiert auf jeden Fall |
| 820 | DcmSequenceOfItems &localDirRecSeq = this->getDirRecSeq( dset ); |
| 821 | |
| 822 | // Kopiere Items, auf die kein Zeiger existiert, in temporaere Liste |
| 823 | unsigned long numUnresItems = localDirRecSeq.card(); |
| 824 | for (unsigned long i = numUnresItems; i > 0; i-- ) |
| 825 | { |
| 826 | debug(( 2, "copy pointer of unresolved Record no %ld of %ld to unresRecs-SQ:", |
| 827 | i, numUnresItems )); |
| 828 | |
| 829 | unresRecs.insert( localDirRecSeq.getItem(i-1), 0 ); |
| 830 | } |
| 831 | debug(( 5, "copied %d pointer of unresolvedRecords", numUnresItems )); |
| 832 | |
| 833 | // Konvertiere Items in die Root Directory Entity zurueck: |
| 834 | DcmDirectoryRecord *firstRootRecord[1], *lastRootRecord[1]; |
| 835 | copyRecordPtrToSQ( &this->getRootRecord(), |
| 836 | localDirRecSeq, |
| 837 | firstRootRecord, |
| 838 | lastRootRecord ); |
| 839 | |
| 840 | // Setze Zeiger auf ersten Directory Record: |
| 841 | DcmUnsignedLongOffset *offElem = lookForOffsetElem( &dset, |
| 842 | DCM_RootDirectoryFirstRecord ); |
| 843 | if ( offElem != (DcmUnsignedLongOffset*)NULL ) |
| 844 | offElem->setNextRecord( *firstRootRecord ); |
| 845 | |
| 846 | // Setze Zeiger auf letzen Directory Record: |
| 847 | offElem = lookForOffsetElem( &dset, |
| 848 | DCM_RootDirectoryLastRecord ); |
| 849 | if ( offElem != (DcmUnsignedLongOffset*)NULL ) |
| 850 | offElem->setNextRecord( *lastRootRecord ); |
| 851 | |
| 852 | // Kopiere MRDRs in localDirRecSeq |
| 853 | unsigned long numMRDRItems = this->getMRDRSequence().card(); |
| 854 | for (unsigned long j = numMRDRItems; j > 0; j-- ) |
| 855 | { |
| 856 | debug(( 2, "copy pointer of MRDR no %ld of %ld to localDirRecSeq:", |
| 857 | j, numUnresItems )); |
| 858 | |
| 859 | localDirRecSeq.insert( this->getMRDRSequence().getItem(j-1), 0 ); |
| 860 | } |
| 861 | |
| 862 | // konvertiere im Fehlerfall ein zweites Mal: |
| 863 | if ( convertAllPointer( dset, beginOfDataSet, oxfer, enctype ) |
| 864 | == EC_InvalidVR ) |
| 865 | if ( convertAllPointer( dset, beginOfDataSet, oxfer, enctype ) |
| 866 | == EC_InvalidVR ) |
| 867 | { |
nothing calls this directly
no test coverage detected