]> Creatis software - gdcm.git/blob - src/gdcmElementSet.h
Some normalizations :
[gdcm.git] / src / gdcmElementSet.h
1 /*=========================================================================
2                                                                                 
3   Program:   gdcm
4   Module:    $RCSfile: gdcmElementSet.h,v $
5   Language:  C++
6   Date:      $Date: 2005/01/23 10:12:34 $
7   Version:   $Revision: 1.35 $
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 ValEntry;
31 class BinEntry;
32 class SeqEntry;
33
34 typedef std::map<TagKey, DocEntry *> TagDocEntryHT;
35
36 //-----------------------------------------------------------------------------
37 /**
38  * \brief
39  * \ref ElementSet is based on the STL map<> container
40  * (see \ref ElementSet::TagHT), as opposed to \ref SQItem
41  * which is based on an STL list container (see \ref ListDocEntry).
42  * It contains the 'zero-level- DocEntry (out of any Dicom Sequence)
43  */
44 class GDCM_EXPORT ElementSet : public DocEntrySet
45 {
46 public:
47    ElementSet(int);
48    ~ElementSet();
49
50    virtual void Print(std::ostream &os = std::cout, std::string const &indent = "" ); 
51
52    bool AddEntry(DocEntry *Entry);
53    bool RemoveEntry(DocEntry *EntryToRemove);
54    bool RemoveEntryNoDestroy(DocEntry *EntryToRemove);
55    
56    void WriteContent(std::ofstream *fp, FileType filetype); 
57
58    DocEntry *GetFirstEntry();
59    DocEntry *GetNextEntry();
60    DocEntry *GetLastEntry();
61    DocEntry *GetPreviousEntry();
62
63    DocEntry *GetDocEntry(uint16_t group, uint16_t elem);
64    ValEntry *GetValEntry(uint16_t group, uint16_t elem);
65    BinEntry *GetBinEntry(uint16_t group, uint16_t elem);
66    SeqEntry *GetSeqEntry(uint16_t group, uint16_t elem);
67
68    bool IsEmpty() { return TagHT.empty(); };
69    bool CheckIfEntryExist(uint16_t group, uint16_t elem);
70    std::string GetEntry(uint16_t group, uint16_t elem);
71
72 protected:
73
74 private:
75 // Variables
76    /// Hash Table (map), to provide fast access
77    TagDocEntryHT TagHT; 
78    /// Hash Table (map) iterator, used to visit the TagHT variable
79    TagDocEntryHT::iterator ItTagHT; 
80      
81    friend class DicomDir;        //For accessing private TagHT
82    friend class DocEntryArchive; //For accessing private TagHT
83 };
84 } // end namespace gdcm
85 //-----------------------------------------------------------------------------
86 #endif
87