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());
113 throw std::runtime_error(message.c_str());
122 catch (std::runtime_error &
e)
124 fwLog(
fwlog::kError) <<
"FWConfigurationManager::writeToFile() " << e.what() << std::endl;
133 gROOT->LoadMacro( iName.c_str(), &
error );
137 throw std::runtime_error(message.c_str());
143 Long_t lConfig = gROOT->ProcessLineFast(command.c_str(),
150 gROOT->ProcessLineSync((
std::string(
".U ")+iName).c_str(), &error);
155 throw std::runtime_error(message.c_str());
157 std::auto_ptr<FWConfiguration>
config( reinterpret_cast<FWConfiguration*>(lConfig) );
165 #ifdef FW_CONFIG_PARSER_DEBUG
166 static char *debug_states[] = {
174 std::cerr <<
" " << where <<
" tag/data " << tag <<
"in state " << debug_states[state] << std::endl;
223 for (
size_t i = 0,
e = attributes.size();
i !=
e; ++
i)
226 if (attr.
key ==
"name")
228 else if (attr.
key ==
"version")
231 version = strtol(attr.
value.c_str(), &endptr, 10);
232 if (endptr == attr.
value.c_str())
251 throw ParserError(
"Expecting toplevel <config> tag");
260 else if (tag ==
"string")
273 throw ParserError(
"Wrong opening tag found " + tag);
290 throw ParserError(
"Wrong closing tag found " + tag);
296 m_configs.back().second->addKeyValue(key, *current);
307 throw ParserError(
"Wrong closing tag found " + tag);
325 else if (strspn(data.c_str(),
" \t\n") != data.size())
338 std::vector<std::pair<std::string, FWConfiguration *> >
m_configs;
354 std::ifstream
f(iName.c_str());
355 if (
f.peek() != (int)
'<')
364 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