16 #include <boost/algorithm/string.hpp>
20 #include <unordered_map>
42 this,
"Config", {},
"Map of keywords to file paths for file access" };
78 boost::split( parts,
path, boost::is_any_of(
"?" ) );
80 if ( parts.
size() > 1 ) {
82 boost::split( params, parts[1], boost::is_any_of(
"&" ) );
83 for (
auto& param : params ) {
85 boost::split( kv, param, boost::is_any_of(
"=" ) );
86 if ( kv.
size() == 2 ) { result[boost::trim_copy( kv[0] )] = boost::trim_copy( kv[1] ); }
89 result[
"mode"] = ( result.
find(
"mode" ) == result.
end() ) ?
"CREATE" : result[
"mode"];
90 result[
"path"] = boost::trim_copy( parts[0] );
105 for (
const auto& [identifier,
path] : configMap ) {
106 auto params = parseFilePath(
path );
108 auto& existingParams = fileParams[params[
"path"]];
109 if ( !existingParams.empty() ) {
110 if ( existingParams != params ) {
111 svc.error() <<
"Conflicting configurations for file path: " << params[
"path"] <<
endmsg;
130 [&filePath](
const auto& file ) { return file && file->GetName() == filePath; } );
131 if ( it != files.end() ) {
return std::distance( files.begin(), it ); }
143 auto params = parseFilePath(
path );
146 if (
auto fileIndex = findFileIndex(
m_files, params[
"path"] ) ) {
148 m_identifiers[boost::to_lower_copy( identifier )] = *fileIndex;
155 error() <<
"Failed to open file: " << params[
"path"] <<
endmsg;
170 error() <<
"No file associated with identifier: " << identifier <<
endmsg;
175 auto file = std::make_shared<TFile>( filePath.
c_str(), option.
c_str() );
176 if ( !file || file->IsZombie() ) {
return nullptr; }
181 for (
const auto& file :
m_files ) {
182 if ( file ) { file->Close(); }