2 #include <stdlib.h> // For getenv
6 #define PUB_DICT_NAME "DicomV3Dict"
7 #define PUB_DICT_PATH "../Dicts/"
8 #define PUB_DICT_FILENAME "dicomV3.dic"
10 gdcmDictSet::gdcmDictSet(void) {
12 if (! LoadDicomV3Dict())
16 void gdcmDictSet::SetDictPath(void) {
17 const char* EnvPath = (char*)0;
18 EnvPath = getenv("GDCM_DICT_PATH");
19 if (EnvPath && (strlen(EnvPath) != 0)) {
21 if (DictPath[DictPath.length() -1] != '/' )
23 dbg.Verbose(1, "gdcmDictSet::SetDictPath:",
24 "Dictionary path set from environnement");
26 DictPath = PUB_DICT_PATH;
29 int gdcmDictSet::LoadDicomV3Dict(void) {
30 if (dicts.count(PUB_DICT_NAME))
32 return LoadDictFromFile(DictPath + PUB_DICT_FILENAME, PUB_DICT_NAME);
35 int gdcmDictSet::LoadDictFromFile(string FileName, DictKey Name) {
36 gdcmDict *NewDict = new gdcmDict(FileName.c_str());
37 dicts[Name] = NewDict;
38 return 0; //FIXME if this is a dummy return make the method void
41 void gdcmDictSet::Print(ostream& os) {
42 for (DictSetHT::iterator dict = dicts.begin(); dict != dicts.end(); ++dict){
43 os << "Printing dictionary " << dict->first << " \n";
44 dict->second->Print(os);
48 gdcmDict * gdcmDictSet::GetDict(DictKey DictName) {
49 DictSetHT::iterator dict = dicts.find(DictName);
53 gdcmDict * gdcmDictSet::GetDefaultPublicDict() {
54 return GetDict(PUB_DICT_NAME);