]> Creatis software - gdcm.git/blob - src/gdcmDict.h
Removal of useless and dangerous methods :
[gdcm.git] / src / gdcmDict.h
1 /*=========================================================================
2                                                                                 
3   Program:   gdcm
4   Module:    $RCSfile: gdcmDict.h,v $
5   Language:  C++
6   Date:      $Date: 2005/01/07 08:46:17 $
7   Version:   $Revision: 1.27 $
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::map<TagName, DictEntry> TagNameHT;
36 typedef std::list<std::string>       EntryNamesList;
37 typedef std::map<std::string, 
38             std::list<std::string> > EntryNamesByCatMap;
39 //-----------------------------------------------------------------------------
40 /*
41  * \defgroup Dict
42  * \brief    Dict acts a memory representation of a dicom dictionary i.e.
43  *           it is a container for a collection of dictionary entries.
44  *           The dictionary is loaded from in an ascii file.
45  *           There should be a single public dictionary (THE dictionary of
46  *           the actual DICOM v3) but as many shadow dictionaries as imagers 
47  *           combined with all software versions...
48  * \see DictSet
49  */
50 class GDCM_EXPORT Dict : public Base
51 {
52 public:
53    Dict(std::string const & filename);
54    ~Dict();
55
56 // Print
57    void Print(std::ostream &os = std::cout);
58    void PrintByKey(std::ostream &os = std::cout);
59    void PrintByName(std::ostream &os = std::cout);
60
61 // Entries
62    bool AddNewEntry (DictEntry const &newEntry);
63    bool ReplaceEntry(DictEntry const &newEntry);
64    bool RemoveEntry (TagKey const &key);
65    bool RemoveEntry (uint16_t group, uint16_t element);
66    
67 // Tag
68    DictEntry *GetDictEntryByName(TagName const &name);
69    DictEntry *GetDictEntryByNumber(uint16_t group, uint16_t element);
70
71    EntryNamesList *GetDictEntryNames();
72    EntryNamesByCatMap *GetDictEntryNamesByCategory();
73
74    /// \brief  Returns a ref to the Dicom Dictionary H table (map)
75    /// @return the Dicom Dictionary H table
76    const TagKeyHT & GetEntriesByKey() const { return KeyHt; }
77
78    /// \brief  Returns a ref to the Dicom Dictionary H table (map)
79    /// @return the Dicom Dictionary H table
80    const TagNameHT & GetEntriesByName() const { return NameHt; }
81  
82 private:
83    /// ASCII file holding the Dictionnary
84    std::string Filename;
85
86    /// Access through TagKey (see alternate access with NameHt)
87    TagKeyHT  KeyHt;
88
89    /// Access through TagName (see alternate access with KeyHt)
90    TagNameHT NameHt;
91 };
92 } // end namespace gdcm
93
94 //-----------------------------------------------------------------------------
95 #endif