14#include "boost/algorithm/string/case_conv.hpp"
15#include "boost/algorithm/string/trim.hpp"
51 const KeySet_t::value_type& keyval( std::move(keyword_) );
60 const KeySet_t::value_type& keyval( std::move(keyword_) );
82 std::ifstream
file( fileName.c_str() );
84 std::cerr <<
"MiniConfig::ReadFile(): "
85 <<
"cannot read from file: " << fileName <<
"\n";
99 while( getline(
file,line) ) {
101 std::istringstream linestream(line);
104 while( linestream.get(c) ) {
112 if( c == 0 || isspace(c) ) {
121 linestream.putback(c);
126 std::cerr <<
"MiniConfig::ReadFile(): "
127 <<
"badly formatted line: \"" << line <<
"\", line number " << lineNumber <<
"\n";
132 if( skipCount > 0 ) {
138 std::cerr <<
"MiniConfig::ReadFile(): "
139 <<
"unmatched \"}\", line number " << lineNumber <<
"\n";
151 std::cerr <<
"MiniConfig::ReadFile(): "
152 <<
"badly formatted line: \"" << line <<
"\", line number " << lineNumber <<
"\n";
157 val = line.substr(linestream.tellg(), std::string::npos);
160 if( val.size() == 0 ) {
161 std::cerr <<
"MiniConfig::ReadFile(): "
162 <<
"badly formatted line: \"" << line <<
"\", line number " << lineNumber <<
"\n";
166 if( skipCount == 0 ) {
167 node->SetAttribute( att, val,
false );
178 std::string lokey = key;
179 boost::algorithm::to_lower (lokey);
183 std::cerr <<
"MiniConfig::ReadFile(): "
184 <<
"badly formatted line: \"" << line <<
"\", line number " << lineNumber <<
"\n";
195 node->SetAttribute(
id,
node->GetPathName(),
true );
204 std::cerr <<
"MiniConfig::ReadFile(): "
205 <<
"badly formatted line: \"" << line <<
"\", line number " << lineNumber <<
"\n";
218 std::cerr <<
"MiniConfig::GetStringAttribute(): "
219 <<
"not configured (no file has been read)\n";
220 return std::string(
"");
225 std::cerr <<
"MiniConfig::GetStringAttribute(): "
226 <<
"\"" << objName <<
"\" does not exist\n";
227 return std::string(
"");
229 return node->GetAttribute( std::move(attName) );
238 std::cerr <<
"MiniConfig::GetIntAttribute(): "
239 <<
"not configured (no file has been read)\n";
245 std::cerr <<
"MiniConfig::GetIntAttribute(): "
246 <<
"\"" << objName <<
"\" does not exist\n";
251 std::string valstring =
node->GetAttribute( attName );
252 std::istringstream valstream(valstring);
255 std::cerr <<
"MiniConfig::GetIntAttribute(): "
256 <<
"\"" << attName <<
"\" not an integer type\n";
269 std::cerr <<
"MiniConfig::GetFloatAttribute(): "
270 <<
"not configured (no file has been read)\n";
276 std::cerr <<
"MiniConfig::GetFloatAttribute(): "
277 <<
"\"" << objName <<
"\" does not exist\n";
282 std::string valstring =
node->GetAttribute( attName );
283 std::istringstream valstream(valstring);
286 std::cerr <<
"MiniConfig::GetFloatAttribute(): object \"" << objName <<
"\""
287 <<
": \"" << attName <<
"\" not a floating-point type\n";
302 std::cerr <<
"MiniConfig::GetAttributeNames(): "
303 <<
"not configured (no file has been read)\n";
309 std::cerr <<
"MiniConfig::GetAttributeNames(): "
310 <<
"\"" << objName <<
"\" does not exist\n";
314 node->GetAttributeNames( attSet );
323 std::cerr <<
"MiniConfig::SendVisitor(): "
324 <<
"not configured (no file has been read)\n";
335 std::cerr <<
"MiniConfig::SendWriter(): "
336 <<
"not configured (no file has been read)\n";
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)