-void gdcmDictSet::SetDictPath(void) {
- const char* EnvPath = (char*)0;
- EnvPath = getenv("GDCM_DICT_PATH");
- if (EnvPath && (strlen(EnvPath) != 0)) {
- DictPath = EnvPath;
- if (DictPath[DictPath.length() -1] != '/' )
- DictPath += '/';
- dbg.Verbose(1, "gdcmDictSet::SetDictPath:",
- "Dictionary path set from environnement");
- } else
- DictPath = PUB_DICT_PATH;
+/**
+ * \brief Destructor
+ */
+DictSet::~DictSet()
+{
+ // Remove dictionaries
+ for (DictSetHT::iterator tag = Dicts.begin(); tag != Dicts.end(); ++tag)
+ {
+ Dict *entryToDelete = tag->second;
+ if ( entryToDelete )
+ {
+ delete entryToDelete;
+ }
+ tag->second = NULL;
+ }
+ Dicts.clear();
+
+ // Remove virtual dictionary entries
+ VirtualEntry.clear();
+}
+
+//-----------------------------------------------------------------------------
+// Public
+/**
+ * \brief Loads a dictionary from a specified file, and add it
+ * to already the existing ones contained in this DictSet.
+ * @param filename Absolute or relative filename containing the
+ * dictionary to load.
+ * @param name Symbolic name that be used as identifier of the newly
+ * created dictionary.
+ */
+Dict *DictSet::LoadDictFromFile(std::string const &filename,
+ DictKey const &name)
+{
+ Dict *newDict = new Dict(filename);
+ AppendDict(newDict, name);
+
+ return newDict;
+}
+
+/**
+ * \brief Retrieve the specified dictionary (when existing) from this
+ * DictSet.
+ * @param dictName The symbolic name of the searched dictionary.
+ * \result The retrieved dictionary.
+ */
+Dict *DictSet::GetDict(DictKey const &dictName)
+{
+ DictSetHT::iterator dict = Dicts.find(dictName);
+ if(dict != Dicts.end())
+ {
+ return dict->second;
+ }
+ return NULL;
+}
+
+/**
+ * \brief Create a DictEntry which will be referenced
+ * in no dictionary
+ * @return virtual entry
+ */
+DictEntry *DictSet::NewVirtualDictEntry( uint16_t group,
+ uint16_t element,
+ TagName vr,
+ TagName vm,
+ TagName name)
+{
+ DictEntry *entry;
+ const std::string tag = DictEntry::TranslateToKey(group,element)
+ + "#" + vr + "#" + vm + "#" + name;
+ TagKeyHT::iterator it;
+
+ it = VirtualEntry.find(tag);
+ if(it != VirtualEntry.end())
+ {
+ entry = &(it->second);
+ }
+ else
+ {
+ DictEntry ent(group, element, vr, vm, name);
+ VirtualEntry.insert(
+ std::map<TagKey, DictEntry>::value_type
+ (tag, ent));
+ entry = &(VirtualEntry.find(tag)->second);
+ }
+
+ return entry;