]> Creatis software - gdcm.git/blob - src/gdcmDict.h
36e579843f1aede15142ecb70ddf0c2b20208a3f
[gdcm.git] / src / gdcmDict.h
1 /*=========================================================================
2                                                                                 
3   Program:   gdcm
4   Module:    $RCSfile: gdcmDict.h,v $
5   Language:  C++
6   Date:      $Date: 2005/02/02 15:07:41 $
7   Version:   $Revision: 1.37 $
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 GDCMDICT_H
20 #define GDCMDICT_H
21
22 #include "gdcmBase.h"
23 #include "gdcmDictEntry.h"
24
25 #include <iostream>
26 #include <list>
27 #include <map>
28
29 namespace gdcm 
30 {
31
32 //-----------------------------------------------------------------------------
33 typedef std::string DictKey;
34 typedef std::map<TagKey, DictEntry>  TagKeyHT;
35 //typedef std::list<std::string>       EntryNamesList;
36 //typedef std::map<std::string, 
37 //            std::list<std::string> > EntryNamesByCatMap;
38 //-----------------------------------------------------------------------------
39 /**
40  * \brief    Dict acts a memory representation of a dicom dictionary i.e.
41  *           it is a container for a collection of dictionary entries.
42  *           The dictionary is loaded from in an ascii file.
43  *           There should be a single public dictionary (THE dictionary of
44  *           the actual DICOM v3) but as many shadow dictionaries as imagers 
45  *           combined with all software versions...
46  * \see DictSet
47  */
48 class GDCM_EXPORT Dict : public Base
49 {
50 public:
51    Dict();
52    Dict(std::string const &filename);
53    ~Dict();
54
55 // Print
56    void Print(std::ostream &os = std::cout, std::string const &indent = "");
57
58 // Entries
59    bool AddEntry(DictEntry const &newEntry);
60    bool ReplaceEntry(DictEntry const &newEntry);
61    bool RemoveEntry (TagKey const &key);
62    bool RemoveEntry (uint16_t group, uint16_t elem);
63    void ClearEntry();
64    
65 // Tag
66    DictEntry *GetEntry(uint16_t group, uint16_t elem);
67
68    DictEntry *GetFirstEntry();
69    DictEntry *GetNextEntry();
70
71 private:
72    /// ASCII file holding the Dictionnary
73    std::string Filename;
74
75    /// Access through TagKey
76    TagKeyHT KeyHt;
77    TagKeyHT::iterator ItKeyHt;
78 };
79 } // end namespace gdcm
80
81 //-----------------------------------------------------------------------------
82 #endif