-#include "gdcm.h"
-#include "gdcmUtil.h"
-
-#define PUB_DICT_NAME "DicomV3Dict"
-#define PUB_DICT_PATH "../Dicts/"
-#define PUB_DICT_FILENAME "dicomV3.dic"
-
-gdcmDictSet::gdcmDictSet(void) {
- SetDictPath();
- if (! LoadDicomV3Dict())
- return;
-}
-
-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;
+
+//-----------------------------------------------------------------------------
+// Constructor / Destructor
+/**
+ * \ingroup gdcmDictSet
+ * \brief The Dictionnary Set obtained with this constructor simply
+ * contains the Default Public dictionnary.
+ */
+gdcmDictSet::gdcmDictSet(void)
+{
+ DictPath = BuildDictPath();
+ std::string PubDictFile(DictPath);
+ PubDictFile += PUB_DICT_FILENAME; /// MEMORY LEAK std::string::operator+=
+ Dicts[PUB_DICT_NAME] = new gdcmDict(PubDictFile);
+}
+
+/**
+ * \ingroup gdcmDictSet
+ * \brief Destructor
+ */
+gdcmDictSet::~gdcmDictSet()
+{
+ // Remove dictionnaries
+ for (DictSetHT::iterator tag = Dicts.begin(); tag != Dicts.end(); ++tag)
+ {
+ gdcmDict *EntryToDelete = tag->second;
+ if ( EntryToDelete )
+ delete EntryToDelete;
+ tag->second=NULL;
+ }
+ Dicts.clear();
+
+ // Remove virtual dictionnary entries
+ std::map<std::string,gdcmDictEntry *>::iterator it;
+ for(it=virtualEntry.begin(); it!=virtualEntry.end(); ++it)
+ {
+ gdcmDictEntry *Entry = it->second;
+ if ( Entry )
+ delete Entry;
+ it->second=NULL;
+ }
+}
+
+//-----------------------------------------------------------------------------
+// Print
+/**
+ * \ingroup gdcmDictSet
+ * \brief Print, in an informal fashion, the list of all the dictionaries
+ * contained is this gdcmDictSet, along with their respective content.
+ * @param os Output stream used for printing.
+ */
+void gdcmDictSet::Print(std::ostream& os)
+{
+ for (DictSetHT::iterator dict = Dicts.begin(); dict != Dicts.end(); ++dict)
+ {
+ os << "Printing dictionary " << dict->first << std::endl;
+ dict->second->Print(os);
+ }
+}
+
+//-----------------------------------------------------------------------------
+// Public
+/**
+ * \ingroup gdcmDictSet
+ * \brief Consider all the entries of the public dicom dictionnary.
+ * Build all list of all the tag names of all those entries.
+ * \sa gdcmDictSet::GetPubDictTagNamesByCategory
+ * @return A list of all entries of the public dicom dictionnary.
+ */
+std::list<std::string> *gdcmDictSet::GetPubDictEntryNames(void)
+{
+ return(GetDefaultPubDict()->GetDictEntryNames());