#include <gdcmDocEntryArchive.h>
Collaboration diagram for GDCM_NAME_SPACE::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 155 of file gdcmDocEntryArchive.cxx. References Archive. Referenced by ~DocEntryArchive(). 00156 { 00157 for(TagDocEntryHT::iterator it = Archive.begin(); 00158 it!=Archive.end(); 00159 ++it) 00160 { 00161 if(it->second) 00162 it->second->Unregister(); 00163 } 00164 Archive.clear(); 00165 }
|
|
Print all.
Definition at line 179 of file gdcmDocEntryArchive.cxx. References Archive. 00180 { 00181 os << "Elements in archives :" << std::endl; 00182 for(TagDocEntryHT::iterator it = Archive.begin(); 00183 it!=Archive.end(); 00184 ++it) 00185 { 00186 if ( it->second ) 00187 it->second->Print(os); 00188 } 00189 }
|
|
Removes out of the Header a DocEntry. (it's kept in archive).
Definition at line 95 of file gdcmDocEntryArchive.cxx. References ArchFile, Archive, GDCM_NAME_SPACE::ElementSet::GetDocEntry(), and GDCM_NAME_SPACE::ElementSet::RemoveEntry(). 00096 { 00097 //TagKey key = DictEntry::TranslateToKey(group, elem); 00098 TagKey key(group, elem); 00099 if ( Archive.find(key)==Archive.end() ) 00100 { 00101 // Save the old DocEntry if any 00102 DocEntry *old = ArchFile->GetDocEntry(group, elem); 00103 Archive[key] = old; 00104 if ( old ) 00105 { 00106 old->Register(); 00107 ArchFile->RemoveEntry(old); 00108 } 00109 00110 return true; 00111 } 00112 return false; 00113 }
|
|
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_NAME_SPACE::ElementSet::AddEntry(), ArchFile, Archive, GDCM_NAME_SPACE::ElementSet::GetDocEntry(), GDCM_NAME_SPACE::DocEntry::GetElement(), GDCM_NAME_SPACE::DocEntry::GetGroup(), GDCM_NAME_SPACE::DocEntry::GetKey(), GDCM_NAME_SPACE::RefCounter::Register(), and GDCM_NAME_SPACE::ElementSet::RemoveEntry(). Referenced by GDCM_NAME_SPACE::FileHelper::CheckMandatoryElements(), GDCM_NAME_SPACE::FileHelper::CheckMandatoryEntry(), GDCM_NAME_SPACE::FileHelper::CopyMandatoryEntry(), GDCM_NAME_SPACE::FileHelper::SetMandatoryEntry(), GDCM_NAME_SPACE::FileHelper::SetWriteFileTypeToACR(), GDCM_NAME_SPACE::FileHelper::SetWriteFileTypeToExplicitVR(), GDCM_NAME_SPACE::FileHelper::SetWriteFileTypeToImplicitVR(), GDCM_NAME_SPACE::FileHelper::SetWriteFileTypeToJPEG(), GDCM_NAME_SPACE::FileHelper::SetWriteFileTypeToJPEG2000(), GDCM_NAME_SPACE::FileHelper::SetWriteToLibido(), and GDCM_NAME_SPACE::FileHelper::SetWriteToNoLibido(). 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 TagKey key = newEntry->GetKey(); 00064 00065 if ( Archive.find(key) == Archive.end() ) 00066 { 00067 uint16_t group = newEntry->GetGroup(); 00068 uint16_t elem = newEntry->GetElement(); 00069 00070 // Save the old DocEntry if any 00071 DocEntry *old = ArchFile->GetDocEntry(group, elem); 00072 Archive[key] = old; 00073 if ( old ) 00074 { 00075 old->Register(); 00076 ArchFile->RemoveEntry(old); 00077 } 00078 00079 // Set the new DocEntry 00080 ArchFile->AddEntry(newEntry); 00081 00082 return true; 00083 } 00084 return false; 00085 }
|
|
Restore in the Header the DocEntry specified by (group,element). The archive entry is destroyed.
Definition at line 123 of file gdcmDocEntryArchive.cxx. References GDCM_NAME_SPACE::ElementSet::AddEntry(), ArchFile, Archive, GDCM_NAME_SPACE::ElementSet::GetDocEntry(), and GDCM_NAME_SPACE::ElementSet::RemoveEntry(). Referenced by GDCM_NAME_SPACE::FileHelper::RestoreWrite(), GDCM_NAME_SPACE::FileHelper::RestoreWriteMandatory(), and GDCM_NAME_SPACE::FileHelper::RestoreWriteOfLibido(). 00124 { 00125 //TagKey key=DictEntry::TranslateToKey(group, elem); 00126 TagKey key(group, elem); 00127 TagDocEntryHT::iterator restoreIt=Archive.find(key); 00128 if ( restoreIt!=Archive.end() ) 00129 { 00130 // Delete the new value 00131 DocEntry *rem = ArchFile->GetDocEntry(group, elem); 00132 if ( rem ) 00133 { 00134 ArchFile->RemoveEntry(rem); 00135 } 00136 00137 // Restore the old value 00138 if ( restoreIt->second ) 00139 { 00140 ArchFile->AddEntry(restoreIt->second); 00141 restoreIt->second->Unregister(); 00142 } 00143 00144 Archive.erase(restoreIt); 00145 00146 return true; 00147 } 00148 return false; 00149 }
|
|
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(). |