File indexing completed on 2024-04-06 12:05:33
0001 #include "DetectorDescription/Parser/interface/FIPConfiguration.h"
0002
0003 #include <cstddef>
0004 #include <iostream>
0005 #include <memory>
0006
0007 #include "DetectorDescription/Parser/interface/DDLParser.h"
0008 #include "FWCore/ParameterSet/interface/FileInPath.h"
0009 #include "xercesc/util/XercesVersion.hpp"
0010
0011 class DDCompactView;
0012
0013 using namespace XERCES_CPP_NAMESPACE;
0014
0015 FIPConfiguration::FIPConfiguration(DDCompactView& cpv) : configHandler_(cpv), cpv_(cpv) {}
0016
0017 FIPConfiguration::~FIPConfiguration(void) {}
0018
0019 const std::vector<std::string>& FIPConfiguration::getFileList(void) const { return files_; }
0020
0021 const std::vector<std::string>& FIPConfiguration::getURLList(void) const { return urls_; }
0022
0023 bool FIPConfiguration::doValidation(void) const { return configHandler_.doValidation(); }
0024
0025 std::string FIPConfiguration::getSchemaLocation(void) const { return configHandler_.getSchemaLocation(); }
0026
0027 void FIPConfiguration::dumpFileList(void) const {
0028 std::cout << "File List:" << std::endl;
0029 std::cout << " number of files=" << files_.size() << std::endl;
0030 for (const auto& file : files_)
0031 std::cout << file << std::endl;
0032 }
0033
0034
0035
0036
0037
0038
0039 int FIPConfiguration::readConfig(const std::string& filename, bool fullPath) {
0040 std::string absoluteFileName(filename);
0041 if (!fullPath) {
0042 edm::FileInPath fp(filename);
0043
0044 absoluteFileName = fp.fullPath();
0045 }
0046
0047
0048
0049 DDLParser ddlp(cpv_);
0050 ddlp.getXMLParser()->setContentHandler(&configHandler_);
0051 ddlp.getXMLParser()->parse(absoluteFileName.c_str());
0052 const std::vector<std::string>& vURLs = configHandler_.getURLs();
0053 const std::vector<std::string>& vFiles = configHandler_.getFileNames();
0054 size_t maxInd = vFiles.size();
0055 size_t ind = 0;
0056
0057 for (; ind < maxInd; ++ind) {
0058 edm::FileInPath fp(vURLs[ind] + "/" + vFiles[ind]);
0059
0060 files_.emplace_back(fp.fullPath());
0061 urls_.emplace_back("");
0062 }
0063
0064
0065
0066
0067
0068 return 0;
0069 }
0070
0071 int FIPConfiguration::readConfig(const std::string& filename) { return readConfig(filename, false); }