]> Creatis software - gdcm.git/blob - src/gdcmElementSet.h
ENH: Apply patch from ITK back to main CVS. Fix problem with gcc2.95, we may need...
[gdcm.git] / src / gdcmElementSet.h
1 /*=========================================================================
2                                                                                 
3   Program:   gdcm
4   Module:    $RCSfile: gdcmElementSet.h,v $
5   Language:  C++
6   Date:      $Date: 2004/11/30 16:24:31 $
7   Version:   $Revision: 1.25 $
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.html for details.
12                                                                                 
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.
16                                                                                 
17 =========================================================================*/
18
19 #ifndef GDCMELEMENTSET_H
20 #define GDCMELEMENTSET_H
21
22 #include "gdcmCommon.h"
23 #include "gdcmDocEntrySet.h"
24 #include <map>
25 #include <iostream>
26 #include <fstream>
27
28 class ValEntry;
29 class BinEntry;
30 class SeqEntry;
31
32 namespace gdcm 
33 {
34 typedef std::map<TagKey, DocEntry *> TagDocEntryHT;
35
36 //-----------------------------------------------------------------------------
37
38 class GDCM_EXPORT ElementSet : public DocEntrySet
39 {
40 public:
41    ElementSet(int);
42    ~ElementSet();
43
44    bool AddEntry(DocEntry *Entry);
45    bool RemoveEntry(DocEntry *EntryToRemove);
46    bool RemoveEntryNoDestroy(DocEntry *EntryToRemove);
47    
48    void Print(std::ostream &os = std::cout); 
49    void WriteContent(std::ofstream *fp, FileType filetype); 
50    
51    /// Accessor to \ref TagHT
52    // Do not expose this to user (public API) ! 
53    // A test is using it thus put it in public (matt)
54    TagDocEntryHT const & GetTagHT() const { return TagHT; };
55
56    void Initialize();
57    DocEntry *GetNextEntry();
58
59 protected:
60     
61 private:
62 // Variables
63    /// Hash Table (map), to provide fast access
64    TagDocEntryHT TagHT; 
65    /// Hash Table (map) iterator, used to visit the TagHT variable
66    TagDocEntryHT::iterator ItTagHT; 
67  
68    friend class Document;
69    friend class DicomDir; //For accessing private TagHT
70    friend class DocEntryArchive; //For accessing private TagHT
71 };
72 } // end namespace gdcm
73 //-----------------------------------------------------------------------------
74 #endif
75