]> Creatis software - gdcm.git/blob - src/gdcmDictSet.h
Zilch.
[gdcm.git] / src / gdcmDictSet.h
1 // gdcmDictSet.h
2 //-----------------------------------------------------------------------------
3 #ifndef GDCMDICTSET_H
4 #define GDCMDICTSET_H
5
6 #include "gdcmDict.h"
7 #include <map>
8 #include <list>
9
10 typedef std::string DictKey;
11 typedef std::map<DictKey, gdcmDict*> DictSetHT;
12
13 //-----------------------------------------------------------------------------
14 /*
15  * \defgroup gdcmDictSet
16  * \brief  Container for managing a set of loaded dictionaries.
17  * \note   Hopefully, sharing dictionaries should avoid
18  * \par    reloading an already loaded dictionary (saving time)
19  * \par    having many in memory representations of the same dictionary
20  *        (saving memory).
21  */
22 class GDCM_EXPORT gdcmDictSet {
23 public:
24         // TODO Swig int LoadDictFromFile(std::string filename);
25    // QUESTION: the following function might not be thread safe !? Maybe
26    //           we need some mutex here, to avoid concurent creation of
27    //           the same dictionary !?!?!
28         // TODO Swig int LoadDictFromName(std::string filename);
29         // TODO Swig int LoadAllDictFromDirectory(std::string DirectoryName);
30         // TODO Swig std::string* GetAllDictNames();
31    gdcmDictSet(void);
32    ~gdcmDictSet(void);
33
34    void Print(std::ostream& os);
35
36    std::list<std::string> *GetPubDictEntryNames(void);
37    std::map<std::string, std::list<std::string> > *
38        GetPubDictEntryNamesByCategory(void);
39
40    gdcmDict *LoadDictFromFile(std::string FileName, DictKey Name);
41
42    gdcmDict *GetDict(DictKey DictName);
43    gdcmDict *GetDefaultPubDict(void);
44
45    gdcmDictEntry *NewVirtualDictEntry(guint16 group, guint16 element,
46                                       std::string vr     = "Unknown",
47                                       std::string fourth = "Unknown",
48                                       std::string name   = "Unknown");
49
50    static std::string BuildDictPath(void);
51
52 protected:
53    bool AppendDict(gdcmDict *NewDict,DictKey Name);
54
55 private:
56    /// Hash table of all dictionaries contained in this gdcmDictSet
57    DictSetHT Dicts;
58    /// Directory path to dictionaries
59    std::string DictPath;
60    /// H table for the on the fly created gdcmDictEntries  
61    std::map<std::string,gdcmDictEntry *> virtualEntry;
62 };
63
64 //-----------------------------------------------------------------------------
65 #endif