gdcmDict.h

Go to the documentation of this file.
00001 /*=========================================================================
00002                                                                                 
00003   Program:   gdcm
00004   Module:    $RCSfile: gdcmDict.h,v $
00005   Language:  C++
00006   Date:      $Date: 2007/08/22 16:14:03 $
00007   Version:   $Revision: 1.51 $
00008                                                                                 
00009   Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
00010   l'Image). All rights reserved. See Doc/License.txt or
00011   http://www.creatis.insa-lyon.fr/Public/Gdcm/License.html for details.
00012                                                                                 
00013      This software is distributed WITHOUT ANY WARRANTY; without even
00014      the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
00015      PURPOSE.  See the above copyright notices for more information.
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> // for ifstream
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 // Print
00060    void Print(std::ostream &os = std::cout, std::string const &indent = "");
00061 
00062 // Entries
00063    bool AddEntry(DictEntry *newEntry);
00064   // bool ReplaceEntry(DictEntry *newEntry); // useless ?
00065    bool RemoveEntry (TagKey const &key);
00066    bool RemoveEntry (uint16_t group, uint16_t elem);
00067    void ClearEntry();
00068    
00069 // Tag
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 } // end namespace gdcm
00093 
00094 //-----------------------------------------------------------------------------
00095 #endif

Generated on Fri Aug 24 12:53:13 2007 for gdcm by  doxygen 1.4.6