11#ifndef ROOT_RDF_RRESULTMAP
12#define ROOT_RDF_RRESULTMAP
20#include <unordered_map>
27namespace Experimental {
38MakeResultMap(std::shared_ptr<T> nominalResult, std::vector<std::shared_ptr<T>> &&variedResults,
40 std::shared_ptr<ROOT::Internal::RDF::RActionBase> nominalAction,
41 std::shared_ptr<ROOT::Internal::RDF::RActionBase> variedAction)
44 lm, std::move(nominalAction), std::move(variedAction));
51namespace Experimental {
57 std::unordered_map<std::string, std::shared_ptr<T>>
fMap;
63 ROOT::Internal::RDF::MakeResultMap<T>(std::shared_ptr<T> nominalResult,
64 std::vector<std::shared_ptr<T>> &&variedResults,
66 std::shared_ptr<ROOT::Internal::RDF::RActionBase> nominalAction,
67 std::shared_ptr<ROOT::Internal::RDF::RActionBase> variedAction);
70 RResultMap(std::shared_ptr<T> &&nominalResult, std::vector<std::shared_ptr<T>> &&variedResults,
72 std::shared_ptr<ROOT::Internal::RDF::RActionBase> nominalAction,
73 std::shared_ptr<ROOT::Internal::RDF::RActionBase> variedAction)
74 :
fKeys{
ROOT::Internal::RDF::Union({
"nominal"}, keys)}, fLoopManager(&lm),
75 fNominalAction(std::move(nominalAction)), fVariedAction(std::move(variedAction))
77 R__ASSERT(variedResults.size() == keys.size() &&
"Keys and values have different sizes!");
79 fMap.insert({
"nominal", std::move(nominalResult)});
80 for (
const auto &k : keys) {
81 auto it = fMap.insert({k, variedResults[i++]});
83 "Failed to insert an element in RResultMap, maybe a duplicated key? This should never happen.");
91 auto it = fMap.find(key);
93 throw std::runtime_error(
"RResultMap: no result with key \"" + key +
"\".");
95 if ((fVariedAction !=
nullptr && !fVariedAction->HasRun()) || !fNominalAction->HasRun())
100 const std::vector<std::string> &
GetKeys()
const {
return fKeys; }
The head node of a RDF computation graph.
T & operator[](const std::string &key)
ROOT::Detail::RDF::RLoopManager * fLoopManager
RResultMap(std::shared_ptr< T > &&nominalResult, std::vector< std::shared_ptr< T > > &&variedResults, std::vector< std::string > &&keys, ROOT::Detail::RDF::RLoopManager &lm, std::shared_ptr< ROOT::Internal::RDF::RActionBase > nominalAction, std::shared_ptr< ROOT::Internal::RDF::RActionBase > variedAction)
const std::vector< std::string > & GetKeys() const
std::shared_ptr< ROOT::Internal::RDF::RActionBase > fNominalAction
std::unordered_map< std::string, std::shared_ptr< T > > fMap
std::vector< std::string > fKeys
std::shared_ptr< ROOT::Internal::RDF::RActionBase > fVariedAction
ROOT::RDF::Experimental::RResultMap< T > MakeResultMap(std::shared_ptr< T > nominalResult, std::vector< std::shared_ptr< T > > &&variedResults, std::vector< std::string > &&keys, RLoopManager &lm, std::shared_ptr< ROOT::Internal::RDF::RActionBase > nominalAction, std::shared_ptr< ROOT::Internal::RDF::RActionBase > variedAction)
tbb::task_arena is an alias of tbb::interface7::task_arena, which doesn't allow to forward declare tb...