CMS 3D CMS Logo

List of all members | Public Member Functions | Private Attributes
FIPConfiguration Class Reference

FIPConfiguration reads in the configuration file for the DDParser. More...

#include <FIPConfiguration.h>

Inheritance diagram for FIPConfiguration:
DDLDocumentProvider

Public Member Functions

bool doValidation () const override
 Return whether Validation should be on or off and where the DDL SchemaLocation is. More...
 
void dumpFileList (void) const override
 Print out the list of files. More...
 
 FIPConfiguration (DDCompactView &cpv)
 
const std::vector< std::string > & getFileList (void) const override
 Return a list of files as a std::vector of strings. More...
 
std::string getSchemaLocation () const override
 Return the designation for where to look for the schema. More...
 
const std::vector< std::string > & getURLList (void) const override
 Return a list of urls as a std::vector of strings. More...
 
int readConfig (const std::string &filename) override
 Read in the configuration file. More...
 
int readConfig (const std::string &filename, bool fullPath)
 Read in the configuration file. More...
 
 ~FIPConfiguration () override
 
- Public Member Functions inherited from DDLDocumentProvider
virtual ~DDLDocumentProvider ()
 

Private Attributes

DDLSAX2ConfigHandler configHandler_
 
DDCompactViewcpv_
 
std::vector< std::string > files_
 
std::vector< std::string > urls_
 

Detailed Description

FIPConfiguration reads in the configuration file for the DDParser.

Author
Michael Case

FIPConfiguration.h - description

begin: Sun Nov 13, 2005 email: case@.nosp@m.ucdh.nosp@m.ep.uc.nosp@m.davi.nosp@m.s.edu

Definition at line 27 of file FIPConfiguration.h.

Constructor & Destructor Documentation

FIPConfiguration::FIPConfiguration ( DDCompactView cpv)

Definition at line 15 of file FIPConfiguration.cc.

15 : configHandler_(cpv), cpv_(cpv) {}
DDLSAX2ConfigHandler configHandler_
DDCompactView & cpv_
FIPConfiguration::~FIPConfiguration ( void  )
override

Definition at line 17 of file FIPConfiguration.cc.

17 {}

Member Function Documentation

bool FIPConfiguration::doValidation ( void  ) const
overridevirtual

Return whether Validation should be on or off and where the DDL SchemaLocation is.

Implements DDLDocumentProvider.

Definition at line 23 of file FIPConfiguration.cc.

References configHandler_, and DDLSAX2ConfigHandler::doValidation().

23 { return configHandler_.doValidation(); }
DDLSAX2ConfigHandler configHandler_
const bool doValidation() const
void FIPConfiguration::dumpFileList ( void  ) const
overridevirtual

Print out the list of files.

Implements DDLDocumentProvider.

Definition at line 27 of file FIPConfiguration.cc.

References gather_cfg::cout, FrontierConditions_GlobalTag_cff::file, and files_.

27  {
28  std::cout << "File List:" << std::endl;
29  std::cout << " number of files=" << files_.size() << std::endl;
30  for (const auto& file : files_)
31  std::cout << file << std::endl;
32 }
std::vector< std::string > files_
const std::vector< std::string > & FIPConfiguration::getFileList ( void  ) const
overridevirtual

Return a list of files as a std::vector of strings.

Implements DDLDocumentProvider.

Definition at line 19 of file FIPConfiguration.cc.

References files_.

19 { return files_; }
std::vector< std::string > files_
std::string FIPConfiguration::getSchemaLocation ( void  ) const
overridevirtual

Return the designation for where to look for the schema.

Implements DDLDocumentProvider.

Definition at line 25 of file FIPConfiguration.cc.

References configHandler_, and DDLSAX2ConfigHandler::getSchemaLocation().

DDLSAX2ConfigHandler configHandler_
const std::string getSchemaLocation() const
const std::vector< std::string > & FIPConfiguration::getURLList ( void  ) const
overridevirtual

Return a list of urls as a std::vector of strings.

This implementation does not provide a meaningful url list.

Implements DDLDocumentProvider.

Definition at line 21 of file FIPConfiguration.cc.

References urls_.

21 { return urls_; }
std::vector< std::string > urls_
int FIPConfiguration::readConfig ( const std::string &  filename)
overridevirtual

Read in the configuration file.

Implements DDLDocumentProvider.

Definition at line 71 of file FIPConfiguration.cc.

Referenced by output(), and testParser().

71 { return readConfig(filename, false); }
int readConfig(const std::string &filename) override
Read in the configuration file.
int FIPConfiguration::readConfig ( const std::string &  filename,
bool  fullPath 
)

Read in the configuration file.

Definition at line 39 of file FIPConfiguration.cc.

References configHandler_, cpv_, files_, personalPlayback::fp, edm::FileInPath::fullPath(), DDLSAX2ConfigHandler::getFileNames(), DDLSAX2ConfigHandler::getURLs(), DDLParser::getXMLParser(), AlCaHLTBitMon_QueryRunRegistry::string, and urls_.

39  {
40  std::string absoluteFileName(filename);
41  if (!fullPath) {
43  // config file
44  absoluteFileName = fp.fullPath();
45  }
46 
47  // Set the parser to use the handler for the configuration file.
48  // This makes sure the Parser is initialized and gets a handle to it.
49  DDLParser ddlp(cpv_);
50  ddlp.getXMLParser()->setContentHandler(&configHandler_);
51  ddlp.getXMLParser()->parse(absoluteFileName.c_str());
52  const std::vector<std::string>& vURLs = configHandler_.getURLs();
53  const std::vector<std::string>& vFiles = configHandler_.getFileNames();
54  size_t maxInd = vFiles.size();
55  size_t ind = 0;
56  // ea. file listed in the config
57  for (; ind < maxInd; ++ind) {
58  edm::FileInPath fp(vURLs[ind] + "/" + vFiles[ind]);
59  // std::cout << "FileInPath says..." << fp.fullPath() << std::endl;
60  files_.emplace_back(fp.fullPath());
61  urls_.emplace_back("");
62  }
63 
64  // std::vector<std::string> fnames = configHandler_.getFileNames();
65  // std::cout << "there are " << fnames.size() << " files." << std::endl;
66  // for (size_t i = 0; i < fnames.size(); ++i)
67  // std::cout << "url=" << configHandler_.getURLs()[i] << " file=" << configHandler_.getFileNames()[i] << std::endl;
68  return 0;
69 }
DDLSAX2ConfigHandler configHandler_
std::vector< std::string > urls_
DDCompactView & cpv_
DDLParser is the main class of Detector Description Language Parser.
Definition: DDLParser.h:63
const std::vector< std::string > & getURLs() const
std::vector< std::string > files_
const std::vector< std::string > & getFileNames() const

Member Data Documentation

DDLSAX2ConfigHandler FIPConfiguration::configHandler_
private

Definition at line 57 of file FIPConfiguration.h.

Referenced by doValidation(), getSchemaLocation(), and readConfig().

DDCompactView& FIPConfiguration::cpv_
private

Definition at line 60 of file FIPConfiguration.h.

Referenced by readConfig().

std::vector<std::string> FIPConfiguration::files_
private

Definition at line 58 of file FIPConfiguration.h.

Referenced by dumpFileList(), getFileList(), and readConfig().

std::vector<std::string> FIPConfiguration::urls_
private

Definition at line 59 of file FIPConfiguration.h.

Referenced by getURLList(), and readConfig().