CMS 3D CMS Logo

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

List of all members.

Public Member Functions

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

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@ucdhep.ucdavis.edu

Definition at line 31 of file FIPConfiguration.h.


Constructor & Destructor Documentation

FIPConfiguration::FIPConfiguration ( DDCompactView cpv)

Definition at line 25 of file FIPConfiguration.cc.

  : configHandler_( cpv ),
    cpv_( cpv )
{ 
  //  parser_ = DDLParser::instance();
  //  std::cout << "Making a FIPConfiguration with configHandler_ at " << &configHandler_ << std::endl;
}
FIPConfiguration::~FIPConfiguration ( void  ) [virtual]

Definition at line 33 of file FIPConfiguration.cc.

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

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().

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_.

{
  std::cout << "File List:" << std::endl;
  std::cout << "  number of files=" << files_.size() << std::endl;
  for (std::vector<std::string>::const_iterator it = files_.begin(); it != files_.end(); ++it)
    std::cout << *it << std::endl;
}
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_.

{
  return 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().

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_.

{
  return 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().

{
  return readConfig( filename, false );
}
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_, edm::FileInPath::fullPath(), DDLSAX2ConfigHandler::getFileNames(), DDLSAX2ConfigHandler::getURLs(), DDLParser::getXMLParser(), AlCaHLTBitMon_QueryRunRegistry::string, and urls_.

{
  std::string absoluteFileName (filename);
  if (!fullPath) {
    edm::FileInPath fp(filename);
    // config file
    absoluteFileName = fp.fullPath();
  }

  DCOUT('P', "FIPConfiguration::ReadConfig(): started");

  // Set the parser to use the handler for the configuration file.
  // This makes sure the Parser is initialized and gets a handle to it.
  DDLParser ddlp(cpv_);
  ddlp.getXMLParser()->setContentHandler(&configHandler_);
  ddlp.getXMLParser()->parse(absoluteFileName.c_str());
  const std::vector<std::string>& vURLs = configHandler_.getURLs();
  const std::vector<std::string>& vFiles = configHandler_.getFileNames();
  size_t maxInd = vFiles.size();
  size_t ind = 0;
  // ea. file listed in the config
  for(; ind < maxInd ; ++ind)
  {
    edm::FileInPath fp(vURLs[ind] + "/" + vFiles[ind]);
    //    std::cout << "FileInPath says..." << fp.fullPath() << std::endl;
    files_.push_back(fp.fullPath());
    urls_.push_back("");
  }

  //   std::vector<std::string> fnames = configHandler_.getFileNames();
  //   std::cout << "there are " << fnames.size() << " files." << std::endl;
  //   for (size_t i = 0; i < fnames.size(); ++i)
  //     std::cout << "url=" << configHandler_.getURLs()[i] << " file=" << configHandler_.getFileNames()[i] << std::endl;
  return 0;
}

Member Data Documentation

Definition at line 66 of file FIPConfiguration.h.

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

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().