11#ifndef ROOT_RRESULTPTR
12#define ROOT_RRESULTPTR
37template <
typename Proxied>
43class GraphCreatorHelper;
57 std::shared_ptr<T> copiedResult{
new T{*inptr.
fObjPtr}};
59 inptr.
fActionPtr->CloneAction(
reinterpret_cast<void *
>(&copiedResult)));
84 std::shared_ptr<ROOT::Internal::RDF::RActionBase> actionPtr);
97namespace TTraits = ROOT::TypeTraits;
133 template <
typename T1>
136 template <
typename T1>
138 std::shared_ptr<RDFInternal::RActionBase>);
140 template <
typename T1>
143 template <
class T1,
class T2>
145 template <
class T1,
class T2>
155 friend std::unique_ptr<RDFDetail::RMergeableValue<T>> RDFDetail::GetMergeableValue<T>(
RResultPtr<T> &rptr);
164 const std::string &outputFileName);
166 template <typename V, bool hasBeginEnd = TTraits::HasBeginAndEnd<V>::value>
167 struct RIterationHelper {
168 using Iterator_t = void;
169 void GetBegin(
const V &) {
static_assert(
sizeof(V) == 0,
"It does not make sense to ask begin for this class."); }
170 void GetEnd(
const V &) {
static_assert(
sizeof(V) == 0,
"It does not make sense to ask end for this class."); }
173 template <
typename V>
174 struct RIterationHelper<V, true> {
175 using Iterator_t =
decltype(std::begin(std::declval<V>()));
176 static Iterator_t GetBegin(
const V &
v) {
return std::begin(
v); };
177 static Iterator_t GetEnd(
const V &
v) {
return std::end(
v); };
195 throw std::runtime_error(
"Trying to access the contents of a null RResultPtr.");
198 RResultPtr(std::shared_ptr<T> objPtr, RDFDetail::RLoopManager *lm,
199 std::shared_ptr<RDFInternal::RActionBase> actionPtr)
219 template <
typename T2,
220 std::enable_if_t<std::is_constructible<std::shared_ptr<T>, std::shared_ptr<T2>>::value,
int> = 0>
268 typename RIterationHelper<T>::Iterator_t
begin()
273 return RIterationHelper<T>::GetBegin(*
fObjPtr);
278 typename RIterationHelper<T>::Iterator_t
end()
283 return RIterationHelper<T>::GetEnd(*
fObjPtr);
336 constexpr auto kUninit = std::numeric_limits<unsigned int>::max();
337 auto activeSlot = std::make_shared<std::atomic_uint>(kUninit);
338 auto c = [=](
unsigned int slot) {
339 if (activeSlot->load() == kUninit) {
341 unsigned int expected = kUninit;
342 activeSlot->compare_exchange_strong(expected, slot);
344 if (activeSlot->load() != slot)
347 auto partialResult =
static_cast<Value_t *
>(actionPtr->PartialUpdate(slot));
348 callback(*partialResult);
389 auto c = [actionPtr, callback](
unsigned int slot) {
390 auto partialResult =
static_cast<Value_t *
>(actionPtr->PartialUpdate(slot));
391 callback(slot, *partialResult);
421template <
class T1,
class T2>
427template <
class T1,
class T2>
496 return std::unique_ptr<RMergeableValue<T>>{
Basic types used by ROOT and required by TInterpreter.
unsigned long long ULong64_t
Portable unsigned long integer 8 bytes.
Bool_t operator!=(const TDatime &d1, const TDatime &d2)
The head node of a RDF computation graph.
The head node of a RDF computation graph.
A result of an RDataFrame execution, that knows how to merge with other results of the same type.
Smart pointer for the return type of actions.
void TriggerRun()
Triggers the event loop in the RLoopManager.
friend bool operator!=(const RResultPtr< T1 > &lhs, std::nullptr_t rhs)
friend bool operator==(std::nullptr_t lhs, const RResultPtr< T1 > &rhs)
friend bool operator!=(const RResultPtr< T1 > &lhs, const RResultPtr< T2 > &rhs)
friend bool operator==(const RResultPtr< T1 > &lhs, std::nullptr_t rhs)
friend bool operator==(const RResultPtr< T1 > &lhs, const RResultPtr< T2 > &rhs)
friend bool operator!=(std::nullptr_t lhs, const RResultPtr< T1 > &rhs)
The public interface to the RDataFrame federation of classes.
Smart pointer for the return type of actions.
bool IsReady() const
Check whether the result has already been computed.
void TriggerRun()
Triggers the event loop in the RLoopManager.
RResultPtr(RResultPtr &&)=default
T * GetPtr()
Get the pointer to the encapsulated object.
std::shared_ptr< T > fObjPtr
Shared pointer encapsulating the wrapped result.
friend class RResultHandle
RResultPtr< T > & OnPartialResult(ULong64_t everyNEvents, std::function< void(T &)> callback)
Register a callback that RDataFrame will execute "everyNEvents" on a partial result.
RDFDetail::RLoopManager * fLoopManager
Non-owning pointer to the RLoopManager at the root of this computation graph.
RIterationHelper< T >::Iterator_t begin()
Return an iterator to the beginning of the contained object if this makes sense, throw a compilation ...
ROOT::RDF::RInterface< ROOT::Detail::RDF::RLoopManager > Value_t
const T & GetValue()
Get a const reference to the encapsulated object.
std::shared_ptr< T > GetSharedPtr()
Produce the encapsulated result, and return a shared pointer to it.
RResultPtr(const RResultPtr &)=default
T & operator*()
Get a reference to the encapsulated object.
RResultPtr & operator=(const RResultPtr &)=default
RResultPtr< T > & OnPartialResultSlot(ULong64_t everyNEvents, std::function< void(unsigned int, T &)> callback)
Register a callback that RDataFrame will execute in each worker thread concurrently on that thread's ...
RResultPtr & operator=(RResultPtr &&)=default
RResultPtr(const RResultPtr< T2 > &r)
Convert a RResultPtr<T2> to a RResultPtr<T>.
std::shared_ptr< RDFInternal::RActionBase > fActionPtr
Owning pointer to the action that will produce this result.
T * operator->()
Get a pointer to the encapsulated object.
static constexpr ULong64_t kOnce
RResultPtr(std::shared_ptr< T > objPtr, RDFDetail::RLoopManager *lm, std::shared_ptr< RDFInternal::RActionBase > actionPtr)
RIterationHelper< T >::Iterator_t end()
Return an iterator to the end of the contained object if this makes sense, throw a compilation error ...
std::unique_ptr< RMergeableVariations< T > > GetMergeableValue(ROOT::RDF::Experimental::RResultMap< T > &rmap)
Retrieve mergeable values after calling ROOT::RDF::VariationsFor .
RResultPtr< T > MakeResultPtr(const std::shared_ptr< T > &r, RLoopManager &df, std::shared_ptr< ROOT::Internal::RDF::RActionBase > actionPtr)
Create a RResultPtr and set its pointer to the corresponding RAction This overload is invoked by non-...
Special implementation of ROOT::RRangeCast for TCollection, including a check that the cast target ty...
ROOT::RDF::RResultPtr< ROOT::RDF::RInterface< ROOT::Detail::RDF::RLoopManager > > SnapshotPtr_t
ROOT::RDF::Experimental::RResultMap< T > CloneResultAndAction(const ROOT::RDF::Experimental::RResultMap< T > &inmap)
Clones an RResultMap and its corresponding RVariedAction.
bool operator==(const RConcurrentHashColl::HashValue &lhs, const RConcurrentHashColl::HashValue &rhs)
RResultMap< T > VariationsFor(RResultPtr< T > resPtr)
Produce all required systematic variations for the given result.
ROOT type_traits extensions.