gdcmTableReader.h

Go to the documentation of this file.
00001 /*=========================================================================
00002 
00003   Program: GDCM (Grassroots DICOM). A DICOM library
00004   Module:  $URL$
00005 
00006   Copyright (c) 2006-2010 Mathieu Malaterre
00007   All rights reserved.
00008   See Copyright.txt or http://gdcm.sourceforge.net/Copyright.html for details.
00009 
00010      This software is distributed WITHOUT ANY WARRANTY; without even
00011      the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
00012      PURPOSE.  See the above copyright notice for more information.
00013 
00014 =========================================================================*/
00015 #ifndef GDCMTABLEREADER_H
00016 #define GDCMTABLEREADER_H
00017 
00018 #include "gdcmTypes.h"
00019 #include "gdcmDefs.h"
00020 //#include "gdcmModule.h"
00021 //#include "gdcmIOD.h"
00022 //#include "gdcmIODs.h"
00023 //#include "gdcmModules.h"
00024 
00025 #include <string>
00026 #include <vector>
00027 #include <map>
00028 
00029 namespace gdcm
00030 {
00035 class GDCM_EXPORT TableReader
00036 {
00037 public:
00038   TableReader(Defs &defs):CurrentDefs(defs),ParsingModule(false),ParsingModuleEntry(false),
00039   ParsingModuleEntryDescription(false),
00040   ParsingMacro(false),
00041   ParsingMacroEntry(false),
00042   ParsingMacroEntryDescription(false),
00043   ParsingIOD(false),
00044   ParsingIODEntry(false),
00045   Description() {}
00046   virtual ~TableReader() {}
00047 
00048   // Set/Get filename
00049   void SetFilename(const char *filename) { Filename = filename; }
00050   const char *GetFilename() { return Filename.c_str(); }
00051 
00052   int Read();
00053 
00054 //protected:
00055   // You need to override those function in your subclasses:
00056   virtual void StartElement(const char *name, const char **atts);
00057   virtual void EndElement(const char *name);
00058   virtual void CharacterDataHandler(const char *data, int length);
00059 
00060 void HandleModuleEntry(const char **atts);
00061 void HandleModule(const char **atts);
00062 void HandleModuleEntryDescription(const char **atts);
00063 void HandleMacroEntry(const char **atts);
00064 void HandleMacro(const char **atts);
00065 void HandleMacroEntryDescription(const char **atts);
00066 void HandleModuleInclude(const char **atts);
00067 void HandleIODEntry(const char **atts);
00068 void HandleIOD(const char **atts);
00069 
00070   //const Modules & GetModules() const { return CurrentModules; }
00071   //const Macros & GetMacros() const { return CurrentMacros; }
00072   //const IODs & GetIODs() const { return CurrentIODs; }
00073   const Defs & GetDefs() const { return CurrentDefs; }
00074 
00075 private:
00076   std::string Filename;
00077   Defs &CurrentDefs;
00078   //Macros CurrentMacros;
00079   //Modules CurrentModules;
00080   //IODs CurrentIODs;
00081   Macro CurrentMacro;
00082   Module CurrentModule;
00083   IOD CurrentIOD;
00084   MacroEntry CurrentMacroEntry;
00085   ModuleEntry CurrentModuleEntry;
00086   IODEntry CurrentIODEntry;
00087   std::string CurrentModuleName;
00088   std::string CurrentModuleRef;
00089   std::string CurrentMacroRef;
00090   bool ParsingModule;
00091   bool ParsingModuleEntry;
00092   bool ParsingModuleEntryDescription;
00093   bool ParsingMacro;
00094   bool ParsingMacroEntry;
00095   bool ParsingMacroEntryDescription;
00096   bool ParsingIOD;
00097   bool ParsingIODEntry;
00098   Tag CurrentTag;
00099   std::string Description;
00100 };
00101 
00102 } // end namespace gdcm
00103 
00104 #endif //GDCMTABLEREADER_H

Generated on Sat Dec 4 2010 08:58:47 for GDCM by doxygen 1.7.2
SourceForge.net Logo