1 /*=========================================================================
4 Module: $RCSfile: gdcmDocEntrySet.h,v $
6 Date: $Date: 2005/01/11 15:15:38 $
7 Version: $Revision: 1.37 $
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.
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 #ifndef GDCMDOCENTRYSET_H
20 #define GDCMDOCENTRYSET_H
23 #include "gdcmException.h"
34 typedef std::string BaseTagKey;
35 //-----------------------------------------------------------------------------
39 * \ref DocEntrySet is an abstract base class for \ref ElementSet
40 * and \ref SQItem which are both containers for DocEntries.
41 * \ref ElementSet is based on the STL map<> container
42 * (see \ref ElementSet::TagHT), as opposed to \ref SQItem
43 * which is based on an STL list container (see \ref ListDocEntry).
44 * Since the syntax for adding a new element to a map<> or a list<>
45 * differ, \ref DocEntrySet is designed as an adapter to unify the
46 * interfaces of \ref DocEntrySet and \ref ElementSet.
47 * As an illustration of this design, please refer to the implementation
48 * of \ref AddEntry (or any pure virtual method) in both derived classes.
49 * This adapter unification of interfaces enables the parsing of a
50 * DICOM header containing (optionaly heavily nested) sequences to be
51 * written recursively [see \ref Document::ParseDES
52 * which calls \ref Document::ParseSQ, which in turns calls
53 * \ref Document::ParseDES ].
55 * \note Developpers should strongly resist to the temptation of adding
56 * members to this class since this class is designed as an adapter
57 * in the form of an abstract base class.
59 class GDCM_EXPORT DocEntrySet : public Base
64 virtual ~DocEntrySet() {};
66 /// \brief adds any type of entry to the entry set (pure vitual)
67 virtual bool AddEntry(DocEntry *Entry) = 0; // pure virtual
68 virtual bool RemoveEntry(DocEntry *EntryToRemove)=0; // pure virtual
69 virtual bool RemoveEntryNoDestroy(DocEntry *EntryToRemove)=0; // pure virtual
71 /// \brief write any type of entry to the entry set
72 virtual void WriteContent (std::ofstream *fp, FileType filetype) = 0;// pure virtual
74 virtual DocEntry *GetDocEntry(uint16_t group,
76 virtual std::string GetEntry(uint16_t group, uint16_t elem) = 0;
78 DictEntry *NewVirtualDictEntry(uint16_t group,
80 TagName const &vr = GDCM_UNKNOWN,
81 TagName const &vm = GDCM_UNKNOWN,
82 TagName const &name = GDCM_UNKNOWN );
85 // DocEntry related utilities
87 ValEntry *NewValEntry(uint16_t group,uint16_t elem,
88 TagName const &vr = GDCM_UNKNOWN);
89 BinEntry *NewBinEntry(uint16_t group,uint16_t elem,
90 TagName const &vr = GDCM_UNKNOWN);
91 SeqEntry *NewSeqEntry(uint16_t group,uint16_t elem);
93 // DictEntry related utilities
94 DictEntry *GetDictEntry(uint16_t group, uint16_t elem);
95 DictEntry *GetDictEntry(uint16_t group, uint16_t elem,
99 } // end namespace gdcm
100 //-----------------------------------------------------------------------------