X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=blobdiff_plain;f=src%2FgdcmDict.cxx;h=9c3235c78aecf84bf549034b05653de9058ba1d6;hb=5887c4beef24959af83e43efad0bb86acac9339e;hp=d45b0b26ae313da8efac544b4f80e79006c54326;hpb=1fecdc6dcc36f951de19246bd14ef282b3dec13a;p=gdcm.git diff --git a/src/gdcmDict.cxx b/src/gdcmDict.cxx index d45b0b26..9c3235c7 100644 --- a/src/gdcmDict.cxx +++ b/src/gdcmDict.cxx @@ -3,8 +3,8 @@ Program: gdcm Module: $RCSfile: gdcmDict.cxx,v $ Language: C++ - Date: $Date: 2005/01/07 12:29:17 $ - Version: $Revision: 1.56 $ + Date: $Date: 2005/01/12 15:23:44 $ + Version: $Revision: 1.62 $ Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de l'Image). All rights reserved. See Doc/License.txt or @@ -44,7 +44,7 @@ Dict::Dict(std::string const &filename) std::ifstream from( filename.c_str() ); if( !from ) { - dbg.Verbose(2,"Dict::Dict: can't open dictionary", filename.c_str()); + gdcmVerboseMacro( "Can't open dictionary" << filename.c_str()); // Using default embeded one: FillDefaultDataDict( this ); } @@ -65,8 +65,8 @@ Dict::Dict(std::string const &filename) } Filename = filename; + from.close(); } - from.close(); } /** @@ -89,16 +89,6 @@ Dict::~Dict() void Dict::Print(std::ostream &os) { os << "Dict file name : " << Filename << std::endl; - PrintByKey(os); -} - -/** - * \brief Print all the dictionary entries contained in this dictionary. - * Entries will be sorted by tag i.e. the couple (group, element). - * @param os The output stream to be written to. - */ -void Dict::PrintByKey(std::ostream &os) -{ std::ostringstream s; for (TagKeyHT::iterator tag = KeyHt.begin(); tag != KeyHt.end(); ++tag) @@ -114,6 +104,7 @@ void Dict::PrintByKey(std::ostream &os) os << s.str(); } + //----------------------------------------------------------------------------- // Public /** @@ -128,7 +119,7 @@ bool Dict::AddNewEntry(DictEntry const &newEntry) if(KeyHt.count(key) == 1) { - dbg.Verbose(1, "Dict::AddNewEntry already present", key.c_str()); + gdcmVerboseMacro( "Already present" << key.c_str()); return false; } else @@ -166,14 +157,13 @@ bool Dict::RemoveEntry (TagKey const &key) TagKeyHT::const_iterator it = KeyHt.find(key); if(it != KeyHt.end()) { - const DictEntry& entryToDelete = it->second; KeyHt.erase(key); return true; } else { - dbg.Verbose(1, "Dict::RemoveEntry unfound entry", key.c_str()); + gdcmVerboseMacro( "Unfound entry" << key.c_str()); return false; } } @@ -196,7 +186,7 @@ bool Dict::RemoveEntry (uint16_t group, uint16_t elem) * @param elem element of the entry to be found * @return the corresponding dictionnary entry when existing, NULL otherwise */ -DictEntry *Dict::GetDictEntryByNumber(uint16_t group, uint16_t elem) +DictEntry *Dict::GetDictEntry(uint16_t group, uint16_t elem) { TagKey key = DictEntry::TranslateToKey(group, elem); TagKeyHT::iterator it = KeyHt.find(key);