1 /*=========================================================================
4 Module: $RCSfile: gdcmDocEntrySet.h,v $
6 Date: $Date: 2004/10/12 04:35:45 $
7 Version: $Revision: 1.20 $
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
22 #include "gdcmException.h"
32 typedef std::string BaseTagKey;
33 //-----------------------------------------------------------------------------
36 * \ref DocEntrySet is an abstract base class for \ref ElementSet
37 * and \ref SQItem which are both containers for DocEntries.
38 * \ref ElementSet is based on the STL map<> container
39 * (see \ref ElementSet::TagHT), as opposed to \ref SQItem
40 * which is based on an STL list container (see \ref SQItem::docEntries).
41 * Since the syntax for adding a new element to a map<> or a list<>
42 * differ, \ref DocEntrySet is designed as an adapter to unify the
43 * interfaces of \ref DocEntrySet and \ref ElementSet.
44 * As an illustration of this design, please refer to the implementation
45 * of \ref AddEntry (or any pure virtual method) in both derived classes.
46 * This adapter unification of interfaces enables the parsing of a
47 * DICOM header containing (optionaly heavily nested) sequences to be
48 * written recursively [see \ref Document::ParseDES
49 * which calls \ref Document::ParseSQ, which in turns calls
50 * \ref Document::ParseDES ].
52 * \note Developpers should strongly resist to the temptation of adding
53 * members to this class since this class is designed as an adapter
54 * in the form of an abstract base class.
56 class GDCM_EXPORT DocEntrySet
60 virtual ~DocEntrySet() {};
62 /// \brief adds any type of entry to the entry set (pure vitual)
63 virtual bool AddEntry(DocEntry *Entry) = 0; // pure virtual
65 /// \brief prints any type of entry to the entry set (pure vitual)
66 virtual void Print (std::ostream & os = std::cout) = 0;// pure virtual
68 /// \brief write any type of entry to the entry set
69 virtual void Write (FILE *fp, FileType filetype) = 0;// pure virtual
71 virtual DocEntry* GetDocEntryByNumber(uint16_t group,
72 uint16_t element) = 0;
73 DocEntry *GetDocEntryByName(std::string const & name);
74 virtual std::string GetEntryByNumber(uint16_t group,uint16_t element) = 0;
75 std::string GetEntryByName(TagName const & name);
76 DictEntry *NewVirtualDictEntry(uint16_t group,
78 std::string const & vr = "unkn",
79 std::string const & fourth = "unkn",
80 std::string const & name = "unkn");
84 // DocEntry related utilities
85 ValEntry* NewValEntryByNumber(uint16_t group,
87 BinEntry* NewBinEntryByNumber(uint16_t group,
89 DocEntry* NewDocEntryByNumber(uint16_t group,
91 DocEntry* NewDocEntryByNumber(uint16_t group,
93 std::string const & VR);
94 DocEntry* NewDocEntryByName (std::string const & name);
95 SeqEntry* NewSeqEntryByNumber(uint16_t group,
98 // DictEntry related utilities
99 DictEntry *GetDictEntryByName (std::string const & name);
100 DictEntry *GetDictEntryByNumber(uint16_t, uint16_t);
104 } // end namespace gdcm
105 //-----------------------------------------------------------------------------