81 for(FWConfiguration::KeyValues::const_iterator it = iConfig.
keyValues()->begin(),
85 std::map<std::string,FWConfigurable*>::const_iterator itFound =
m_configurables.find(it->first);
87 itFound->second->setFrom(it->second);
95 for(std::map<std::string,FWConfigurable*>::const_iterator it =
m_configurables.begin(),
99 it->second->addTo(config);
110 ofstream
file(iName.c_str());
115 throw std::runtime_error(
message.c_str());
124 catch (std::runtime_error &
e) {
std::cout << e.what() << std::endl; }
132 gROOT->LoadMacro( iName.c_str(), &
error );
136 throw std::runtime_error(message.c_str());
142 Long_t lConfig = gROOT->ProcessLineFast(command.c_str(),
149 gROOT->ProcessLineSync((
std::string(
".U ")+iName).c_str(), &error);
154 throw std::runtime_error(message.c_str());
156 std::auto_ptr<FWConfiguration>
config( reinterpret_cast<FWConfiguration*>(lConfig) );
164 #ifdef FW_CONFIG_PARSER_DEBUG
165 static char *debug_states[] = {
173 std::cerr <<
" " << where <<
" tag/data " << tag <<
"in state " << debug_states[
state] << std::endl;
222 for (
size_t i = 0,
e = attributes.size();
i !=
e; ++
i)
225 if (attr.
key ==
"name")
227 else if (attr.
key ==
"version")
230 version = strtol(attr.
value.c_str(), &endptr, 10);
231 if (endptr == attr.
value.c_str())
250 throw ParserError(
"Expecting toplevel <config> tag");
259 else if (tag ==
"string")
272 throw ParserError(
"Wrong opening tag found " + tag);
289 throw ParserError(
"Wrong closing tag found " + tag);
295 m_configs.back().second->addKeyValue(key, *current);
306 throw ParserError(
"Wrong closing tag found " + tag);
324 else if (strspn(data.c_str(),
" \t\n") != data.size())
337 std::vector<std::pair<std::string, FWConfiguration *> >
m_configs;
353 std::ifstream
f(iName.c_str());
354 if (
f.peek() != (int)
'<')
363 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)
void pushConfig(Attributes &attributes)
void setFrom(const FWConfiguration &) const
FWConfiguration & addKeyValue(const std::string &, const FWConfiguration &)
virtual void data(const std::string &data)
void add(const std::string &iName, FWConfigurable *)
does not take ownership
virtual void endElement(const std::string &tag)
std::map< std::string, FWConfigurable * > m_configurables