1 /*=========================================================================
4 Module: $RCSfile: gdcmElementSet.cxx,v $
6 Date: $Date: 2004/06/20 18:08:47 $
7 Version: $Revision: 1.8 $
9 Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
10 l'Image). All rights reserved. See Doc/License.txt or
11 http://www.creatis.insa-lyon.fr/Public/Gdcm/License.htm for details.
13 This software is distributed WITHOUT ANY WARRANTY; without even
14 the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
15 PURPOSE. See the above copyright notices for more information.
17 =========================================================================*/
19 #include "gdcmElementSet.h"
20 #include "gdcmDebug.h"
22 //-----------------------------------------------------------------------------
23 // Constructor / Destructor
25 * \ingroup gdcmElementSet
26 * \brief Constructor from a given gdcmElementSet
28 gdcmElementSet::gdcmElementSet(int depthLevel)
29 : gdcmDocEntrySet(depthLevel) {
33 * \ingroup gdcmElementSet
34 * \brief Canonical destructor.
36 gdcmElementSet::~gdcmElementSet()
38 gdcmDocEntry* EntryToDelete;
39 for(TagDocEntryHT::iterator cc = tagHT.begin();cc != tagHT.end();++cc)
41 EntryToDelete = cc->second;
43 delete EntryToDelete; // TODO : a verifier
49 //-----------------------------------------------------------------------------
53 //-----------------------------------------------------------------------------
56 * \brief Prints the Header Entries (Dicom Elements)
60 void gdcmElementSet::Print(std::ostream & os) {
61 for (TagDocEntryHT::iterator i = tagHT.begin(); i != tagHT.end(); ++i)
63 //(*i)->second->SetPrintLevel(printLevel);
64 (i->second)->Print(os);
69 //-----------------------------------------------------------------------------
72 //-----------------------------------------------------------------------------
74 //-----------------------------------------------------------------------------
79 * \brief add a new Dicom Element pointer to the H Table
80 * @param NewEntry entry to add
82 bool gdcmElementSet::AddEntry( gdcmDocEntry *NewEntry) {
84 key = NewEntry->GetKey();
86 if(tagHT.count(key) == 1)
88 dbg.Verbose(1, "gdcmElementSet::AddEntry key already present: ",
94 tagHT[NewEntry->GetKey()] = NewEntry;
100 * \brief Clear the hash table from given entry.
101 * @param EntryToRemove Entry to remove.
103 bool gdcmElementSet::RemoveEntry( gdcmDocEntry *EntryToRemove)
105 TagKey key = EntryToRemove->GetKey();
106 if(tagHT.count(key) == 1)
109 dbg.Verbose(0, "gdcmElementSet::RemoveEntry: one element erased.");
113 dbg.Verbose(0, "gdcmElementSet::RemoveEntry: key not present: ");