- * \ingroup gdcmDict
- * \brief Construtor
- * @param FileName from which to build the dictionary.
- */
-gdcmDict::gdcmDict(string & FileName) {
- std::ifstream from(FileName.c_str());
- dbg.Error(!from, "gdcmDict::gdcmDict: can't open dictionary",
- FileName.c_str());
- guint16 group, element;
- // CLEANME : use defines for all those constants
- char buff[1024];
- TagKey key;
- TagName vr;
- TagName fourth;
- TagName name;
- while (!from.eof()) {
- from >> hex >> group >> element;
- eatwhite(from);
- from.getline(buff, 256, ' ');
- vr = buff;
- eatwhite(from);
- from.getline(buff, 256, ' ');
- fourth = buff;
- from.getline(buff, 256, '\n');
- name = buff;
- gdcmDictEntry * newEntry = new gdcmDictEntry(group, element,
- vr, fourth, name);
- // FIXME: use AddNewEntry
- NameHt[name] = newEntry;
- KeyHt[gdcmDictEntry::TranslateToKey(group, element)] = newEntry;
- }
- from.close();
-}
-
-gdcmDict::~gdcmDict() {
- for (TagKeyHT::iterator tag = KeyHt.begin(); tag != KeyHt.end(); ++tag) {
- gdcmDictEntry* EntryToDelete = tag->second;
- if ( EntryToDelete )
- delete EntryToDelete;
+ * \brief Constructor
+ */
+Dict::Dict( )
+{
+ Filename="";
+}
+
+/**
+ * \brief Constructor
+ * @param filename from which to build the dictionary.
+ */
+Dict::Dict(std::string const &filename)
+{
+
+ std::ifstream from( filename.c_str() );
+ if ( !from )
+ {
+ gdcmWarningMacro( "Can't open dictionary" << filename.c_str());
+ // Using default embeded one:
+ FillDefaultDataDict( this );
+ }
+ else
+ {
+ DoTheLoadingJob(from);
+ Filename = filename;