]> Creatis software - gdcm.git/blob - src/gdcmDictSet.h
* Some classes inherit now from gdcm::RefCounter
[gdcm.git] / src / gdcmDictSet.h
1 /*=========================================================================
2                                                                                 
3   Program:   gdcm
4   Module:    $RCSfile: gdcmDictSet.h,v $
5   Language:  C++
6   Date:      $Date: 2005/10/25 14:52:34 $
7   Version:   $Revision: 1.49 $
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 "gdcmRefCounter.h"
23 #include "gdcmDict.h"
24
25 #include <map>
26 #include <list>
27
28 namespace gdcm 
29 {
30 //-----------------------------------------------------------------------------
31 typedef std::map<DictKey, Dict*> DictSetHT;
32
33 //-----------------------------------------------------------------------------
34 /**
35  * \brief  Container for managing a set of loaded dictionaries (Dict).
36  * \note   Hopefully, sharing dictionaries should avoid
37  * \par    reloading an already loaded dictionary (saving time)
38  * \par    having many in memory representations of the same dictionary
39  *        (saving memory).
40  */
41 class GDCM_EXPORT DictSet : public RefCounter
42 {
43    gdcmTypeMacro(DictSet);
44
45 public:
46    static DictSet *New() {return new DictSet();}
47
48    void Print(std::ostream &os = std::cout, std::string const &indent = "" );
49
50    // Probabely useless !
51    //EntryNamesList *GetPubDictEntryNames();
52    //EntryNamesByCatMap *GetPubDictEntryNamesByCategory();
53
54    Dict *LoadDictFromFile( std::string const &fileName,
55                            DictKey const &name );
56
57    Dict *GetDict( DictKey const &DictName );
58
59    /// \brief   Returns the default reference DICOM V3 public dictionary.
60    Dict* GetDefaultPubDict() { return GetDict(PUB_DICT_NAME); }
61
62    // \ brief   Returns the virtual references DICOM dictionary.
63    // \ warning : not end user intended
64    // Dict *GetVirtualDict() { return &VirtualEntries; }
65
66    Dict *GetFirstDict();
67    Dict *GetNextDict();
68
69    static std::string BuildDictPath();
70
71 protected:
72    DictSet();
73    ~DictSet();
74
75 private:
76    /// Hash table of all dictionaries contained in this DictSet
77    DictSetHT Dicts;
78    /// Iterator to visit the Dictionaries of a given DictSet
79    DictSetHT::iterator ItDictHt;
80
81    /// Directory path to dictionaries
82    std::string DictPath;
83 };
84 } // end namespace gdcm
85
86 //-----------------------------------------------------------------------------
87 #endif