Skip to content

Commit

Permalink
Merge pull request #27296 from cms-sw/code-format-geometry-53d7b8
Browse files Browse the repository at this point in the history
Running code-format for geometry
  • Loading branch information
cmsbuild committed Jun 21, 2019
2 parents ab9222a + 7faa7c0 commit d69a9b0
Show file tree
Hide file tree
Showing 53 changed files with 2,931 additions and 3,473 deletions.
154 changes: 73 additions & 81 deletions DetectorDescription/RegressionTest/bin/DDErrorReport.cpp
Expand Up @@ -14,107 +14,99 @@
#include <boost/program_options.hpp>
#include <boost/exception/diagnostic_information.hpp>

int main(int argc, char *argv[])
{
try
{
int main(int argc, char* argv[]) {
try {
edmplugin::PluginManager::configure(edmplugin::standard::config());
}
catch (cms::Exception& e)
{
} catch (cms::Exception& e) {
edm::LogInfo("DDErrorReport") << "Attempting to configure the plugin manager. Exception message: " << e.what();
return 1;
}

// Process the command line arguments
std::string descString("DDErrorReport");
descString += " [options] configurationFileName\n";
descString += "Allowed options";
boost::program_options::options_description desc(descString);
desc.add_options()
("help,h", "Print this help message")
("file,f", boost::program_options::value<std::string>(), "XML configuration file name. "
"Default is DetectorDescription/RegressionTest/test/configuration.xml")
("path,p", "Specifies filename is a full path and not to use FileInPath to find file. "
" This option is ignored if a filename is not specified");
// Process the command line arguments
std::string descString("DDErrorReport");
descString += " [options] configurationFileName\n";
descString += "Allowed options";
boost::program_options::options_description desc(descString);
desc.add_options()("help,h", "Print this help message")(
"file,f",
boost::program_options::value<std::string>(),
"XML configuration file name. "
"Default is DetectorDescription/RegressionTest/test/configuration.xml")(
"path,p",
"Specifies filename is a full path and not to use FileInPath to find file. "
" This option is ignored if a filename is not specified");

boost::program_options::positional_options_description p;
p.add("file", -1);
boost::program_options::positional_options_description p;
p.add("file", -1);

boost::program_options::variables_map vm;
try {
store(boost::program_options::command_line_parser(argc,argv).options(desc).positional(p).run(),vm);
notify(vm);
} catch(boost::program_options::error const& iException) {
std::cerr << "Exception from command line processing: "
<< iException.what() << "\n";
std::cerr << desc << std::endl;
return 1;
}
boost::program_options::variables_map vm;
try {
store(boost::program_options::command_line_parser(argc, argv).options(desc).positional(p).run(), vm);
notify(vm);
} catch (boost::program_options::error const& iException) {
std::cerr << "Exception from command line processing: " << iException.what() << "\n";
std::cerr << desc << std::endl;
return 1;
}

if(vm.count("help")) {
std::cout << desc << std::endl;
return 0;
}
if (vm.count("help")) {
std::cout << desc << std::endl;
return 0;
}

bool fullPath = false;
std::string configfile("DetectorDescription/RegressionTest/test/configuration.xml");
try {
if (vm.count("file")) {
configfile = vm["file"].as<std::string>();
if (vm.count("path")) {
fullPath = true;
}
bool fullPath = false;
std::string configfile("DetectorDescription/RegressionTest/test/configuration.xml");
try {
if (vm.count("file")) {
configfile = vm["file"].as<std::string>();
if (vm.count("path")) {
fullPath = true;
}
}
catch(boost::exception& e)
{
edm::LogInfo("DDErrorReport") << "Attempting to parse the options. Exception message: " << boost::diagnostic_information(e);
return 1;
}
} catch (boost::exception& e) {
edm::LogInfo("DDErrorReport") << "Attempting to parse the options. Exception message: "
<< boost::diagnostic_information(e);
return 1;
}

DDCompactView cpv;
DDLParser myP(cpv);
myP.getDDLSAX2FileHandler()->setUserNS(false);
DDCompactView cpv;
DDLParser myP(cpv);
myP.getDDLSAX2FileHandler()->setUserNS(false);

/* The configuration file tells the parser what to parse.
/* The configuration file tells the parser what to parse.
The sequence of files to be parsed does not matter but for one exception:
XML containing SpecPar-tags must be parsed AFTER all corresponding
PosPart-tags were parsed. (Simply put all SpecPars-tags into seperate
files and mention them at end of configuration.xml. Functional SW
will not suffer from this restriction).
*/
*/

// Use the File-In-Path configuration document provider.
FIPConfiguration fp(cpv);
try
{
fp.readConfig(configfile, fullPath);
}
catch (cms::Exception& e)
{
edm::LogInfo("DDErrorReport") << "Attempting to read config. Exception message: " << e.what();
return 1;
}

int parserResult = myP.parse(fp);
if (parserResult != 0) {
std::cout << " problem encountered during parsing. exiting ... " << std::endl;
exit(1);
}
std::cout << "Parsing completed. Start checking for errors." << std::endl;
// Use the File-In-Path configuration document provider.
FIPConfiguration fp(cpv);
try {
fp.readConfig(configfile, fullPath);
} catch (cms::Exception& e) {
edm::LogInfo("DDErrorReport") << "Attempting to read config. Exception message: " << e.what();
return 1;
}

int parserResult = myP.parse(fp);
if (parserResult != 0) {
std::cout << " problem encountered during parsing. exiting ... " << std::endl;
exit(1);
}
std::cout << "Parsing completed. Start checking for errors." << std::endl;

DDErrorDetection ed(cpv);
DDErrorDetection ed(cpv);

bool noErrors = ed.noErrorsInTheReport(cpv);
if (noErrors && fullPath) {
std::cout << "DDErrorReport did not find any errors and is finished." << std::endl;
}
else {
ed.report(cpv, std::cout);
if (!noErrors) {
return 1;
}
bool noErrors = ed.noErrorsInTheReport(cpv);
if (noErrors && fullPath) {
std::cout << "DDErrorReport did not find any errors and is finished." << std::endl;
} else {
ed.report(cpv, std::cout);
if (!noErrors) {
return 1;
}
return 0;
}
return 0;
}

0 comments on commit d69a9b0

Please sign in to comment.