#include <gdcmDocEntryArchive.h>
Collaboration diagram for gdcm::DocEntryArchive:
Private Member Functions | |
DocEntryArchive (File *file) | |
Constructor. | |
~DocEntryArchive () | |
Destructor. | |
void | Print (std::ostream &os=std::cout) |
Print all. | |
bool | Push (DocEntry *newEntry) |
Replaces in the Header a DocEntry by the new DocEntry. The initial DocEntry is kept in archive. | |
bool | Push (uint16_t group, uint16_t elem) |
Removes out of the Header a DocEntry. (it's kept in archive). | |
bool | Restore (uint16_t group, uint16_t elem) |
Restore in the Header the DocEntry specified by (group,element). The archive entry is destroyed. | |
void | ClearArchive (void) |
Removes all DocEntry from the archive, and destroy them. The archives entries aren't restored. | |
Private Attributes | |
File * | ArchFile |
pointer to the gdcm::File pointer we want to save values from | |
TagDocEntryHT | Archive |
H table to save values. | |
Friends | |
class | FileHelper |
Definition at line 37 of file gdcmDocEntryArchive.h.
|
Constructor.
Definition at line 32 of file gdcmDocEntryArchive.cxx. References ArchFile. 00033 { 00034 ArchFile = file; 00035 }
|
|
Destructor.
Definition at line 40 of file gdcmDocEntryArchive.cxx. References ClearArchive(). 00041 { 00042 ClearArchive(); 00043 }
|
|
Removes all DocEntry from the archive, and destroy them. The archives entries aren't restored.
Definition at line 150 of file gdcmDocEntryArchive.cxx. References Archive. Referenced by ~DocEntryArchive(). 00151 { 00152 for(TagDocEntryHT::iterator it = Archive.begin(); 00153 it!=Archive.end(); 00154 ++it) 00155 { 00156 if(it->second) 00157 it->second->Unregister(); 00158 } 00159 Archive.clear(); 00160 }
|
|
Print all.
Definition at line 174 of file gdcmDocEntryArchive.cxx. References Archive. 00175 { 00176 os << "Elements in archives :" << std::endl; 00177 for(TagDocEntryHT::iterator it = Archive.begin(); 00178 it!=Archive.end(); 00179 ++it) 00180 { 00181 if ( it->second ) 00182 it->second->Print(os); 00183 } 00184 }
|
|
Removes out of the Header a DocEntry. (it's kept in archive).
Definition at line 90 of file gdcmDocEntryArchive.cxx. References ArchFile, Archive, gdcm::ElementSet::GetDocEntry(), gdcm::RefCounter::Register(), gdcm::ElementSet::RemoveEntry(), and gdcm::DictEntry::TranslateToKey(). 00091 { 00092 TagKey key = DictEntry::TranslateToKey(group, elem); 00093 00094 if ( Archive.find(key)==Archive.end() ) 00095 { 00096 // Save the old DocEntry if any 00097 DocEntry *old = ArchFile->GetDocEntry(group, elem); 00098 Archive[key] = old; 00099 if ( old ) 00100 { 00101 old->Register(); 00102 ArchFile->RemoveEntry(old); 00103 } 00104 00105 return true; 00106 } 00107 return false; 00108 }
|
|
Replaces in the Header a DocEntry by the new DocEntry. The initial DocEntry is kept in archive.
Definition at line 54 of file gdcmDocEntryArchive.cxx. References gdcm::ElementSet::AddEntry(), ArchFile, Archive, gdcm::DocEntry::GetDictEntry(), gdcm::ElementSet::GetDocEntry(), gdcm::DictEntry::GetElement(), gdcm::DictEntry::GetGroup(), gdcm::RefCounter::Register(), gdcm::ElementSet::RemoveEntry(), and gdcm::DictEntry::TranslateToKey(). Referenced by gdcm::FileHelper::CheckMandatoryElements(), gdcm::FileHelper::CheckMandatoryEntry(), gdcm::FileHelper::CopyMandatoryEntry(), gdcm::FileHelper::SetMandatoryEntry(), gdcm::FileHelper::SetWriteFileTypeToACR(), gdcm::FileHelper::SetWriteFileTypeToExplicitVR(), gdcm::FileHelper::SetWriteFileTypeToImplicitVR(), gdcm::FileHelper::SetWriteFileTypeToJPEG(), gdcm::FileHelper::SetWriteToLibido(), gdcm::FileHelper::SetWriteToNoLibido(), gdcm::FileHelper::SetWriteToRaw(), and gdcm::FileHelper::SetWriteToRGB(). 00055 { 00056 if ( !newEntry ) 00057 return false; 00058 00059 uint16_t group = newEntry->GetDictEntry()->GetGroup(); 00060 uint16_t elem = newEntry->GetDictEntry()->GetElement(); 00061 TagKey key = DictEntry::TranslateToKey(group,elem); 00062 00063 if ( Archive.find(key) == Archive.end() ) 00064 { 00065 // Save the old DocEntry if any 00066 DocEntry *old = ArchFile->GetDocEntry(group, elem); 00067 Archive[key] = old; 00068 if ( old ) 00069 { 00070 old->Register(); 00071 ArchFile->RemoveEntry(old); 00072 } 00073 00074 // Set the new DocEntry 00075 ArchFile->AddEntry(newEntry); 00076 00077 return true; 00078 } 00079 return false; 00080 }
|
|
Restore in the Header the DocEntry specified by (group,element). The archive entry is destroyed.
Definition at line 118 of file gdcmDocEntryArchive.cxx. References gdcm::ElementSet::AddEntry(), ArchFile, Archive, gdcm::ElementSet::GetDocEntry(), gdcm::ElementSet::RemoveEntry(), and gdcm::DictEntry::TranslateToKey(). Referenced by gdcm::FileHelper::RestoreWrite(), gdcm::FileHelper::RestoreWriteMandatory(), and gdcm::FileHelper::RestoreWriteOfLibido(). 00119 { 00120 TagKey key=DictEntry::TranslateToKey(group, elem); 00121 00122 TagDocEntryHT::iterator restoreIt=Archive.find(key); 00123 if ( restoreIt!=Archive.end() ) 00124 { 00125 // Delete the new value 00126 DocEntry *rem = ArchFile->GetDocEntry(group, elem); 00127 if ( rem ) 00128 { 00129 ArchFile->RemoveEntry(rem); 00130 } 00131 00132 // Restore the old value 00133 if ( restoreIt->second ) 00134 { 00135 ArchFile->AddEntry(restoreIt->second); 00136 restoreIt->second->Unregister(); 00137 } 00138 00139 Archive.erase(restoreIt); 00140 00141 return true; 00142 } 00143 return false; 00144 }
|
|
Definition at line 40 of file gdcmDocEntryArchive.h. |
|
pointer to the gdcm::File pointer we want to save values from
Definition at line 55 of file gdcmDocEntryArchive.h. Referenced by DocEntryArchive(), Push(), and Restore(). |
|
H table to save values.
Definition at line 57 of file gdcmDocEntryArchive.h. Referenced by ClearArchive(), Print(), Push(), and Restore(). |