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))
22 DictPath = PUB_DICT_PATH;
25 int gdcmDictSet::LoadDicomV3Dict(void) {
26 if (dicts.count(PUB_DICT_NAME))
28 return LoadDictFromFile(DictPath + PUB_DICT_FILENAME, PUB_DICT_NAME);
31 int gdcmDictSet::LoadDictFromFile(string FileName, DictKey Name) {
32 gdcmDict *NewDict = new gdcmDict(FileName.c_str());
33 dicts[Name] = NewDict;
37 void gdcmDictSet::Print(ostream& os) {
38 for (DictSetHT::iterator dict = dicts.begin(); dict != dicts.end(); ++dict){
39 os << "Printing dictionary " << dict->first << " \n";
40 dict->second->Print(os);
44 gdcmDict * gdcmDictSet::GetDict(DictKey DictName) {
45 DictSetHT::iterator dict = dicts.find(DictName);
49 gdcmDict * gdcmDictSet::GetDefaultPublicDict() {
50 return GetDict(PUB_DICT_NAME);