]> Creatis software - gdcm.git/blob - src/gdcmDictSet.h
ENH: Adding 'gdcm' namespace. Be nice with me this was a ~13000 lines patch. Also...
[gdcm.git] / src / gdcmDictSet.h
1 /*=========================================================================
2                                                                                 
3   Program:   gdcm
4   Module:    $RCSfile: gdcmDictSet.h,v $
5   Language:  C++
6   Date:      $Date: 2004/10/12 04:35:45 $
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 GDCMDICTSET_H
20 #define GDCMDICTSET_H
21
22 #include "gdcmDict.h"
23 #include <map>
24 #include <list>
25 namespace gdcm 
26 {
27
28 typedef std::string DictKey;
29 typedef std::map<DictKey, Dict*> DictSetHT;
30
31 //-----------------------------------------------------------------------------
32 /*
33  * \defgroup DictSet
34  * \brief  Container for managing a set of loaded dictionaries.
35  * \note   Hopefully, sharing dictionaries should avoid
36  * \par    reloading an already loaded dictionary (saving time)
37  * \par    having many in memory representations of the same dictionary
38  *        (saving memory).
39  */
40 class GDCM_EXPORT DictSet
41 {
42 public:
43    DictSet();
44    ~DictSet();
45
46    void Print(std::ostream& os);
47
48    std::list<std::string>* GetPubDictEntryNames();
49    std::map<std::string, std::list<std::string> > *
50        GetPubDictEntryNamesByCategory();
51
52    Dict* LoadDictFromFile( std::string const & fileName,
53                                DictKey const & name );
54
55    Dict* GetDict( DictKey const & DictName );
56
57    /// \brief   Retrieve the default reference DICOM V3 public dictionary.
58    Dict* GetDefaultPubDict() { return GetDict(PUB_DICT_NAME); };
59
60    // \brief   Retrieve the virtual reference DICOM dictionary.
61    // \warning : not end user intended
62    // Dict* GetVirtualDict() { return &VirtualEntry; };
63
64    DictEntry* NewVirtualDictEntry(uint16_t group, uint16_t element,
65                                       std::string vr     = "Unknown",
66                                       std::string fourth = "Unknown",
67                                       std::string name   = "Unknown");
68
69    static std::string BuildDictPath();
70
71 protected:
72    bool AppendDict(Dict *NewDict, DictKey const & name);
73
74 private:
75    /// Hash table of all dictionaries contained in this DictSet
76    DictSetHT Dicts;
77    /// Directory path to dictionaries
78    std::string DictPath;
79    /// H table for the on the fly created DictEntries  
80    TagKeyHT VirtualEntry; 
81 };
82 } // end namespace gdcm
83
84 //-----------------------------------------------------------------------------
85 #endif