#include <gdcmDocEntryArchive.h>
Public Member Functions | |
DocEntryArchive (File *file) | |
Constructor. | |
~DocEntryArchive () | |
Destructor. | |
void | Print (std::ostream &os=std::cout) |
Print all. | |
bool | Push (DocEntry *newEntry) |
Replace in the Header a DocEntry by the new DocEntry. The last DocEntry is kept in archive. | |
bool | Push (uint16_t group, uint16_t elem) |
Replace in the Header a DocEntry by the new DocEntry. The last DocEntry is kept in archive. | |
bool | Restore (uint16_t group, uint16_t elem) |
Restore in the Header the DocEntry that have the generalized key. The old entry is destroyed. | |
void | ClearArchive (void) |
Remove all DocEntry that are in the archive. The entries aren't restored but only destroyed. | |
Private Attributes | |
File * | ArchFile |
pointer to the gdcm::File pointer we want to save values from | |
TagDocEntryHT | Archive |
H table to save values. |
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 } |
|
Remove all DocEntry that are in the archive. The entries aren't restored but only destroyed.
Definition at line 139 of file gdcmDocEntryArchive.cxx. References Archive. Referenced by ~DocEntryArchive().
|
|
Print all.
Definition at line 162 of file gdcmDocEntryArchive.cxx. References Archive.
|
|
Replace in the Header a DocEntry by the new DocEntry. The last DocEntry is kept in archive.
Definition at line 87 of file gdcmDocEntryArchive.cxx. References ArchFile, Archive, gdcm::ElementSet::GetDocEntry(), and gdcm::ElementSet::RemoveEntryNoDestroy().
00088 { 00089 std::string key = DictEntry::TranslateToKey(group,elem); 00090 00091 if( Archive.find(key)==Archive.end() ) 00092 { 00093 // Save the old DocEntry if any 00094 DocEntry *old = ArchFile->GetDocEntry(group,elem); 00095 Archive[key] = old; 00096 if( old ) 00097 ArchFile->RemoveEntryNoDestroy(old); 00098 00099 return true; 00100 } 00101 return false; 00102 } |
|
Replace in the Header a DocEntry by the new DocEntry. The last 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(), and gdcm::ElementSet::RemoveEntryNoDestroy(). Referenced by gdcm::FileHelper::SetWriteFileTypeToACR(), gdcm::FileHelper::SetWriteFileTypeToExplicitVR(), gdcm::FileHelper::SetWriteFileTypeToImplicitVR(), 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 std::string 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 ArchFile->RemoveEntryNoDestroy(old); 00070 00071 // Set the new DocEntry 00072 ArchFile->AddEntry(newEntry); 00073 00074 return true; 00075 } 00076 return false; 00077 } |
|
Restore in the Header the DocEntry that have the generalized key. The old entry is destroyed.
Definition at line 112 of file gdcmDocEntryArchive.cxx. References gdcm::ElementSet::AddEntry(), ArchFile, Archive, gdcm::ElementSet::GetDocEntry(), and gdcm::ElementSet::RemoveEntry(). Referenced by gdcm::FileHelper::RestoreWrite(), gdcm::FileHelper::RestoreWriteFileType(), and gdcm::FileHelper::RestoreWriteOfLibido().
00113 { 00114 std::string key=DictEntry::TranslateToKey(group,elem); 00115 00116 TagDocEntryHT::iterator restoreIt=Archive.find(key); 00117 if( restoreIt!=Archive.end() ) 00118 { 00119 // Delete the new value 00120 DocEntry *rem = ArchFile->GetDocEntry(group,elem); 00121 if( rem ) 00122 ArchFile->RemoveEntry(rem); 00123 00124 // Restore the old value 00125 if( Archive[key] ) 00126 ArchFile->AddEntry(Archive[key]); 00127 00128 Archive.erase(restoreIt); 00129 00130 return true; 00131 } 00132 return false; 00133 } |
|
pointer to the gdcm::File pointer we want to save values from
Definition at line 53 of file gdcmDocEntryArchive.h. Referenced by DocEntryArchive(), Push(), and Restore(). |
|
H table to save values.
Definition at line 55 of file gdcmDocEntryArchive.h. Referenced by ClearArchive(), Print(), Push(), and Restore(). |