]> Creatis software - gdcm.git/blob - src/gdcmElementSet.h
* Some classes inherit now from gdcm::RefCounter
[gdcm.git] / src / gdcmElementSet.h
1 /*=========================================================================
2                                                                                 
3   Program:   gdcm
4   Module:    $RCSfile: gdcmElementSet.h,v $
5   Language:  C++
6   Date:      $Date: 2005/10/25 14:52:34 $
7   Version:   $Revision: 1.49 $
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 "gdcmDocEntrySet.h"
23
24 #include <map>
25 #include <iostream>
26 #include <fstream>
27
28 namespace gdcm 
29 {
30 class SeqEntry;
31
32 typedef std::map<TagKey, DocEntry *> TagDocEntryHT;
33
34 //-----------------------------------------------------------------------------
35 /**
36  * \brief
37  * \ref ElementSet is based on the STL map<> container
38  * (see \ref ElementSet::TagHT), as opposed to \ref SQItem
39  * which is based on an STL list container (see \ref ListDocEntry).
40  * It contains the 'zero-level- DocEntry (out of any Dicom Sequence)
41  */
42 class GDCM_EXPORT ElementSet : public DocEntrySet
43 {
44    gdcmTypeMacro(ElementSet);
45
46 public:
47    virtual void Print(std::ostream &os = std::cout, 
48                       std::string const &indent = "" ); 
49
50    void WriteContent(std::ofstream *fp, FileType filetype); 
51
52    bool AddEntry(DocEntry *Entry);
53    bool RemoveEntry(DocEntry *EntryToRemove);
54    void ClearEntry();
55    
56    DocEntry *GetFirstEntry();
57    DocEntry *GetNextEntry();
58    DocEntry *GetDocEntry(uint16_t group, uint16_t elem);
59    /// Tells us if the ElementSet contains no entry
60    bool IsEmpty() { return TagHT.empty(); }
61
62 protected:
63    ElementSet();
64    ~ElementSet();
65
66 private:
67 // Variables
68    /// Hash Table (map), to provide fast access
69    TagDocEntryHT TagHT;
70    /// iterator, used to visit the TagHT variable
71    TagDocEntryHT::iterator ItTagHT;
72 };
73 } // end namespace gdcm
74 //-----------------------------------------------------------------------------
75 #endif
76