# 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-2009 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 HandleIODEntry(const char **atts);
    00067 void HandleIOD(const char **atts);
    00068
    00069   //const Modules & GetModules() const { return CurrentModules; }
    00070   //const Macros & GetMacros() const { return CurrentMacros; }
    00071   //const IODs & GetIODs() const { return CurrentIODs; }
    00072   const Defs & GetDefs() const { return CurrentDefs; }
    00073
    00074 private:
    00075   std::string Filename;
    00076   Defs &CurrentDefs;
    00077   //Macros CurrentMacros;
    00078   //Modules CurrentModules;
    00079   //IODs CurrentIODs;
    00080   Macro CurrentMacro;
    00081   Module CurrentModule;
    00082   IOD CurrentIOD;
    00083   MacroEntry CurrentMacroEntry;
    00084   ModuleEntry CurrentModuleEntry;
    00085   IODEntry CurrentIODEntry;
    00086   std::string CurrentModuleName;
    00087   std::string CurrentModuleRef;
    00088   bool ParsingModule;
    00089   bool ParsingModuleEntry;
    00090   bool ParsingModuleEntryDescription;
    00091   bool ParsingMacro;
    00092   bool ParsingMacroEntry;
    00093   bool ParsingMacroEntryDescription;
    00094   bool ParsingIOD;
    00095   bool ParsingIODEntry;
    00096   Tag CurrentTag;
    00097   std::string Description;
    00098 };
    00099
    00100 } // end namespace gdcm
    00101
    00102 #endif //__gdcmTableReader_h