]> Creatis software - gdcm.git/blob - src/gdcmDocEntrySet.h
* src/gdcmDocEntrySet.[h|cxx] : Remove used methods
[gdcm.git] / src / gdcmDocEntrySet.h
1 /*=========================================================================
2                                                                                 
3   Program:   gdcm
4   Module:    $RCSfile: gdcmDocEntrySet.h,v $
5   Language:  C++
6   Date:      $Date: 2005/01/06 17:20:53 $
7   Version:   $Revision: 1.32 $
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 GDCMDOCENTRYSET_H
20 #define GDCMDOCENTRYSET_H
21
22 #include "gdcmBase.h"
23 #include "gdcmException.h"
24 #include <fstream>
25
26 namespace gdcm 
27 {
28 class DocEntry;
29 class ValEntry;
30 class BinEntry;
31 class SeqEntry;
32 class DictEntry;
33
34 typedef std::string BaseTagKey;
35 //-----------------------------------------------------------------------------
36
37 /**
38  * \ref DocEntrySet is an abstract base class for \ref ElementSet
39  * and \ref SQItem which are both containers for DocEntries.
40  * \ref ElementSet is based on the STL map<> container
41  * (see \ref ElementSet::TagHT), as opposed to \ref SQItem
42  * which is based on an STL list container (see \ref ListDocEntry).
43  * Since the syntax for adding a new element to a map<> or a list<>
44  * differ, \ref DocEntrySet is designed as an adapter to unify the
45  * interfaces of \ref DocEntrySet and \ref ElementSet.
46  * As an illustration of this design, please refer to the implementation
47  * of \ref AddEntry (or any pure virtual method) in both derived classes.
48  * This adapter unification of interfaces enables the parsing of a
49  * DICOM header containing (optionaly heavily nested) sequences to be
50  * written recursively [see \ref Document::ParseDES 
51  * which calls \ref Document::ParseSQ, which in turns calls 
52  * \ref Document::ParseDES ].
53  *
54  * \note Developpers should strongly resist to the temptation of adding
55  *       members to this class since this class is designed as an adapter 
56  *       in the form of an abstract base class.
57  */
58 class GDCM_EXPORT DocEntrySet : public Base
59 {
60 friend class File;
61 public:
62    DocEntrySet() {};
63    virtual ~DocEntrySet() {};
64
65    /// \brief adds any type of entry to the entry set (pure vitual)
66    virtual bool AddEntry(DocEntry *Entry) = 0; // pure virtual
67    virtual bool RemoveEntry(DocEntry *EntryToRemove)=0; // pure virtual
68    virtual bool RemoveEntryNoDestroy(DocEntry *EntryToRemove)=0; // pure virtual
69
70    /// \brief write any type of entry to the entry set
71    virtual void WriteContent (std::ofstream *fp, FileType filetype) = 0;// pure virtual
72
73    virtual DocEntry* GetDocEntryByNumber(uint16_t group,
74                                          uint16_t elem) = 0;
75    DocEntry* GetDocEntryByName(TagName const & name);
76    virtual std::string GetEntryByNumber(uint16_t group, uint16_t elem) = 0;
77    std::string GetEntryByName(TagName const & name);
78
79    DictEntry* NewVirtualDictEntry(uint16_t group, 
80                                   uint16_t element,
81                                   TagName const & vr     = GDCM_UNKNOWN,
82                                   TagName const & fourth = GDCM_UNKNOWN,
83                                   TagName const & name   = GDCM_UNKNOWN );
84   
85 protected:
86 // DocEntry  related utilities 
87    ValEntry* NewValEntryByNumber(uint16_t group,uint16_t elem,
88                                  TagName const & vr = GDCM_UNKNOWN);
89    BinEntry* NewBinEntryByNumber(uint16_t group,uint16_t elem,
90                                  TagName const & vr = GDCM_UNKNOWN);
91    SeqEntry* NewSeqEntryByNumber(uint16_t group,uint16_t elem);
92
93 // DictEntry  related utilities
94    DictEntry *GetDictEntryByName  (TagName const & name);
95    DictEntry *GetDictEntryByNumber(uint16_t group, uint16_t elem);
96    DictEntry *GetDictEntryByNumber(uint16_t group, uint16_t elem,
97                                    TagName const & vr);
98 };
99
100 } // end namespace gdcm
101 //-----------------------------------------------------------------------------
102 #endif
103