CMS 3D CMS Logo

/data/refman/pasoursint/CMSSW_5_3_0/src/DetectorDescription/Parser/interface/DDLSAX2FileHandler.h

Go to the documentation of this file.
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 #include "DetectorDescription/Parser/interface/DDLElementRegistry.h"
00010 
00011 // DDCore parts
00012 #include "DetectorDescription/Core/interface/DDName.h"
00013 #include "DetectorDescription/Core/interface/DDCompactView.h"
00014 
00015 // Xerces dependencies
00016 #include <xercesc/sax2/Attributes.hpp>
00017 
00018 #include <string>
00019 #include <vector>
00020 #include <map>
00021 
00023 
00040 class DDLSAX2FileHandler : public DDLSAX2Handler 
00041 {
00042   
00043  public:
00044   
00045   // -----------------------------------------------------------------------
00046   //  Constructor and Destructor
00047   // -----------------------------------------------------------------------
00048   
00049   //  DDLSAX2FileHandler();
00050   DDLSAX2FileHandler( DDCompactView& cpv );
00051   ~DDLSAX2FileHandler();
00052 
00053   void init() ;
00054   //  void setStorage( DDCompactView & cpv );
00055 
00056   // -----------------------------------------------------------------------
00057   //  Handlers for the SAX ContentHandler interface
00058   // -----------------------------------------------------------------------
00059   
00060   void startElement(const XMLCh* const uri, const XMLCh* const localname
00061                     , const XMLCh* const qname, const Attributes& attrs);
00062   void endElement(const XMLCh* const uri, const XMLCh* const localname
00063                   , const XMLCh* const qname);
00064   void characters (const XMLCh *const chars, const unsigned int length);
00065   void comment (const XMLCh *const chars, const unsigned int length );
00066   
00067   //  virtual std::string extractFileName(std::string fullname);
00068   
00069   virtual const std::string& parent() const;
00070   virtual const std::string& self() const;
00071   
00072   // -----------------------------------------------------------------------
00073   //  Dump information on number and name of elements processed.
00074   // -----------------------------------------------------------------------
00076   void dumpElementTypeCounter();
00077 
00078  protected:
00080   void createDDConstants() const; 
00081   //  Map that holds name and number of elements processed.
00082   std::map < std::string, int> elementTypeCounter_;
00083   std::vector<std::string> namesMap_;
00084   std::vector < size_t > names_;
00085   DDCompactView& cpv_;
00086   DDLElementRegistry xmlelems_;
00087 };
00088 
00089 #endif