1 /*=========================================================================
4 Module: $RCSfile: gdcmDict.h,v $
6 Date: $Date: 2005/10/25 14:52:34 $
7 Version: $Revision: 1.45 $
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 =========================================================================*/
22 #include "gdcmRefCounter.h"
23 #include "gdcmDictEntry.h"
26 #include <fstream> // for ifstream
33 //-----------------------------------------------------------------------------
34 typedef std::string DictKey;
35 typedef std::map<TagKey, DictEntry *> TagKeyHT;
37 //-----------------------------------------------------------------------------
39 * \brief Dict acts a memory representation of a dicom dictionary i.e.
40 * it is a container for a collection of dictionary entries.
41 * The dictionary is loaded from in an ascii file.
42 * There should be a single public dictionary (THE dictionary of
43 * the actual DICOM v3) but as many shadow dictionaries as imagers
44 * combined with all software versions...
47 class GDCM_EXPORT Dict : public RefCounter
52 static Dict *New() {return new Dict();}
53 static Dict *New(std::string const &filename) {return new Dict(filename);}
55 bool AddDict(std::string const &filename);
56 bool RemoveDict(std::string const &filename);
58 void Print(std::ostream &os = std::cout, std::string const &indent = "");
61 bool AddEntry(DictEntry *newEntry);
62 bool ReplaceEntry(DictEntry *newEntry);
63 bool RemoveEntry (TagKey const &key);
64 bool RemoveEntry (uint16_t group, uint16_t elem);
68 DictEntry *GetEntry(uint16_t group, uint16_t elem);
69 DictEntry *GetEntry(TagKey const &key);
71 DictEntry *GetFirstEntry();
72 DictEntry *GetNextEntry();
76 Dict(std::string const &filename);
80 void DoTheLoadingJob(std::ifstream &ifs);
82 /// ASCII file holding the Dictionnary
85 /// Access through TagKey
87 /// Iterator for the entries
88 TagKeyHT::iterator ItKeyHt;
90 } // end namespace gdcm
92 //-----------------------------------------------------------------------------