20 #include "TStopwatch.h" 77 for (FWConfiguration::KeyValues::const_iterator it = iConfig.
keyValues()->begin(), itEnd = iConfig.
keyValues()->end();
80 std::map<std::string, FWConfigurable*>::const_iterator itFound =
m_configurables.find(it->first);
82 itFound->second->setFrom(it->second);
88 for (std::map<std::string, FWConfigurable*>::const_iterator it =
m_configurables.begin(),
99 std::ofstream
file(iName.c_str());
101 std::string message =
"unable to open file " + iName;
103 throw std::runtime_error(message.c_str());
111 }
catch (std::runtime_error&
e) {
119 gROOT->LoadMacro(iName.c_str(), &
error);
123 throw std::runtime_error(message.c_str());
129 Long_t lConfig = gROOT->ProcessLineFast(
command.c_str(), &
error);
138 std::string message(
"unable to properly parse configuration file ");
140 throw std::runtime_error(message.c_str());
142 std::unique_ptr<FWConfiguration>
config(reinterpret_cast<FWConfiguration*>(lConfig));
154 std::ifstream
f(iName.c_str());
155 if (
f.peek() != (
int)
'<')
164 std::ifstream
g(iName.c_str());
178 bool operator<(
const CMatch&
x)
const {
return cnt <
x.cnt; }
181 std::vector<CMatch> clist;
182 clist.push_back(CMatch(
"reco.fwc"));
183 clist.push_back(CMatch(
"miniaod.fwc"));
184 clist.push_back(CMatch(
"aod.fwc"));
185 std::vector<FWJobMetadataManager::Data>& sdata = dataMng->
usableData();
187 for (std::vector<CMatch>::iterator
c = clist.begin();
c != clist.end(); ++
c) {
188 std::string iName = gSystem->Which(TROOT::GetMacroPath(),
c->file.c_str(), kReadPermission);
189 std::ifstream
f(iName.c_str());
190 if (
f.peek() != (
int)
'<') {
191 fwLog(
fwlog::kWarning) <<
"FWConfigurationManager::guessAndReadFromFile can't open " << iName << std::endl;
196 std::ifstream
g(iName.c_str());
202 for (FWConfiguration::KeyValues::const_iterator it =
c->cfg->keyValues()->begin(),
203 itEnd =
c->cfg->keyValues()->end();
206 if (it->first ==
"EventItems") {
207 keyValues = it->second.keyValues();
212 for (FWConfiguration::KeyValues::const_iterator it = keyValues->begin(); it != keyValues->end(); ++it) {
216 for (std::vector<FWJobMetadataManager::Data>::iterator di = sdata.begin(); di != sdata.end(); ++di) {
217 if (di->type_ ==
type) {
226 fwLog(
fwlog::kInfo) <<
"Loading configuration file " << clist.back().file << std::endl;
229 return clist.back().file;
void to(FWConfiguration &) const
virtual ~FWConfigurationManager()
The Signals That Services Can Subscribe To This is based on ActivityRegistry and is current per Services can connect to the signals distributed by the ActivityRegistry in order to monitor the activity of the application Each possible callback has some defined which we here list in angle e g
void readFromOldFile(const std::string &) const
std::vector< std::pair< std::string, FWConfiguration > > KeyValues
FWConfiguration & addKeyValue(const std::string &, const FWConfiguration &)
config
parse the configuration file
void add(const std::string &iName, FWConfigurable *)
does not take ownership
bool operator<(DTCELinkId const &lhs, DTCELinkId const &rhs)
void readFromFile(const std::string &) const
void writeToFile(const std::string &) const
const KeyValues * keyValues() const
std::string guessAndReadFromFile(FWJobMetadataManager *) const
static void streamTo(std::ostream &oTo, const FWConfiguration &iConfig, const std::string &name)
std::map< std::string, FWConfigurable * > m_configurables
void setFrom(const FWConfiguration &) const