Skip to content

Commit 8d53219

Browse files
committed
Cleanup
1 parent 7acffb7 commit 8d53219

File tree

6 files changed

+99
-203
lines changed

6 files changed

+99
-203
lines changed

analogical.h

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -40,11 +40,11 @@ auto check_value(Fn const &fn, view<Args> const &...args)
4040
-> std::invoke_result_t<Fn, Args &...>;
4141

4242
template <typename Fn, typename... Args>
43-
auto invoke_node(Fn const &fn, view<Args> const &...args) -> lockstep::node<
43+
auto get_node(Fn const &fn, view<Args> const &...args) -> lockstep::node<
4444
typename std::invoke_result_t<Fn, Args &...>::element_type>;
4545

4646
template <typename Fn, typename... Args>
47-
auto invoke_view(Fn const &fn, view<Args> const &...args) -> lockstep::view<
47+
auto get_view(Fn const &fn, view<Args> const &...args) -> lockstep::view<
4848
std::remove_pointer_t<typename std::invoke_result_t<Fn, Args &...>>>;
4949

5050
template <typename Fn, typename... Args>
@@ -434,7 +434,7 @@ inline auto ana::lockstep::check_value(Fn const &fn, view<Args> const &...args)
434434
}
435435

436436
template <typename Fn, typename... Args>
437-
inline auto ana::lockstep::invoke_node(Fn const &fn, view<Args> const &...args)
437+
inline auto ana::lockstep::get_node(Fn const &fn, view<Args> const &...args)
438438
-> lockstep::node<
439439
typename std::invoke_result_t<Fn, Args &...>::element_type> {
440440
auto concurrency = check_concurrency(args...);
@@ -450,8 +450,8 @@ inline auto ana::lockstep::invoke_node(Fn const &fn, view<Args> const &...args)
450450
}
451451

452452
template <typename Fn, typename... Args>
453-
inline auto ana::lockstep::invoke_view(Fn const &fn, view<Args> const &...args)
454-
-> typename lockstep::view<
453+
inline auto ana::lockstep::get_view(Fn const &fn, view<Args> const &...args) ->
454+
typename lockstep::view<
455455
std::remove_pointer_t<typename std::invoke_result_t<Fn, Args &...>>> {
456456
auto concurrency = check_concurrency(args...);
457457
typename lockstep::view<
@@ -3620,7 +3620,7 @@ class delayed : public systematic<delayed<Bld>>, public lockstep::node<Bld> {
36203620
auto get_aggregation(const std::string &selection_path) const
36213621
-> lazy<aggregation::booked_t<V>> {
36223622
return lazy<aggregation::booked_t<V>>(
3623-
*this->m_df, lockstep::invoke_view(
3623+
*this->m_df, lockstep::get_view(
36243624
[selection_path = selection_path](V &bkpr) {
36253625
return bkpr.get_aggregation(selection_path);
36263626
},
@@ -3652,7 +3652,7 @@ class delayed : public systematic<delayed<Bld>>, public lockstep::node<Bld> {
36523652
// nominal
36533653
return delayed<V>(
36543654
*this->m_df,
3655-
lockstep::invoke_node(
3655+
lockstep::get_node(
36563656
[](V &fillable, typename Nodes::operation_type &...cols) {
36573657
return fillable.book_fill(cols...);
36583658
},
@@ -3879,7 +3879,7 @@ ana::dataset::reader<DS> ana::dataflow::open(Args &&...args) {
38793879

38803880
// open dataset reader and processor for each thread
38813881
// slot for each partition range
3882-
this->m_players = lockstep::invoke_node(
3882+
this->m_players = lockstep::get_node(
38833883
[ds](dataset::range &part) { return ds->open_player(part); },
38843884
this->m_parts.get_view());
38853885
this->m_processors = lockstep::node<dataset::processor>(

include/ana/interface/dataflow.h

Lines changed: 47 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -262,9 +262,9 @@ ana::dataset::reader<DS> ana::dataflow::open(Args &&...args) {
262262

263263
// open dataset reader and processor for each thread
264264
// slot for each partition range
265-
this->m_players = lockstep::invoke_node(
265+
this->m_players = lockstep::get_node(
266266
[ds](dataset::range &part) { return ds->open_player(part); },
267-
this->m_parts.get_view());
267+
this->m_parts);
268268
this->m_processors = lockstep::node<dataset::processor>(
269269
m_parts.concurrency(), this->m_weight / this->m_norm);
270270

@@ -274,11 +274,11 @@ ana::dataset::reader<DS> ana::dataflow::open(Args &&...args) {
274274
template <typename DS, typename Val>
275275
auto ana::dataflow::read(dataset::input<DS> &ds, const std::string &name)
276276
-> lazy<read_column_t<DS, Val>> {
277-
auto act = this->m_processors.get_lockstep_node(
277+
auto act = lockstep::get_node(
278278
[name, &ds](dataset::processor &proc, dataset::range &part) {
279279
return proc.template read<DS, Val>(std::ref(ds), part, name);
280280
},
281-
this->m_parts.get_view());
281+
this->m_processors, this->m_parts);
282282
auto lzy = lazy<read_column_t<DS, Val>>(*this, act);
283283
this->add_operation(std::move(act));
284284
return lzy;
@@ -287,10 +287,11 @@ auto ana::dataflow::read(dataset::input<DS> &ds, const std::string &name)
287287
template <typename Val>
288288
auto ana::dataflow::constant(Val const &val)
289289
-> lazy<ana::column::constant<Val>> {
290-
auto act =
291-
this->m_processors.get_lockstep_node([&val](dataset::processor &proc) {
290+
auto act = lockstep::get_node(
291+
[&val](dataset::processor &proc) {
292292
return proc.template constant<Val>(val);
293-
});
293+
},
294+
this->m_processors);
294295
auto lzy = lazy<column::constant<Val>>(*this, act);
295296
this->add_operation(std::move(act));
296297
return lzy;
@@ -299,10 +300,11 @@ auto ana::dataflow::constant(Val const &val)
299300
template <typename Val, typename... Args>
300301
auto ana::dataflow::constant(Args &&...args)
301302
-> lazy<ana::column::constant<Val>> {
302-
auto act =
303-
this->m_processors.get_lockstep_node([args...](dataset::processor &proc) {
303+
auto act = lockstep::get_node(
304+
[args...](dataset::processor &proc) {
304305
return proc.template constant<Val>(std::forward<Args>(args)...);
305-
});
306+
},
307+
this->m_processors);
306308
auto lzy = lazy<column::constant<Val>>(*this, act);
307309
this->add_operation(std::move(act));
308310
return lzy;
@@ -312,18 +314,20 @@ template <typename Def, typename... Args>
312314
auto ana::dataflow::define(Args &&...args) {
313315
return delayed<ana::column::template evaluator_t<Def>>(
314316
*this,
315-
this->m_processors.get_lockstep_node(
317+
lockstep::get_node(
316318
[&args...](dataset::processor &proc) {
317319
return proc.template define<Def>(std::forward<Args>(args)...);
318-
}));
320+
},
321+
this->m_processors));
319322
}
320323

321324
template <typename F> auto ana::dataflow::define(F const &callable) {
322325
return delayed<ana::column::template evaluator_t<F>>(
323-
*this, this->m_processors.get_lockstep_node(
324-
[callable = callable](dataset::processor &proc) {
326+
*this, lockstep::get_node(
327+
[callable](dataset::processor &proc) {
325328
return proc.template define(callable);
326-
}));
329+
},
330+
this->m_processors));
327331
}
328332

329333
inline auto ana::dataflow::filter(const std::string &name) {
@@ -364,29 +368,32 @@ template <typename Sel, typename F>
364368
auto ana::dataflow::select(const std::string &name, F callable)
365369
-> delayed<selection::template custom_applicator_t<F>> {
366370
return delayed<selection::template custom_applicator_t<F>>(
367-
*this, this->m_processors.get_lockstep_node(
368-
[name = name, callable = callable](dataset::processor &proc) {
371+
*this, lockstep::get_node(
372+
[name, callable](dataset::processor &proc) {
369373
return proc.template select<Sel>(nullptr, name, callable);
370-
}));
374+
},
375+
this->m_processors));
371376
}
372377

373378
template <typename Sel, typename F>
374379
auto ana::dataflow::channel(const std::string &name, F callable)
375380
-> delayed<selection::template custom_applicator_t<F>> {
376381
return delayed<selection::template custom_applicator_t<F>>(
377-
*this, this->m_processors.get_lockstep_node(
382+
*this, lockstep::get_node(
378383
[name = name, callable = callable](dataset::processor &proc) {
379384
return proc.template channel<Sel>(nullptr, name, callable);
380-
}));
385+
},
386+
this->m_processors));
381387
}
382388

383389
template <typename Cnt, typename... Args>
384390
auto ana::dataflow::agg(Args &&...args) -> delayed<aggregation::booker<Cnt>> {
385391
return delayed<aggregation::booker<Cnt>>(
386-
*this, this->m_processors.get_lockstep_node(
392+
*this, lockstep::get_node(
387393
[&args...](dataset::processor &proc) {
388394
return proc.template book<Cnt>(std::forward<Args>(args)...);
389-
}));
395+
},
396+
this->m_processors));
390397
}
391398

392399
template <typename Sel>
@@ -408,36 +415,36 @@ auto ana::dataflow::select(lazy<selection> const &prev, const std::string &name,
408415
F callable)
409416
-> delayed<selection::template custom_applicator_t<F>> {
410417
return delayed<selection::template custom_applicator_t<F>>(
411-
*this, this->m_processors.get_lockstep_node(
412-
[name = name, callable = callable](dataset::processor &proc,
413-
selection const &prev) {
414-
return proc.template select<Sel>(&prev, name, callable);
415-
},
416-
prev));
418+
*this,
419+
lockstep::get_node(
420+
[name, callable](dataset::processor &proc, selection const &prev) {
421+
return proc.template select<Sel>(&prev, name, callable);
422+
},
423+
this->m_processors, prev));
417424
}
418425

419426
template <typename Sel, typename F>
420427
auto ana::dataflow::channel(lazy<selection> const &prev,
421428
const std::string &name, F callable)
422429
-> delayed<selection::template custom_applicator_t<F>> {
423430
return delayed<selection::template custom_applicator_t<F>>(
424-
*this, this->m_processors.get_lockstep_node(
431+
*this, lockstep::get_node(
425432
[name = name, callable = callable](dataset::processor &proc,
426433
selection const &prev) {
427434
return proc.template channel<Sel>(&prev, name, callable);
428435
},
429-
prev));
436+
this->m_processors, prev));
430437
}
431438

432439
template <typename Def, typename... Cols>
433440
auto ana::dataflow::evaluate_column(delayed<column::evaluator<Def>> const &calc,
434441
lazy<Cols> const &...columns) -> lazy<Def> {
435-
auto act = this->m_processors.get_lockstep_node(
442+
auto act = lockstep::get_node(
436443
[](dataset::processor &proc, column::evaluator<Def> &calc,
437444
Cols const &...cols) {
438445
return proc.template evaluate_column(calc, cols...);
439446
},
440-
calc.get_view(), columns...);
447+
this->m_processors, calc, columns...);
441448
auto lzy = lazy<Def>(*this, act);
442449
this->add_operation(std::move(act));
443450
return lzy;
@@ -447,12 +454,12 @@ template <typename Eqn, typename... Cols>
447454
auto ana::dataflow::apply_selection(
448455
delayed<selection::applicator<Eqn>> const &calc,
449456
lazy<Cols> const &...columns) -> lazy<selection> {
450-
auto act = this->m_processors.get_lockstep_node(
457+
auto act = lockstep::get_node(
451458
[](dataset::processor &proc, selection::applicator<Eqn> &calc,
452459
Cols &...cols) {
453460
return proc.template apply_selection(calc, cols...);
454461
},
455-
calc.get_view(), columns...);
462+
this->m_processors, calc, columns...);
456463
auto lzy = lazy<selection>(*this, act);
457464
this->add_operation(std::move(act));
458465
return lzy;
@@ -465,10 +472,10 @@ auto ana::dataflow::select_aggregation(
465472
// any time a new aggregation is booked, means the dataflow must run: so reset
466473
// its status
467474
this->reset();
468-
auto act = this->m_processors.get_lockstep_node(
475+
auto act = lockstep::get_node(
469476
[](dataset::processor &proc, aggregation::booker<Cnt> &bkr,
470477
const selection &sel) { return proc.select_aggregation(bkr, sel); },
471-
bkr.get_view(), sel);
478+
this->m_processors, bkr, sel);
472479
auto lzy = lazy<Cnt>(*this, act);
473480
this->add_operation(std::move(act));
474481
return lzy;
@@ -484,7 +491,7 @@ auto ana::dataflow::select_aggregations(
484491

485492
using delayed_bookkeeper_type = delayed<aggregation::bookkeeper<Cnt>>;
486493
auto bkpr = delayed_bookkeeper_type(
487-
*this, this->m_processors.get_lockstep_node(
494+
*this, lockstep::get_node(
488495
[this](dataset::processor &proc, aggregation::booker<Cnt> &bkr,
489496
Sels const &...sels) {
490497
// get bookkeeper and aggregations
@@ -498,7 +505,7 @@ auto ana::dataflow::select_aggregations(
498505
// take the bookkeeper
499506
return std::move(bkpr_and_cntrs.first);
500507
},
501-
bkr.get_view(), sels...));
508+
this->m_processors, bkr, sels...));
502509
// lockstep::node<aggregation::booker<Cnt>>(bkr), sels...));
503510

504511
return bkpr;
@@ -514,11 +521,10 @@ inline void ana::dataflow::analyze() {
514521

515522
m_source->initialize();
516523

517-
this->m_processors.run_slots(
518-
this->m_mtcfg,
524+
this->m_mtcfg.run(
519525
[](dataset::processor &proc, dataset::player &plyr,
520526
const dataset::range &part) { proc.process(plyr, part); },
521-
this->m_players.get_view(), this->m_parts.get_view());
527+
this->m_processors, this->m_players, this->m_parts);
522528

523529
m_source->finalize();
524530

include/ana/interface/delayed.h

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -131,8 +131,9 @@ class delayed : public systematic::resolver<delayed<Bkr>>,
131131
std::enable_if_t<ana::aggregation::template is_bookkeeper_v<V>,
132132
bool> = false>
133133
auto list_selection_paths() const -> std::set<std::string> {
134-
return this->get_model_value(
135-
[](Bkr const &bkpr) { return bkpr.list_selection_paths(); });
134+
return lockstep::get_value(
135+
[](Bkr const &bkpr) { return bkpr.list_selection_paths(); },
136+
std::cref(*this));
136137
}
137138

138139
/**
@@ -268,7 +269,7 @@ class delayed : public systematic::resolver<delayed<Bkr>>,
268269
auto get_aggregation(const std::string &selection_path) const
269270
-> lazy<aggregation::booked_t<V>> {
270271
return lazy<aggregation::booked_t<V>>(
271-
*this->m_df, lockstep::invoke_view(
272+
*this->m_df, lockstep::get_view(
272273
[selection_path = selection_path](V &bkpr) {
273274
return bkpr.get_aggregation(selection_path);
274275
},
@@ -300,7 +301,7 @@ class delayed : public systematic::resolver<delayed<Bkr>>,
300301
// nominal
301302
return delayed<V>(
302303
*this->m_df,
303-
lockstep::invoke_node(
304+
lockstep::get_node(
304305
[](V &fillable, typename Nodes::operation_type &...cols) {
305306
return fillable.book_fill(cols...);
306307
},

include/ana/interface/lazy.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -170,8 +170,8 @@ class lazy : public systematic::resolver<lazy<Action>>,
170170
template <typename V = Action,
171171
std::enable_if_t<is_selection_v<V>, bool> = false>
172172
std::string path() const {
173-
return this->get_model_value(
174-
[](const selection &me) { return me.get_path(); });
173+
return lockstep::get_value(
174+
[](const selection &me) { return me.get_path(); }, std::cref(*this));
175175
}
176176

177177
template <typename V = Action,

0 commit comments

Comments
 (0)