CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
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

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

Constructor & Destructor Documentation

FIPConfiguration::FIPConfiguration ( DDCompactView cpv)

Definition at line 25 of file FIPConfiguration.cc.

26  : configHandler_( cpv ),
27  cpv_( cpv )
28 {
29  // parser_ = DDLParser::instance();
30  // std::cout << "Making a FIPConfiguration with configHandler_ at " << &configHandler_ << std::endl;
31 }
DDLSAX2ConfigHandler configHandler_
DDCompactView & cpv_
FIPConfiguration::~FIPConfiguration ( void  )
virtual

Definition at line 33 of file FIPConfiguration.cc.

34 {
35  // parser_->getXMLParser()->setContentHandler(0);
36 }

Member Function Documentation

bool FIPConfiguration::doValidation ( void  ) const
virtual

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

Implements DDLDocumentProvider.

Definition at line 51 of file FIPConfiguration.cc.

References configHandler_, and DDLSAX2ConfigHandler::doValidation().

52 {
54 }
DDLSAX2ConfigHandler configHandler_
const bool doValidation() const
void FIPConfiguration::dumpFileList ( void  ) const
virtual

Print out the list of files.

Implements DDLDocumentProvider.

Definition at line 63 of file FIPConfiguration.cc.

References gather_cfg::cout, and files_.

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 }
std::vector< std::string > files_
tuple cout
Definition: gather_cfg.py:121
const std::vector< std::string > & FIPConfiguration::getFileList ( void  ) const
virtual

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

Implements DDLDocumentProvider.

Definition at line 39 of file FIPConfiguration.cc.

References files_.

40 {
41  return files_;
42 }
std::vector< std::string > files_
std::string FIPConfiguration::getSchemaLocation ( void  ) const
virtual

Return the designation for where to look for the schema.

Implements DDLDocumentProvider.

Definition at line 57 of file FIPConfiguration.cc.

References configHandler_, and DDLSAX2ConfigHandler::getSchemaLocation().

58 {
60 }
DDLSAX2ConfigHandler configHandler_
const std::string getSchemaLocation() const
const std::vector< std::string > & FIPConfiguration::getURLList ( void  ) const
virtual

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 45 of file FIPConfiguration.cc.

References urls_.

46 {
47  return urls_;
48 }
std::vector< std::string > urls_
int FIPConfiguration::readConfig ( const std::string &  filename)
virtual

Read in the configuration file.

Implements DDLDocumentProvider.

Definition at line 114 of file FIPConfiguration.cc.

Referenced by output(), and testParser().

115 {
116  return readConfig( filename, false );
117 }
int readConfig(const std::string &filename)
Read in the configuration file.
tuple filename
Definition: lut2db_cfg.py:20
int FIPConfiguration::readConfig ( const std::string &  filename,
bool  fullPath 
)

Read in the configuration file.

Definition at line 77 of file FIPConfiguration.cc.

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

78 {
79  std::string absoluteFileName (filename);
80  if (!fullPath) {
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 }
DDLSAX2ConfigHandler configHandler_
std::vector< std::string > urls_
DDCompactView & cpv_
DDLParser is the main class of Detector Description Language Parser.
Definition: DDLParser.h:64
const std::vector< std::string > & getURLs() const
std::vector< std::string > files_
tuple filename
Definition: lut2db_cfg.py:20
const std::vector< std::string > & getFileNames() const
#define DCOUT(M_v_Y, M_v_S)
Definition: DDdebug.h:53

Member Data Documentation

DDLSAX2ConfigHandler FIPConfiguration::configHandler_
private

Definition at line 66 of file FIPConfiguration.h.

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

DDCompactView& FIPConfiguration::cpv_
private

Definition at line 69 of file FIPConfiguration.h.

Referenced by readConfig().

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

Definition at line 67 of file FIPConfiguration.h.

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

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

Definition at line 68 of file FIPConfiguration.h.

Referenced by getURLList(), and readConfig().