Skip to content

Commit da9e29f

Browse files
committed
Get rid of customization (clunky)
1 parent 580766b commit da9e29f

File tree

5 files changed

+2
-68
lines changed

5 files changed

+2
-68
lines changed

examples/example-03.cxx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ int main() {
6464
// :(
6565

6666
auto n_f_best =
67-
df.define(column::definition<Factorial>(20), column::customization([](Factorial* n_f_best){n_f_best->change_threshold(10);}))(n, n_f_fast, n_f_full);
67+
df.define(column::definition<Factorial>(n_threshold))(n, n_f_fast, n_f_full);
6868
// time elapsed = t(n) + { t(n_fast) if n >= 10, t(n_slow) if n < 10 }
6969
// :)
7070
}

include/queryosity/column.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -172,8 +172,6 @@ template <typename T> struct constant;
172172

173173
template <typename T> struct expression;
174174

175-
template <typename T> struct customization;
176-
177175
template <typename T> struct series;
178176

179177
template <typename T>

include/queryosity/column_customization.h

Lines changed: 0 additions & 24 deletions
This file was deleted.

include/queryosity/column_evaluator.h

Lines changed: 1 addition & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55
#include <type_traits>
66

77
#include "action.h"
8-
#include "column_customization.h"
98

109
namespace queryosity {
1110

@@ -20,14 +19,11 @@ template <typename T> class evaluator {
2019
template <typename... Args> evaluator(Args const &...args);
2120
virtual ~evaluator() = default;
2221

23-
void patch(std::function<void(T *)> fn);
24-
2522
template <typename... Vals>
2623
std::unique_ptr<T> evaluate(view<Vals> const &...cols) const;
2724

2825
protected:
2926
std::function<std::unique_ptr<T>()> m_make;
30-
std::function<void(T *)> m_patch;
3127
};
3228
} // namespace column
3329

@@ -36,22 +32,13 @@ template <typename T> class evaluator {
3632
template <typename T>
3733
template <typename... Args>
3834
queryosity::column::evaluator<T>::evaluator(Args const &...args)
39-
: m_make(std::bind(
40-
[](Args const &...args) { return std::make_unique<T>(args...); },
41-
args...)),
42-
m_patch([](T *) {}) {}
43-
44-
template <typename T>
45-
void queryosity::column::evaluator<T>::patch(std::function<void(T *)> fn) {
46-
m_patch = std::move(fn);
47-
}
35+
: m_make([args...]() { return std::make_unique<T>(args...); }) {}
4836

4937
template <typename T>
5038
template <typename... Vals>
5139
std::unique_ptr<T>
5240
queryosity::column::evaluator<T>::evaluate(view<Vals> const &...columns) const {
5341
auto defn = m_make();
54-
this->m_patch(defn.get());
5542
defn->set_arguments(columns...);
5643
return defn;
5744
}

include/queryosity/dataflow.h

Lines changed: 0 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -133,21 +133,6 @@ class dataflow {
133133
auto define(column::definition<Def> const &defn)
134134
-> todo<column::evaluator<Def>>;
135135

136-
/**
137-
* @brief Define a column using an expression.
138-
* @tparam Def Custom definition.
139-
* @tparam Fn Custom patch. It *must* be a void function whose sole argument is `Def*`.
140-
* @param[in] defn Definition type and constructor arguments.
141-
* @param[in] patch Patch function to run on the created instance(s) of column definition.
142-
* @detail The patch function can be used to access any public member
143-
* variables and/or functions of a custom column definition to "configure" it
144-
* beyond constructor arguments.
145-
* @return Evaluator.
146-
*/
147-
template <typename Def, typename Fn>
148-
auto define(column::definition<Def> const &defn, column::customization<Fn> const& patch)
149-
-> todo<column::evaluator<Def>>;
150-
151136
/**
152137
* @brief Select all entries.
153138
* @return Lazy selection with cut passing for all entries and weight equal to
@@ -496,18 +481,6 @@ auto queryosity::dataflow::define(column::definition<Def> const &defn)
496481
return this->_define(defn);
497482
}
498483

499-
template <typename Def, typename Fn>
500-
auto queryosity::dataflow::define(column::definition<Def> const &defn, column::customization<Fn> const& custom)
501-
-> todo<column::evaluator<Def>> {
502-
auto eval = this->_define(defn);
503-
ensemble::invoke(
504-
[&custom](column::evaluator<Def> *eval) {
505-
custom.patch(eval);
506-
},
507-
eval.get_slots());
508-
return eval;
509-
}
510-
511484
template <typename Col>
512485
auto queryosity::dataflow::filter(lazy<Col> const &col)
513486
-> lazy<selection::node> {

0 commit comments

Comments
 (0)