]> Creatis software - gdcm.git/blob - src/gdcmDictSet.h
4ae5d721589c0ef5be5dfcf754e4068e3ef3a7ba
[gdcm.git] / src / gdcmDictSet.h
1 /*=========================================================================
2                                                                                 
3   Program:   gdcm
4   Module:    $RCSfile: gdcmDictSet.h,v $
5   Language:  C++
6   Date:      $Date: 2005/10/23 15:32:31 $
7   Version:   $Revision: 1.48 $
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 "gdcmBase.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 Base
42 {
43 public:
44    DictSet();
45    ~DictSet();
46
47    void Print(std::ostream &os = std::cout, std::string const &indent = "" );
48
49    // Probabely useless !
50    //EntryNamesList *GetPubDictEntryNames();
51    //EntryNamesByCatMap *GetPubDictEntryNamesByCategory();
52
53    Dict *LoadDictFromFile( std::string const &fileName,
54                            DictKey const &name );
55
56    Dict *GetDict( DictKey const &DictName );
57
58    /// \brief   Returns the default reference DICOM V3 public dictionary.
59    Dict* GetDefaultPubDict() { return GetDict(PUB_DICT_NAME); }
60
61    // \ brief   Returns the virtual references DICOM dictionary.
62    // \ warning : not end user intended
63    // Dict *GetVirtualDict() { return &VirtualEntries; }
64
65    Dict *GetFirstDict();
66    Dict *GetNextDict();
67
68    static std::string BuildDictPath();
69
70 protected:
71    bool AppendDict(Dict *NewDict, DictKey const &name);
72
73 private:
74    /// Hash table of all dictionaries contained in this DictSet
75    DictSetHT Dicts;
76    /// Iterator to visit the Dictionaries of a given DictSet
77    DictSetHT::iterator ItDictHt;
78
79    /// Directory path to dictionaries
80    std::string DictPath;
81 };
82 } // end namespace gdcm
83
84 //-----------------------------------------------------------------------------
85 #endif