16#include "boost/algorithm/string/trim.hpp"
52 const KeySet_t::value_type& keyval( std::move(keyword_) );
61 const KeySet_t::value_type& keyval( std::move(keyword_) );
83 std::ifstream
file( fileName.c_str() );
85 std::cerr <<
"MiniConfig::ReadFile(): "
86 <<
"cannot read from file: " << fileName <<
"\n";
100 while( getline(
file,line) ) {
102 std::istringstream linestream(line);
105 while( linestream.get(c) ) {
113 if( c == 0 || isspace(c) ) {
122 linestream.putback(c);
127 std::cerr <<
"MiniConfig::ReadFile(): "
128 <<
"badly formatted line: \"" << line <<
"\", line number " << lineNumber <<
"\n";
133 if( skipCount > 0 ) {
139 std::cerr <<
"MiniConfig::ReadFile(): "
140 <<
"unmatched \"}\", line number " << lineNumber <<
"\n";
152 std::cerr <<
"MiniConfig::ReadFile(): "
153 <<
"badly formatted line: \"" << line <<
"\", line number " << lineNumber <<
"\n";
158 val = line.substr(linestream.tellg(), std::string::npos);
161 if( val.size() == 0 ) {
162 std::cerr <<
"MiniConfig::ReadFile(): "
163 <<
"badly formatted line: \"" << line <<
"\", line number " << lineNumber <<
"\n";
167 if( skipCount == 0 ) {
168 node->SetAttribute( att, val,
false );
179 std::string lokey = key;
180 std::ranges::transform(lokey, lokey.begin(), [](
unsigned char c) { return std::tolower(c); });
184 std::cerr <<
"MiniConfig::ReadFile(): "
185 <<
"badly formatted line: \"" << line <<
"\", line number " << lineNumber <<
"\n";
196 node->SetAttribute(
id,
node->GetPathName(),
true );
205 std::cerr <<
"MiniConfig::ReadFile(): "
206 <<
"badly formatted line: \"" << line <<
"\", line number " << lineNumber <<
"\n";
219 std::cerr <<
"MiniConfig::GetStringAttribute(): "
220 <<
"not configured (no file has been read)\n";
221 return std::string(
"");
226 std::cerr <<
"MiniConfig::GetStringAttribute(): "
227 <<
"\"" << objName <<
"\" does not exist\n";
228 return std::string(
"");
230 return node->GetAttribute( std::move(attName) );
239 std::cerr <<
"MiniConfig::GetIntAttribute(): "
240 <<
"not configured (no file has been read)\n";
246 std::cerr <<
"MiniConfig::GetIntAttribute(): "
247 <<
"\"" << objName <<
"\" does not exist\n";
252 std::string valstring =
node->GetAttribute( attName );
253 std::istringstream valstream(valstring);
256 std::cerr <<
"MiniConfig::GetIntAttribute(): "
257 <<
"\"" << attName <<
"\" not an integer type\n";
270 std::cerr <<
"MiniConfig::GetFloatAttribute(): "
271 <<
"not configured (no file has been read)\n";
277 std::cerr <<
"MiniConfig::GetFloatAttribute(): "
278 <<
"\"" << objName <<
"\" does not exist\n";
283 std::string valstring =
node->GetAttribute( attName );
284 std::istringstream valstream(valstring);
287 std::cerr <<
"MiniConfig::GetFloatAttribute(): object \"" << objName <<
"\""
288 <<
": \"" << attName <<
"\" not a floating-point type\n";
303 std::cerr <<
"MiniConfig::GetAttributeNames(): "
304 <<
"not configured (no file has been read)\n";
310 std::cerr <<
"MiniConfig::GetAttributeNames(): "
311 <<
"\"" << objName <<
"\" does not exist\n";
315 node->GetAttributeNames( attSet );
324 std::cerr <<
"MiniConfig::SendVisitor(): "
325 <<
"not configured (no file has been read)\n";
336 std::cerr <<
"MiniConfig::SendWriter(): "
337 <<
"not configured (no file has been read)\n";
std::shared_ptr< HepMC3::Writer > writer
ClassImp(xAOD::Experimental::RFileChecker) namespace xAOD
A node of a tree structure holding a configuration, where each node may be given attributes,...
virtual bool ReadFile(std::string fileName)
virtual void AddAttributeKeyword(std::string keyword_)
virtual std::string GetStringAttribute(std::string objName, std::string attName) const
MiniConfigTreeNode * m_tree
virtual void AddKeyword(std::string keyword_)
virtual void SetAttribKeywordPropagateDown(bool propagateDown)
virtual float GetFloatAttribute(std::string objName, std::string attName) const
virtual int GetIntAttribute(std::string objName, std::string attName) const
virtual void SendVisitor(MiniConfigTreeNode::Visitor &visitor) const
virtual void GetAttributeNames(std::string objName, std::set< std::string > &attSet) const
virtual void SendWriter(MiniConfigTreeNode::Writer &writer)