]> Creatis software - gdcm.git/blob - src/gdcmVR.cxx
* src/*.[h|cxx] : coding style
[gdcm.git] / src / gdcmVR.cxx
1 // gdcmVR.cxx
2 #include <fstream>
3 //-----------------------------------------------------------------------------
4 #include "gdcmVR.h"
5 #include "gdcmUtil.h"
6
7 #ifndef PUB_DICT_PATH
8 #  define PUB_DICT_PATH     "../Dicts/"
9 #endif
10 #define DICT_VR "dicomVR.dic"
11
12 //-----------------------------------------------------------------------------
13 // Constructor / Destructor
14 gdcmVR::gdcmVR(void) {
15    std::string filename=gdcmDictSet::BuildDictPath() + std::string(DICT_VR);
16    std::ifstream from(filename.c_str());
17    dbg.Error(!from, "gdcmVR::gdcmVR: can't open dictionary",filename.c_str());
18
19    char buff[1024];
20    std::string key;
21    std::string name;
22
23    while (!from.eof()) {
24       eatwhite(from);
25       from.getline(buff, 1024, ' ');
26       key = buff;
27       eatwhite(from);
28       from.getline(buff, 1024, ';');
29       name = buff;
30
31       eatwhite(from);
32       from.getline(buff, 1024, '\n');
33
34       if(key!="")
35       {
36          vr[key]=name;
37       }
38    }
39    from.close();
40 }
41
42 gdcmVR::~gdcmVR() {
43    vr.clear();
44 }
45
46 //-----------------------------------------------------------------------------
47 // Print
48
49 //-----------------------------------------------------------------------------
50 // Public
51 int gdcmVR::Count(VRKey key) {
52    return vr.count(key);
53 }
54
55 //-----------------------------------------------------------------------------
56 // Protected
57
58 //-----------------------------------------------------------------------------
59 // Private
60
61 //-----------------------------------------------------------------------------