4 #include <stdlib.h> // For getenv
8 #define PUB_DICT_NAME "DicomV3Dict"
9 #define PUB_DICT_PATH "../Dicts/"
10 #define PUB_DICT_FILENAME "dicomV3.dic"
12 gdcmDictSet::gdcmDictSet(void) {
14 if (! LoadDicomV3Dict())
18 void gdcmDictSet::SetDictPath(void) {
19 const char* EnvPath = (char*)0;
20 EnvPath = getenv("GDCM_DICT_PATH");
21 if (EnvPath && (strlen(EnvPath) != 0)) {
23 if (DictPath[DictPath.length() -1] != '/' )
25 dbg.Verbose(1, "gdcmDictSet::SetDictPath:",
26 "Dictionary path set from environnement");
28 DictPath = PUB_DICT_PATH;
31 int gdcmDictSet::LoadDicomV3Dict(void) {
32 if (dicts.count(PUB_DICT_NAME))
34 return LoadDictFromFile(DictPath + PUB_DICT_FILENAME, PUB_DICT_NAME);
37 int gdcmDictSet::LoadDictFromFile(string FileName, DictKey Name) {
38 gdcmDict *NewDict = new gdcmDict(FileName.c_str());
39 dicts[Name] = NewDict;
40 return 0; //FIXME if this is a dummy return make the method void
43 void gdcmDictSet::Print(ostream& os) {
44 for (DictSetHT::iterator dict = dicts.begin(); dict != dicts.end(); ++dict){
45 os << "Printing dictionary " << dict->first << " \n";
46 dict->second->Print(os);
50 gdcmDict * gdcmDictSet::GetDict(DictKey DictName) {
51 DictSetHT::iterator dict = dicts.find(DictName);
55 gdcmDict * gdcmDictSet::GetDefaultPublicDict() {
56 return GetDict(PUB_DICT_NAME);