00001 #ifndef DDL_SAX2FileHandler_H 00002 #define DDL_SAX2FileHandler_H 00003 00004 // --------------------------------------------------------------------------- 00005 // Includes 00006 // --------------------------------------------------------------------------- 00007 // Parser parts. 00008 #include "DetectorDescription/Parser/interface/DDLSAX2Handler.h" 00009 00010 // DDCore parts 00011 #include "DetectorDescription/Core/interface/DDName.h" 00012 00013 // Xerces dependencies 00014 #include <xercesc/sax2/Attributes.hpp> 00015 00016 #include <string> 00017 #include <vector> 00018 #include <map> 00019 00021 00038 class DDLSAX2FileHandler : public DDLSAX2Handler 00039 { 00040 00041 public: 00042 00043 // ----------------------------------------------------------------------- 00044 // Constructor and Destructor 00045 // ----------------------------------------------------------------------- 00046 00047 DDLSAX2FileHandler(); 00048 ~DDLSAX2FileHandler(); 00049 00050 // ----------------------------------------------------------------------- 00051 // Handlers for the SAX ContentHandler interface 00052 // ----------------------------------------------------------------------- 00053 00054 void startElement(const XMLCh* const uri, const XMLCh* const localname 00055 , const XMLCh* const qname, const Attributes& attrs); 00056 void endElement(const XMLCh* const uri, const XMLCh* const localname 00057 , const XMLCh* const qname); 00058 void characters (const XMLCh *const chars, const unsigned int length); 00059 void comment (const XMLCh *const chars, const unsigned int length ); 00060 00061 virtual std::string extractFileName(std::string fullname); 00062 00063 virtual std::string & parent(); 00064 virtual std::string& self(); 00065 00066 // ----------------------------------------------------------------------- 00067 // Dump information on number and name of elements processed. 00068 // ----------------------------------------------------------------------- 00070 void dumpElementTypeCounter(); 00071 00072 protected: 00074 void createDDConstants() const; 00075 // Map that holds name and number of elements processed. 00076 std::map < std::string, int> elementTypeCounter_; 00077 // std::vector < std::string > names_; 00078 std::map < std::string, std::string* > namesMap_; 00079 std::vector < std::string* > names_; 00080 }; 00081 00082 #endif