CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
FIPConfiguration.cc
Go to the documentation of this file.
1 
2 /***************************************************************************
3  FIPConfiguration.cc - description
4  -------------------
5  begin : Sun Nov 13 2005
6  email : case@ucdhep.ucdavis.edu
7  ***************************************************************************/
8 
9 /***************************************************************************
10  * *
11  * FIPConfiguration sub-component of DDD *
12  * *
13  ***************************************************************************/
14 
18 
20 
21 #include <iostream>
22 
23 using namespace XERCES_CPP_NAMESPACE;
24 
26  : configHandler_( cpv ),
27  cpv_( cpv )
28 {
29  // parser_ = DDLParser::instance();
30  // std::cout << "Making a FIPConfiguration with configHandler_ at " << &configHandler_ << std::endl;
31 }
32 
34 {
35  // parser_->getXMLParser()->setContentHandler(0);
36 }
37 
38 const std::vector<std::string>&
40 {
41  return files_;
42 }
43 
44 const std::vector<std::string>&
46 {
47  return urls_;
48 }
49 
50 bool
52 {
54 }
55 
58 {
60 }
61 
62 void
64 {
65  std::cout << "File List:" << std::endl;
66  std::cout << " number of files=" << files_.size() << std::endl;
67  for (std::vector<std::string>::const_iterator it = files_.begin(); it != files_.end(); ++it)
68  std::cout << *it << std::endl;
69 }
70 
71 //-----------------------------------------------------------------------
72 // Here the Xerces parser is used to process the content of the
73 // configuration file.
74 //-----------------------------------------------------------------------
75 
76 int
78 {
79  std::string absoluteFileName (filename);
80  if (!fullPath) {
81  edm::FileInPath fp(filename);
82  // config file
83  absoluteFileName = fp.fullPath();
84  }
85 
86  DCOUT('P', "FIPConfiguration::ReadConfig(): started");
87 
88  // Set the parser to use the handler for the configuration file.
89  // This makes sure the Parser is initialized and gets a handle to it.
90  DDLParser ddlp(cpv_);
91  ddlp.getXMLParser()->setContentHandler(&configHandler_);
92  ddlp.getXMLParser()->parse(absoluteFileName.c_str());
93  const std::vector<std::string>& vURLs = configHandler_.getURLs();
94  const std::vector<std::string>& vFiles = configHandler_.getFileNames();
95  size_t maxInd = vFiles.size();
96  size_t ind = 0;
97  // ea. file listed in the config
98  for(; ind < maxInd ; ++ind)
99  {
100  edm::FileInPath fp(vURLs[ind] + "/" + vFiles[ind]);
101  // std::cout << "FileInPath says..." << fp.fullPath() << std::endl;
102  files_.push_back(fp.fullPath());
103  urls_.push_back("");
104  }
105 
106  // std::vector<std::string> fnames = configHandler_.getFileNames();
107  // std::cout << "there are " << fnames.size() << " files." << std::endl;
108  // for (size_t i = 0; i < fnames.size(); ++i)
109  // std::cout << "url=" << configHandler_.getURLs()[i] << " file=" << configHandler_.getFileNames()[i] << std::endl;
110  return 0;
111 }
112 
113 int
115 {
116  return readConfig( filename, false );
117 }
DDLSAX2ConfigHandler configHandler_
std::vector< std::string > urls_
virtual void dumpFileList(void) const
Print out the list of files.
const std::string getSchemaLocation() const
FIPConfiguration(DDCompactView &cpv)
type of data representation of DDCompactView
Definition: DDCompactView.h:76
virtual const std::vector< std::string > & getFileList(void) const
Return a list of files as a std::vector of strings.
virtual ~FIPConfiguration()
DDCompactView & cpv_
virtual const std::vector< std::string > & getURLList(void) const
Return a list of urls as a std::vector of strings.
virtual bool doValidation() const
Return whether Validation should be on or off and where the DDL SchemaLocation is.
DDLParser is the main class of Detector Description Language Parser.
Definition: DDLParser.h:64
const std::vector< std::string > & getURLs() const
SAX2XMLReader * getXMLParser()
Get the SAX2Parser from the DDLParser. USE WITH CAUTION. Set your own handler, etc.
Definition: DDLParser.cc:67
std::vector< std::string > files_
int readConfig(const std::string &filename)
Read in the configuration file.
tuple filename
Definition: lut2db_cfg.py:20
const std::vector< std::string > & getFileNames() const
tuple cout
Definition: gather_cfg.py:121
const bool doValidation() const
std::string fullPath() const
Definition: FileInPath.cc:165
std::string getSchemaLocation() const
Return the designation for where to look for the schema.
#define DCOUT(M_v_Y, M_v_S)
Definition: DDdebug.h:53