#include <Utilities.h>
|
bool | check () |
|
| CommandLine () |
|
template<class T > |
T | getValue (const std::string &name) |
|
template<> |
bool | getValue (const std::string &name) |
|
template<> |
bool | getValue (const std::string &name, bool default_value) |
|
template<class T > |
T | getValue (const std::string &name, T default_value) |
|
template<class T > |
std::vector< T > | getVector (const std::string &name) |
|
template<class T > |
std::vector< T > | getVector (const std::string &name, const std::string &default_as_string) |
|
bool | parse (int argc, char **argv) |
|
void | print () |
|
| ~CommandLine () |
|
|
typedef std::map< std::string, std::pair< std::string, bool > > | OptionMap_t |
|
typedef std::vector< std::string > | StrVec_t |
|
Definition at line 24 of file Utilities.h.
◆ OptionMap_t
◆ StrVec_t
◆ CommandLine()
CommandLine::CommandLine |
( |
| ) |
|
|
inline |
◆ ~CommandLine()
CommandLine::~CommandLine |
( |
| ) |
|
|
inline |
◆ check()
bool CommandLine::check |
( |
void |
| ) |
|
|
inline |
◆ getValue() [1/4]
template<class T >
T CommandLine::getValue |
( |
const std::string & |
name | ) |
|
◆ getValue() [2/4]
template<>
bool CommandLine::getValue |
( |
const std::string & |
name | ) |
|
|
inline |
◆ getValue() [3/4]
template<>
bool CommandLine::getValue |
( |
const std::string & |
name, |
|
|
bool |
default_value |
|
) |
| |
|
inline |
◆ getValue() [4/4]
template<class T >
T CommandLine::getValue |
( |
const std::string & |
name, |
|
|
T |
default_value |
|
) |
| |
◆ getVector() [1/2]
template<class T >
std::vector< T > CommandLine::getVector |
( |
const std::string & |
name | ) |
|
◆ getVector() [2/2]
template<class T >
std::vector< T > CommandLine::getVector |
( |
const std::string & |
name, |
|
|
const std::string & |
default_as_string |
|
) |
| |
◆ parse()
bool CommandLine::parse |
( |
int |
argc, |
|
|
char ** |
argv |
|
) |
| |
|
inline |
Definition at line 184 of file Utilities.h.
190 for (
int i = 1;
i <
argc;
i++) {
192 if (0 !=
opt.find(
'-')) {
199 std::cout <<
"CommandLine ERROR: options must start with '-'!" << std::endl;
205 if (
i + 1 >=
argc) {
206 std::cout <<
"ERROR: option '" <<
opt <<
"' requires value!" << std::endl;
213 while (
next.find(
'-') != 0) {
References _exe, _options, _ordered_options, _unknowns, dir2webdir::argc, cmsBatch::argv, gather_cfg::cout, mps_fire::i, GetRecoTauVFromDQM_MC_cff::next, runTheMatrix::opt, parse_file(), AlCaHLTBitMon_QueryRunRegistry::string, and summarizeEdmComparisonLogfiles::success.
◆ parse_file()
bool CommandLine::parse_file |
( |
const std::string & |
file_name | ) |
|
|
inlineprivate |
Definition at line 277 of file Utilities.h.
279 if (!
fin.is_open()) {
284 std::stringstream
ss;
310 }
else if (!last_token.empty()) {
311 if (last_token.find(
'\"') == 0) {
312 if (last_token.rfind(
'\"') == last_token.length() - 1) {
313 last_token = last_token.substr(1, last_token.length() - 2);
314 value += (!
value.empty()) ?
"," + last_token : last_token;
317 last_token +=
" " +
token;
319 value += (!
value.empty()) ?
"," + last_token : last_token;
326 if (!last_token.empty()) {
327 if (last_token.find(
'\"') == 0 && last_token.rfind(
'\"') == last_token.length() - 1)
328 last_token = last_token.substr(1, last_token.length() - 2);
329 value += (!
value.empty()) ?
"," + last_token : last_token;
References _options, gather_cfg::cout, contentValuesCheck::file_name, ALCARECOTkAlBeamHalo_cff::filter, groupFilesInBlocks::fin, crabWrapper::key, GetRecoTauVFromDQM_MC_cff::next, contentValuesCheck::ss, AlCaHLTBitMon_QueryRunRegistry::string, unpackBuffers-CaloStage2::token, and relativeConstraints::value.
Referenced by parse().
◆ print()
void CommandLine::print |
( |
void |
| ) |
|
|
inline |
Definition at line 245 of file Utilities.h.
246 std::cout <<
"------------------------------------------------------------" << std::endl;
248 std::cout <<
"------------------------------------------------------------" << std::endl;
250 OptionMap_t::const_iterator it =
_options.find(*itvec);
252 if (it->second.first.find(
",") < std::string::npos) {
258 if (
tmp.length() == length) {
259 std::cout << std::setiosflags(std::ios::left) << std::setw(22) << it->first
260 << std::resetiosflags(std::ios::left) << std::setw(3) <<
"=" << std::setiosflags(std::ios::right)
261 << std::setw(35) <<
tmp.substr(0,
pos) << std::resetiosflags(std::ios::right) << std::endl;
263 std::cout << std::setiosflags(std::ios::right) << std::setw(60) <<
tmp.substr(0,
pos)
264 << std::resetiosflags(std::ios::right) << std::endl;
267 }
while (
pos != std::string::npos);
269 std::cout << std::setiosflags(std::ios::left) << std::setw(22) << it->first << std::resetiosflags(std::ios::left)
270 << std::setw(3) <<
"=" << std::setiosflags(std::ios::right) << std::setw(35) << it->second.first
271 << std::resetiosflags(std::ios::right) << std::endl;
274 std::cout <<
"------------------------------------------------------------" << std::endl;
References _exe, _options, _ordered_options, cms::cuda::assert(), gather_cfg::cout, AlCaHLTBitMon_QueryRunRegistry::string, and createJobs::tmp.
◆ _exe
std::string CommandLine::_exe |
|
private |
◆ _options
◆ _ordered_options
◆ _unknowns