11#ifndef ROOT_RRESULTPTR
12#define ROOT_RRESULTPTR
29namespace Experimental {
37template <
typename Proxied,
typename DataSource>
56 Warning(
"Snapshot",
"A lazy Snapshot action was booked but never triggered.");
67RResultPtr<T>
MakeResultPtr(
const std::shared_ptr<T> &
r, RLoopManager &df,
68 std::shared_ptr<ROOT::Internal::RDF::RActionBase> actionPtr);
108 template <
typename T1>
111 template <
typename T1>
113 std::shared_ptr<RDFInternal::RActionBase>);
115 template <
typename T1>
118 template <
class T1,
class T2>
120 template <
class T1,
class T2>
130 friend std::unique_ptr<RDFDetail::RMergeableValue<T>> RDFDetail::GetMergeableValue<T>(
RResultPtr<T> &rptr);
137 template <typename V, bool hasBeginEnd = TTraits::HasBeginAndEnd<V>::value>
138 struct RIterationHelper {
139 using Iterator_t =
void;
140 void GetBegin(
const V &) {
static_assert(
sizeof(V) == 0,
"It does not make sense to ask begin for this class."); }
141 void GetEnd(
const V &) {
static_assert(
sizeof(V) == 0,
"It does not make sense to ask end for this class."); }
144 template <
typename V>
145 struct RIterationHelper<V, true> {
146 using Iterator_t =
decltype(std::begin(std::declval<V>()));
147 static Iterator_t GetBegin(
const V &
v) {
return std::begin(
v); };
148 static Iterator_t GetEnd(
const V &
v) {
return std::end(
v); };
176 throw std::runtime_error(
"Trying to access the contents of a null RResultPtr.");
180 std::shared_ptr<RDFInternal::RActionBase> actionPtr)
197 if (
fObjPtr.use_count() == 1) {
206 template <
typename T2,
207 std::enable_if_t<std::is_constructible<std::shared_ptr<T>, std::shared_ptr<T2>>::value,
int> = 0>
243 typename RIterationHelper<T>::Iterator_t
begin()
248 return RIterationHelper<T>::GetBegin(*
fObjPtr);
253 typename RIterationHelper<T>::Iterator_t
end()
258 return RIterationHelper<T>::GetEnd(*
fObjPtr);
309 auto c = [nSlots, actionPtr, callback](
unsigned int slot) {
310 if (slot != nSlots - 1)
312 auto partialResult =
static_cast<Value_t *
>(actionPtr->PartialUpdate(slot));
313 callback(*partialResult);
354 auto c = [actionPtr, callback](
unsigned int slot) {
355 auto partialResult =
static_cast<Value_t *
>(actionPtr->PartialUpdate(slot));
356 callback(slot, *partialResult);
386template <
class T1,
class T2>
392template <
class T1,
class T2>
461 return std::unique_ptr<RMergeableValue<T>>{
typedef void(GLAPIENTRYP _GLUfuncptr)(void)
unsigned long long ULong64_t
void Warning(const char *location, const char *msgfmt,...)
Use this function in warning situations.
The head node of a RDF computation graph.
void Run()
Start the event loop with a different mechanism depending on IMT/no IMT, data source/no data source.
unsigned int GetNSlots() const
void RegisterCallback(ULong64_t everyNEvents, std::function< void(unsigned int)> &&f)
A result of an RDataFrame execution, that knows how to merge with other results of the same type.
Helper class that provides the operation graph nodes.
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.
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.
friend bool operator!=(const RResultPtr< T1 > &lhs, const RResultPtr< T2 > &rhs)
RIterationHelper< T >::Iterator_t begin()
Return an iterator to the beginning of the contained object if this makes sense, throw a compilation ...
T Value_t
Convenience alias to simplify access to proxied type.
T * Get()
Get the pointer to the encapsulated result.
const T & GetValue()
Get a const reference to the encapsulated object.
RResultPtr(const RResultPtr &)=default
T & operator*()
Get a pointer 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
friend bool operator==(const RResultPtr< T1 > &lhs, const RResultPtr< T2 > &rhs)
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.
std::shared_ptr< T > SPT_t
T * operator->()
Get a pointer to the encapsulated object.
SPT_t fObjPtr
Shared pointer encapsulating the wrapped result.
static constexpr ULong64_t kOnce
Convenience definition to express a callback must be executed once.
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< RMergeableValue< T > > GetMergeableValue(RResultPtr< T > &rptr)
Retrieve a mergeable value from an RDataFrame action.
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-...
void WarnOnLazySnapshotNotTriggered(const ROOT::RDF::RResultPtr< T > &)
RResultMap< T > VariationsFor(RResultPtr< T > resPtr)
Produce all required systematic variations for the given result.
bool operator!=(const RResultPtr< T1 > &lhs, const RResultPtr< T2 > &rhs)
bool operator==(const RResultPtr< T1 > &lhs, const RResultPtr< T2 > &rhs)
ROOT type_traits extensions.
tbb::task_arena is an alias of tbb::interface7::task_arena, which doesn't allow to forward declare tb...