@@ -459,7 +459,7 @@ public:
459
459
// / \brief Execute a user-defined function requiring a processing slot index on each entry (*instant action*)
460
460
// / \param[in] f Function, lambda expression, functor class or any other callable object performing user defined
461
461
// / calculations.
462
- // / \param[in] bl Names of the branches in input to the user function.
462
+ // / \param[in] columns Names of the branches in input to the user function.
463
463
// /
464
464
// / Same as `Foreach`, but the user-defined function takes an extra
465
465
// / `unsigned int` as its first parameter, the *processing slot index*.
@@ -472,16 +472,15 @@ public:
472
472
// / `ForeachSlot` works just as well with single-thread execution: in that
473
473
// / case `slot` will always be `0`.
474
474
template <typename F>
475
- void ForeachSlot (F f, const ColumnNames_t &bl = {})
475
+ void ForeachSlot (F f, const ColumnNames_t &columns = {})
476
476
{
477
- auto df = GetDataFrameChecked ();
478
- const ColumnNames_t &defBl = df->GetDefaultColumnNames ();
479
- auto nArgs = TTraits::CallableTraits<F>::arg_types::list_size;
480
- const auto actualBl = TDFInternal::SelectColumns (nArgs - 1 , bl, defBl);
477
+ auto loopManager = GetDataFrameChecked ();
478
+ auto nColumns = TTraits::CallableTraits<F>::arg_types::list_size - 1 ;
479
+ const auto validColumnNames = GetValidatedColumnNames (*loopManager, nColumns, columns);
481
480
using Helper_t = TDFInternal::ForeachSlotHelper<F>;
482
481
using Action_t = TDFInternal::TAction<Helper_t, Proxied>;
483
- df ->Book (std::make_shared<Action_t>(Helper_t (std::move (f)), actualBl , *fProxiedPtr ));
484
- df ->Run ();
482
+ loopManager ->Book (std::make_shared<Action_t>(Helper_t (std::move (f)), validColumnNames , *fProxiedPtr ));
483
+ loopManager ->Run ();
485
484
}
486
485
487
486
// //////////////////////////////////////////////////////////////////////////
@@ -522,15 +521,15 @@ public:
522
521
{
523
522
using arg_types = typename TTraits::CallableTraits<F>::arg_types;
524
523
TDFInternal::CheckReduce (f, arg_types ());
525
- auto df = GetDataFrameChecked ();
526
- const auto &defBl = df->GetDefaultColumnNames ();
527
- const ColumnNames_t userColumns = columnName.empty () ? ColumnNames_t () : ColumnNames_t ({std::string (columnName)});
528
- const auto actualBl = TDFInternal::SelectColumns (1 , userColumns, defBl);
524
+ auto loopManager = GetDataFrameChecked ();
525
+ const auto columns = columnName.empty () ? ColumnNames_t () : ColumnNames_t ({std::string (columnName)});
526
+ const auto validColumnNames = GetValidatedColumnNames (*loopManager, 1 , columns);
529
527
auto redObjPtr = std::make_shared<T>(initValue);
530
528
using Helper_t = TDFInternal::ReduceHelper<F, T>;
531
529
using Action_t = typename TDFInternal::TAction<Helper_t, Proxied>;
532
- df->Book (std::make_shared<Action_t>(Helper_t (std::move (f), redObjPtr, df->GetNSlots ()), actualBl, *fProxiedPtr ));
533
- return MakeResultProxy (redObjPtr, df);
530
+ loopManager->Book (std::make_shared<Action_t>(Helper_t (std::move (f), redObjPtr, loopManager->GetNSlots ()),
531
+ validColumnNames, *fProxiedPtr ));
532
+ return MakeResultProxy (redObjPtr, loopManager);
534
533
}
535
534
536
535
// //////////////////////////////////////////////////////////////////////////
@@ -567,23 +566,22 @@ public:
567
566
// / \brief Return a collection of values of a branch (*lazy action*)
568
567
// / \tparam T The type of the branch.
569
568
// / \tparam COLL The type of collection used to store the values.
570
- // / \param[in] branchName The name of the branch of which the values are to be collected
569
+ // / \param[in] column The name of the branch of which the values are to be collected
571
570
// /
572
571
// / This action is *lazy*: upon invocation of this method the calculation is
573
572
// / booked but not executed. See TResultProxy documentation.
574
573
template <typename T, typename COLL = std::vector<T>>
575
- TResultProxy<COLL> Take (std::string_view branchName = " " )
574
+ TResultProxy<COLL> Take (std::string_view column = " " )
576
575
{
577
- auto df = GetDataFrameChecked ();
578
- unsigned int nSlots = df->GetNSlots ();
579
- const ColumnNames_t &defBl = df->GetDefaultColumnNames ();
580
- const ColumnNames_t userColumns = branchName.empty () ? ColumnNames_t () : ColumnNames_t ({std::string (branchName)});
581
- const auto bl = TDFInternal::SelectColumns (1 , userColumns, defBl);
582
- auto valuesPtr = std::make_shared<COLL>();
576
+ auto loopManager = GetDataFrameChecked ();
577
+ const auto columns = column.empty () ? ColumnNames_t () : ColumnNames_t ({std::string (column)});
578
+ const auto validColumnNames = GetValidatedColumnNames (*loopManager, 1 , columns);
583
579
using Helper_t = TDFInternal::TakeHelper<T, COLL>;
584
580
using Action_t = TDFInternal::TAction<Helper_t, Proxied>;
585
- df->Book (std::make_shared<Action_t>(Helper_t (valuesPtr, nSlots), bl, *fProxiedPtr ));
586
- return MakeResultProxy (valuesPtr, df);
581
+ auto valuesPtr = std::make_shared<COLL>();
582
+ const auto nSlots = loopManager->GetNSlots ();
583
+ loopManager->Book (std::make_shared<Action_t>(Helper_t (valuesPtr, nSlots), validColumnNames, *fProxiedPtr ));
584
+ return MakeResultProxy (valuesPtr, loopManager);
587
585
}
588
586
589
587
// //////////////////////////////////////////////////////////////////////////
0 commit comments