#include <boost/algorithm/string.hpp>
#include <sstream>
#include "KeySymbols.h"
#include "Fireworks/FWInterface/src/FWPSetCellEditor.h"
#include "FWCore/ParameterSet/interface/ParameterSet.h"
#include "Fireworks/Core/interface/fwLog.h"
#include "FWCore/Utilities/interface/Parse.h"
Go to the source code of this file.
Functions | |
void | editBoolParameter (edm::ParameterSet &ps, bool tracked, const std::string &label, const std::string &value) |
bool | editESInputTag (edm::ParameterSet &ps, bool tracked, const std::string &label, const std::string &value) |
void | editFileInPath (edm::ParameterSet &ps, bool tracked, const std::string &label, const std::string &value) |
bool | editInputTag (edm::ParameterSet &ps, bool tracked, const std::string &label, const std::string &value) |
template<class T > | |
bool | editNumericParameter (edm::ParameterSet &ps, bool tracked, const std::string &label, const std::string &value) |
void | editStringParameter (edm::ParameterSet &ps, bool tracked, const std::string &label, const std::string &value) |
template<typename T > | |
void | editVectorParameter (edm::ParameterSet &ps, bool tracked, const std::string &label, const std::string &value) |
bool | editVInputTag (edm::ParameterSet &ps, bool tracked, const std::string &label, const std::string &value) |
void editBoolParameter | ( | edm::ParameterSet & | ps, |
bool | tracked, | ||
const std::string & | label, | ||
const std::string & | value | ||
) |
Definition at line 56 of file FWPSetCellEditor.cc.
References edm::ParameterSet::addParameter(), edm::ParameterSet::addUntrackedParameter(), fwLog, fwlog::kError, diffTwoXMLs::label, and x.
Referenced by FWPSetCellEditor::apply().
{ bool x = false; if (boost::iequals(value, "true")) { x = true; } else if (boost::iequals(value, "false")){ x = false; } else { fwLog(fwlog::kError) << "Invalid value. Possible values are true/false case insensitive." << std::endl; return; } if (tracked) ps.addParameter<bool>(label, x); else ps.addUntrackedParameter<bool>(label, x); }
bool editESInputTag | ( | edm::ParameterSet & | ps, |
bool | tracked, | ||
const std::string & | label, | ||
const std::string & | value | ||
) |
Definition at line 185 of file FWPSetCellEditor.cc.
References edm::ParameterSet::addParameter(), edm::ParameterSet::addUntrackedParameter(), cmsPerfPublish::fail(), AlCaHLTBitMon_QueryRunRegistry::string, and edm::tokenize().
Referenced by FWPSetCellEditor::apply().
{ std::vector<std::string> tokens = edm::tokenize(value, ":"); size_t nwords = tokens.size(); bool fail; if ( nwords > 2 ) { fail = true; } else { std::string it_module(""); std::string it_data(""); if ( nwords > 0 ) it_module = tokens[0]; if ( nwords > 1 ) it_data = tokens[1]; if ( tracked ) ps.addParameter(label, edm::ESInputTag(it_module, it_data)); else ps.addUntrackedParameter(label, edm::ESInputTag(it_module, it_data)); fail = false; } return fail; }
void editFileInPath | ( | edm::ParameterSet & | ps, |
bool | tracked, | ||
const std::string & | label, | ||
const std::string & | value | ||
) |
Definition at line 79 of file FWPSetCellEditor.cc.
References edm::ParameterSet::addParameter(), and edm::ParameterSet::addUntrackedParameter().
Referenced by FWPSetCellEditor::apply().
{ if (tracked) ps.addParameter(label, edm::FileInPath(value)); else ps.addUntrackedParameter(label, edm::FileInPath(value)); }
bool editInputTag | ( | edm::ParameterSet & | ps, |
bool | tracked, | ||
const std::string & | label, | ||
const std::string & | value | ||
) |
Definition at line 146 of file FWPSetCellEditor.cc.
References edm::ParameterSet::addParameter(), edm::ParameterSet::addUntrackedParameter(), cmsPerfPublish::fail(), AlCaHLTBitMon_QueryRunRegistry::string, and edm::tokenize().
Referenced by FWPSetCellEditor::apply().
{ std::vector<std::string> tokens = edm::tokenize(value, ":"); size_t nwords = tokens.size(); bool fail; if ( nwords > 3 ) { fail = true; } else { std::string it_label(""); std::string it_instance(""); std::string it_process(""); if ( nwords > 0 ) it_label = tokens[0]; if ( nwords > 1 ) it_instance = tokens[1]; if ( nwords > 2 ) it_process = tokens[2]; if ( tracked ) ps.addParameter(label, edm::InputTag(it_label, it_instance, it_process)); else ps.addUntrackedParameter(label, edm::InputTag(it_label, it_instance, it_process)); fail = false; } return fail; }
bool editNumericParameter | ( | edm::ParameterSet & | ps, |
bool | tracked, | ||
const std::string & | label, | ||
const std::string & | value | ||
) |
Definition at line 27 of file FWPSetCellEditor.cc.
References edm::ParameterSet::addParameter(), edm::ParameterSet::addUntrackedParameter(), cmsPerfPublish::fail(), and v.
{ std::stringstream str(value); T v; str >> v; bool fail = str.fail(); if (tracked) ps.addParameter(label, v); else ps.addUntrackedParameter(label, v); return fail; }
void editStringParameter | ( | edm::ParameterSet & | ps, |
bool | tracked, | ||
const std::string & | label, | ||
const std::string & | value | ||
) |
Definition at line 44 of file FWPSetCellEditor.cc.
References edm::ParameterSet::addParameter(), and edm::ParameterSet::addUntrackedParameter().
Referenced by FWPSetCellEditor::apply().
{ if (tracked) ps.addParameter(label, value); else ps.addUntrackedParameter(label, value); }
void editVectorParameter | ( | edm::ParameterSet & | ps, |
bool | tracked, | ||
const std::string & | label, | ||
const std::string & | value | ||
) |
Definition at line 221 of file FWPSetCellEditor.cc.
References edm::ParameterSet::addParameter(), edm::ParameterSet::addUntrackedParameter(), lst, AlCaHLTBitMon_QueryRunRegistry::string, and valueVector().
{ std::vector<T> valueVector; std::stringstream iss(value); std::string vitem; size_t fst, lst; while (getline(iss, vitem, ',')) { fst = vitem.find("["); lst = vitem.find("]"); if ( fst != std::string::npos ) vitem.erase(fst,1); if ( lst != std::string::npos ) vitem.erase(lst,1); std::stringstream oss(vitem); T on; oss >> on; valueVector.push_back(on); } if (tracked) ps.addParameter(label, valueVector); else ps.addUntrackedParameter(label, valueVector); }
bool editVInputTag | ( | edm::ParameterSet & | ps, |
bool | tracked, | ||
const std::string & | label, | ||
const std::string & | value | ||
) |
Definition at line 91 of file FWPSetCellEditor.cc.
References edm::ParameterSet::addParameter(), edm::ParameterSet::addUntrackedParameter(), cmsPerfPublish::fail(), lst, AlCaHLTBitMon_QueryRunRegistry::string, and edm::tokenize().
Referenced by FWPSetCellEditor::apply().
{ std::vector<edm::InputTag> inputTags; std::stringstream iss(value); std::string vitem; bool fail = false; size_t fst, lst; while (getline(iss, vitem, ',')) { fst = vitem.find("["); lst = vitem.find("]"); if ( fst != std::string::npos ) vitem.erase(fst,1); if ( lst != std::string::npos ) vitem.erase(lst,1); std::vector<std::string> tokens = edm::tokenize(vitem, ":"); size_t nwords = tokens.size(); if ( nwords > 3 ) { fail = true; return fail; } else { std::string it_label(""); std::string it_instance(""); std::string it_process(""); if ( nwords > 0 ) it_label = tokens[0]; if ( nwords > 1 ) it_instance = tokens[1]; if ( nwords > 2 ) it_process = tokens[2]; inputTags.push_back(edm::InputTag(it_label, it_instance, it_process)); } } if (tracked) ps.addParameter(label, inputTags); else ps.addUntrackedParameter(label, inputTags); return fail; }