GDCM 2.2.1

- Main Page
- Related Pages
- Namespaces
- Classes
- Files
- Examples

- File List
- File Members

gdcmTableReader.h
Go to the documentation of this file.
1 /*=========================================================================
2
3 Program: GDCM (Grassroots DICOM). A DICOM library
4
5 Copyright (c) 2006-2011 Mathieu Malaterre
6 All rights reserved.
7 See Copyright.txt or http://gdcm.sourceforge.net/Copyright.html for details.
8
9 This software is distributed WITHOUT ANY WARRANTY; without even
10 the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
11 PURPOSE. See the above copyright notice for more information.
12
13 =========================================================================*/
14 #ifndef GDCMTABLEREADER_H
15 #define GDCMTABLEREADER_H
16
17 #include "gdcmTypes.h"
18 #include "gdcmDefs.h"
19 //#include "gdcmModule.h"
20 //#include "gdcmIOD.h"
21 //#include "gdcmIODs.h"
22 //#include "gdcmModules.h"
23
24 #include <string>
25 #include <vector>
26 #include <map>
27
28 namespace gdcm
29 {
34 class GDCM_EXPORT TableReader
35 {
36 public:
37 TableReader(Defs &defs):CurrentDefs(defs),ParsingModule(false),ParsingModuleEntry(false),
38 ParsingModuleEntryDescription(false),
39 ParsingMacro(false),
40 ParsingMacroEntry(false),
41 ParsingMacroEntryDescription(false),
42 ParsingIOD(false),
43 ParsingIODEntry(false),
44 Description() {}
45 virtual ~TableReader() {}
46
47 // Set/Get filename
48 void SetFilename(const char *filename) { Filename = filename; }
49 const char *GetFilename() { return Filename.c_str(); }
50
51 int Read();
52
53 //protected:
54 // You need to override those function in your subclasses:
55 virtual void StartElement(const char *name, const char **atts);
56 virtual void EndElement(const char *name);
57 virtual void CharacterDataHandler(const char *data, int length);
58
59 void HandleModuleEntry(const char **atts);
60 void HandleModule(const char **atts);
61 void HandleModuleEntryDescription(const char **atts);
62 void HandleMacroEntry(const char **atts);
63 void HandleMacro(const char **atts);
64 void HandleMacroEntryDescription(const char **atts);
65 void HandleModuleInclude(const char **atts);
66 void HandleIODEntry(const char **atts);
67 void HandleIOD(const char **atts);
68
69 //const Modules & GetModules() const { return CurrentModules; }
70 //const Macros & GetMacros() const { return CurrentMacros; }
71 //const IODs & GetIODs() const { return CurrentIODs; }
72 const Defs & GetDefs() const { return CurrentDefs; }
73
74 private:
75 std::string Filename;
76 Defs &CurrentDefs;
77 //Macros CurrentMacros;
78 //Modules CurrentModules;
79 //IODs CurrentIODs;
80 Macro CurrentMacro;
81 Module CurrentModule;
82 IOD CurrentIOD;
83 MacroEntry CurrentMacroEntry;
84 ModuleEntry CurrentModuleEntry;
85 IODEntry CurrentIODEntry;
86 std::string CurrentModuleName;
87 std::string CurrentModuleRef;
88 std::string CurrentMacroRef;
89 bool ParsingModule;
90 bool ParsingModuleEntry;
91 bool ParsingModuleEntryDescription;
92 bool ParsingMacro;
93 bool ParsingMacroEntry;
94 bool ParsingMacroEntryDescription;
95 bool ParsingIOD;
96 bool ParsingIODEntry;
97 Tag CurrentTag;
98 std::string Description;
99 };
100
101 } // end namespace gdcm
102
103 #endif //GDCMTABLEREADER_H