80 for(FWConfiguration::KeyValues::const_iterator it = iConfig.
keyValues()->begin(),
84 std::map<std::string,FWConfigurable*>::const_iterator itFound =
m_configurables.find(it->first);
86 itFound->second->setFrom(it->second);
94 for(std::map<std::string,FWConfigurable*>::const_iterator it =
m_configurables.begin(),
98 it->second->addTo(config);
109 std::ofstream
file(iName.c_str());
114 throw std::runtime_error(
message.c_str());
123 catch (std::runtime_error &
e) {
std::cout << e.what() << std::endl; }
131 gROOT->LoadMacro( iName.c_str(), &
error );
135 throw std::runtime_error(message.c_str());
141 Long_t lConfig = gROOT->ProcessLineFast(command.c_str(),
148 gROOT->ProcessLineSync((
std::string(
".U ")+iName).c_str(), &error);
153 throw std::runtime_error(message.c_str());
155 std::auto_ptr<FWConfiguration>
config( reinterpret_cast<FWConfiguration*>(lConfig) );
163 #ifdef FW_CONFIG_PARSER_DEBUG
164 static char *debug_states[] = {
172 std::cerr <<
" " << where <<
" tag/data " << tag <<
"in state " << debug_states[state] << std::endl;
221 for (
size_t i = 0,
e = attributes.size();
i !=
e; ++
i)
224 if (attr.
key ==
"name")
226 else if (attr.
key ==
"version")
229 version = strtol(attr.
value.c_str(), &endptr, 10);
230 if (endptr == attr.
value.c_str())
249 throw ParserError(
"Expecting toplevel <config> tag");
258 else if (tag ==
"string")
271 throw ParserError(
"Wrong opening tag found " + tag);
288 throw ParserError(
"Wrong closing tag found " + tag);
294 m_configs.back().second->addKeyValue(key, *current);
305 throw ParserError(
"Wrong closing tag found " + tag);
323 else if (strspn(data.c_str(),
" \t\n") != data.size())
336 std::vector<std::pair<std::string, FWConfiguration *> >
m_configs;
352 std::ifstream
f(iName.c_str());
353 if (
f.peek() != (int)
'<')
362 std::ifstream
g(iName.c_str());
FWXMLConfigParser(istream &f)
std::string m_currentConfigName
std::vector< Attribute > Attributes
void to(FWConfiguration &) const
std::auto_ptr< FWConfiguration > m_first
const KeyValues * keyValues() const
std::vector< std::pair< std::string, FWConfiguration * > > m_configs
void streamTo(std::ostream &, const FWConfiguration &, const std::string &name)
void writeToFile(const std::string &) const
virtual ~FWConfigurationManager()
void debug_config_state_machine(const char *where, const std::string &tag, int state)
void readFromOldFile(const std::string &) const
void readFromFile(const std::string &) const
FWConfiguration * config(void)
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
virtual void startElement(const std::string &tag, Attributes &attributes) override
void pushConfig(Attributes &attributes)
void setFrom(const FWConfiguration &) const
virtual void endElement(const std::string &tag) override
FWConfiguration & addKeyValue(const std::string &, const FWConfiguration &)
virtual void data(const std::string &data) override
void add(const std::string &iName, FWConfigurable *)
does not take ownership
std::map< std::string, FWConfigurable * > m_configurables