CMS 3D CMS Logo

DDLConfiguration.cc

Go to the documentation of this file.
00001 /***************************************************************************
00002                           DDLConfiguration.cc  -  description
00003                              -------------------
00004     begin                : Mon Feb 24 2003
00005     email                : case@ucdhep.ucdavis.edu
00006  ***************************************************************************/
00007 
00008 /***************************************************************************
00009  *                                                                         *
00010  *           DDLConfiguration sub-component of DDD                                *
00011  *                                                                         *
00012  ***************************************************************************/
00013 
00014 //--------------------------------------------------------------------------
00015 //  Includes
00016 //--------------------------------------------------------------------------
00017 // Parser parts
00018 #include "DetectorDescription/Parser/interface/DDLConfiguration.h"
00019 #include "DetectorDescription/Parser/interface/DDLParser.h"
00020 #include "DetectorDescription/Parser/interface/DDLSAX2ConfigHandler.h"
00021 #include "StrX.h"
00022 #include "DetectorDescription/Base/interface/DDdebug.h"
00023 #include "DetectorDescription/Base/interface/DDException.h"
00024 
00025 
00026 // Xerces dependencies
00027 #include <xercesc/util/PlatformUtils.hpp>
00028 #include <xercesc/sax2/SAX2XMLReader.hpp>
00029 #include <xercesc/sax2/XMLReaderFactory.hpp>
00030 #include <xercesc/sax/SAXException.hpp>
00031 
00032 #include <string>
00033 #include <iostream>
00034 #include <map>
00035 
00036 using namespace xercesc_2_7;
00037 
00038 
00039 
00040 //--------------------------------------------------------------------------
00041 //  DDLConfiguration:  Default constructor and destructor.
00042 //--------------------------------------------------------------------------
00043 DDLConfiguration::~DDLConfiguration()
00044 {
00045   //  parser_->getXMLParser()->setContentHandler(0);  
00046 }
00047 
00048 DDLConfiguration::DDLConfiguration() : configHandler_()
00049 { 
00050   //  parser_ = DDLParser::instance();
00051   //  std::cout << "Making a DDLConfiguration with configHandler_ at " << &configHandler_ << std::endl;
00052 }
00053 
00054 DDLConfiguration::DDLConfiguration(DDLParser * ip) : configHandler_()
00055 { 
00056   //  parser_ = ip; do NOTHING with the incomming pointer for now...
00057 }
00058 
00059 const std::vector<std::string>&  DDLConfiguration::getFileList(void) const
00060 {
00061   return configHandler_.getFileNames();
00062 }
00063 
00064 const std::vector<std::string>&  DDLConfiguration::getURLList(void) const
00065 {
00066   return configHandler_.getURLs();
00067 }
00068 
00069 bool DDLConfiguration::doValidation() const { return configHandler_.doValidation(); }
00070 
00071 std::string DDLConfiguration::getSchemaLocation() const { return configHandler_.getSchemaLocation(); }
00072 
00073 void DDLConfiguration::dumpFileList(void) const {
00074   std::cout << "File List:" << std::endl;
00075   std::vector<std::string> vst = getFileList();  // why do I need to do this?
00076   std::cout << "  number of files=" << vst.size() << std::endl;
00077   for (std::vector<std::string>::const_iterator it = vst.begin(); it != vst.end(); ++it)
00078     std::cout << *it << std::endl;
00079 }
00080 
00081 //-----------------------------------------------------------------------
00082 //  Here the Xerces parser is used to process the content of the 
00083 //  configuration file.
00084 //-----------------------------------------------------------------------
00085 int DDLConfiguration::readConfig(const std::string& filename)
00086 {
00087   DCOUT('P', "DetectorDescription/Parser/interface/DDLConfiguration::ReadConfig(): started");
00088 
00089   //  configFileName_ = filename;
00090 
00091   // Set the parser to use the handler for the configuration file.
00092   // This makes sure the Parser is initialized and gets a handle to it.
00093   // Set these to the flags for the configuration file.
00094 
00095   parser_->setContentHandler(&configHandler_);
00096   parser_->parse(filename.c_str());
00097 
00098   return 0;
00099 }

Generated on Tue Jun 9 17:32:23 2009 for CMSSW by  doxygen 1.5.4