Skip to content

Commit

Permalink
Cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
taehyounpark committed Apr 9, 2024
1 parent 4e694ea commit 293ee1d
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 31 deletions.
14 changes: 2 additions & 12 deletions include/queryosity/column_equation.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,36 +17,26 @@ class equation<Out(Ins...)> : public definition<Out(Ins...)> {
std::function<std::decay_t<Out>(std::decay_t<Ins> const &...)>;

public:
template <typename Fn> equation(Fn fn);
template <typename Fn> equation(Fn&& fn);
virtual ~equation() = default;

public:
virtual Out evaluate(observable<Ins>... args) const override;

protected:
vartuple_type m_arguments;
function_type m_evaluate;
};

template <typename Fn>
auto make_equation(Fn fn) -> std::unique_ptr<column::equation_t<Fn>>;

} // namespace column

} // namespace queryosity

template <typename Out, typename... Ins>
template <typename Fn>
queryosity::column::equation<Out(Ins...)>::equation(Fn fn) : m_evaluate(fn) {}
queryosity::column::equation<Out(Ins...)>::equation(Fn&& fn) : m_evaluate(std::forward<Fn>(fn)) {}

template <typename Out, typename... Ins>
Out queryosity::column::equation<Out(Ins...)>::evaluate(
observable<Ins>... args) const {
return this->m_evaluate(args.value()...);
}

template <typename Fn>
auto queryosity::column::make_equation(Fn fn)
-> std::unique_ptr<queryosity::column::equation_t<Fn>> {
return std::make_unique<queryosity::column::equation_t<Fn>>(fn);
}
2 changes: 1 addition & 1 deletion include/queryosity/column_expression.h
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ template <typename Expr> struct expression {

template <typename Expr>
queryosity::column::expression<Expr>::expression(Expr expr)
: m_expression(expr) {}
: m_expression(std::move(expr)) {}

template <typename Expr>
auto queryosity::column::expression<Expr>::_equate(
Expand Down
19 changes: 1 addition & 18 deletions include/queryosity/dataflow.h
Original file line number Diff line number Diff line change
Expand Up @@ -133,13 +133,6 @@ class dataflow {
auto define(column::definition<Def> const &defn)
-> todo<column::evaluator<Def>>;

/**
* @brief Select all entries.
* @return Lazy selection with cut passing for all entries and weight equal to
* unity.
*/
auto all() -> lazy<selection::node>;

/**
* @brief Initiate a cutflow.
* @tparam Col Column type.
Expand Down Expand Up @@ -344,8 +337,6 @@ class dataflow {
std::vector<std::unique_ptr<dataset::source>> m_sources;
std::vector<unsigned int> m_dslots;

std::unique_ptr<lazy<selection::node>> m_all;

bool m_analyzed;
};

Expand Down Expand Up @@ -395,7 +386,7 @@ class dataflow::node {

inline queryosity::dataflow::dataflow()
: m_processor(multithread::disable()), m_weight(1.0), m_nrows(-1),
m_all(nullptr), m_analyzed(false) {}
m_analyzed(false) {}

template <typename Kwd>
queryosity::dataflow::dataflow(Kwd &&kwarg) : dataflow() {
Expand Down Expand Up @@ -511,14 +502,6 @@ template <typename Col> auto queryosity::dataflow::weight(Col const &col) {
return syst;
}

inline auto queryosity::dataflow::all() -> lazy<selection::node> {
if (!m_all) {
m_all = std::make_unique<lazy<selection::node>>(
this->filter(column::constant(true)));
}
return *m_all;
}

template <typename Fn, typename... Cols>
auto queryosity::dataflow::filter(column::constant<Fn> const &cnst)
-> lazy<selection::node> {
Expand Down

0 comments on commit 293ee1d

Please sign in to comment.