00001 
00002 
00003 
00004 
00005 
00006 
00007 
00008 
00009 
00010 
00011 
00012 
00013 
00014 
00015 
00016 
00017 
00018 
00019 #ifndef _GDCMDICT_H_
00020 #define _GDCMDICT_H_
00021 
00022 #include "gdcmRefCounter.h"
00023 #include "gdcmDictEntry.h"
00024 
00025 #include <iostream>
00026 #include <fstream> 
00027 #include <list>
00028 #include <map>
00029 
00030 namespace GDCM_NAME_SPACE 
00031 {
00032 
00033 
00034 typedef std::string DictKey;
00035 typedef std::map<TagKey, DictEntry *>  TagKeyHT;
00036 
00037 
00047 class GDCM_EXPORT Dict : public RefCounter
00048 {
00049    gdcmTypeMacro(Dict);
00050 
00051 public:
00053    static Dict *New() {return new Dict();}
00055    static Dict *New(std::string const &filename) {return new Dict(filename);}
00056 
00057    bool AddDict(std::string const &filename);
00058    bool RemoveDict(std::string const &filename);
00059 
00060    void Print(std::ostream &os = std::cout, std::string const &indent = "");
00061 
00062 
00063    bool AddEntry(DictEntry *newEntry);
00064   
00065    bool RemoveEntry (TagKey const &key);
00066    bool RemoveEntry (uint16_t group, uint16_t elem);
00067    void ClearEntry();
00068    
00069 
00070    DictEntry *GetEntry(uint16_t group, uint16_t elem);
00071    DictEntry *GetEntry(TagKey const &key);
00072 
00073    DictEntry *GetFirstEntry();
00074    DictEntry *GetNextEntry();
00075 
00076 protected:
00077    Dict();
00078    Dict(std::string const &filename);
00079    ~Dict();
00080 
00081 private:
00082    void DoTheLoadingJob(std::ifstream &ifs);
00083 
00085    std::string Filename;
00086 
00088    TagKeyHT KeyHt;
00090    TagKeyHT::iterator ItKeyHt;
00091 };
00092 } 
00093 
00094 
00095 #endif