Skip to content

Commit

Permalink
final override
Browse files Browse the repository at this point in the history
  • Loading branch information
taehyounpark committed Apr 9, 2024
1 parent 7ceba7d commit e126b61
Show file tree
Hide file tree
Showing 7 changed files with 77 additions and 17 deletions.
23 changes: 22 additions & 1 deletion include/queryosity/column_equation.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,12 @@ class equation<Out(Ins...)> : public definition<Out(Ins...)> {
virtual ~equation() = default;

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

virtual void initialize(unsigned int slot, unsigned long long begin,
unsigned long long end) final override;
virtual void execute(unsigned int slot, unsigned long long entry) final override;
virtual void finalize(unsigned int slot) final override;

protected:
function_type m_evaluate;
Expand All @@ -39,4 +44,20 @@ template <typename Out, typename... Ins>
Out queryosity::column::equation<Out(Ins...)>::evaluate(
observable<Ins>... args) const {
return this->m_evaluate(args.value()...);
}

template <typename Out, typename... Ins>
void queryosity::column::equation<Out(Ins...)>::initialize(unsigned int slot, unsigned long long begin,
unsigned long long end) {
calculation<Out>::initialize(slot, begin, end);
}

template <typename Out, typename... Ins>
void queryosity::column::equation<Out(Ins...)>::execute(unsigned int slot, unsigned long long entry) {
calculation<Out>::execute(slot, entry);
}

template <typename Out, typename... Ins>
void queryosity::column::equation<Out(Ins...)>::finalize(unsigned int slot) {
calculation<Out>::finalize(slot);
}
23 changes: 22 additions & 1 deletion include/queryosity/column_fixed.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,12 @@ template <typename Val> class column::fixed : public valued<Val> {
template <typename... Args> fixed(Args &&...args);
virtual ~fixed() = default;

const Val &value() const override;
const Val &value() const final override;

virtual void initialize(unsigned int slot, unsigned long long begin,
unsigned long long end) final override;
virtual void execute(unsigned int slot, unsigned long long entry) final override;
virtual void finalize(unsigned int slot) final override;

protected:
Val m_value;
Expand All @@ -33,4 +38,20 @@ queryosity::column::fixed<Val>::fixed(Args &&...args)
template <typename Val>
const Val &queryosity::column::fixed<Val>::value() const {
return m_value;
}

template <typename Val>
void queryosity::column::fixed<Val>::initialize(unsigned int slot, unsigned long long begin,
unsigned long long end) {
valued<Val>::initialize(slot, begin, end);
}

template <typename Val>
void queryosity::column::fixed<Val>::execute(unsigned int slot, unsigned long long entry) {
valued<Val>::execute(slot, entry);
}

template <typename Val>
void queryosity::column::fixed<Val>::finalize(unsigned int slot) {
valued<Val>::finalize(slot);
}
10 changes: 5 additions & 5 deletions include/queryosity/query_series.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,11 @@ template <typename T> class series : public queryosity::query::definition<std::v
series() = default;
~series() = default;

virtual void initialize(unsigned int, unsigned long long, unsigned long long) override;
virtual void fill(column::observable<T>, double) override;
virtual void finalize(unsigned int) override;
virtual std::vector<T> result() const override;
virtual std::vector<T> merge(std::vector<std::vector<T>> const &results) const override;
virtual void initialize(unsigned int, unsigned long long, unsigned long long) final override;
virtual void fill(column::observable<T>, double) final override;
virtual void finalize(unsigned int) final override;
virtual std::vector<T> result() const final override;
virtual std::vector<T> merge(std::vector<std::vector<T>> const &results) const final override;

protected:
std::vector<T> m_result;
Expand Down
18 changes: 18 additions & 0 deletions include/queryosity/selection.h
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,11 @@ class node : public column::calculation<double> {
virtual bool passed_cut() const = 0;
virtual double get_weight() const = 0;

virtual void initialize(unsigned int slot, unsigned long long begin,
unsigned long long end) final override;
virtual void execute(unsigned int slot, unsigned long long entry) final override;
virtual void finalize(unsigned int slot) final override;

protected:
const selection::node *const m_preselection;
column::variable<double> m_decision;
Expand Down Expand Up @@ -75,4 +80,17 @@ inline bool queryosity::selection::node::is_initial() const noexcept {
inline const queryosity::selection::node *
queryosity::selection::node::get_previous() const noexcept {
return m_preselection;
}

inline void queryosity::selection::node::initialize(unsigned int slot, unsigned long long begin,
unsigned long long end) {
column::calculation<double>::initialize(slot, begin, end);
}

inline void queryosity::selection::node::execute(unsigned int slot, unsigned long long entry) {
column::calculation<double>::execute(slot, entry);
}

inline void queryosity::selection::node::finalize(unsigned int slot) {
column::calculation<double>::finalize(slot);
}
6 changes: 3 additions & 3 deletions include/queryosity/selection_cut.h
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@ class selection::cut : public selection::node {
virtual ~cut() = default;

public:
virtual double calculate() const override;
virtual bool passed_cut() const override;
virtual double get_weight() const override;
virtual double calculate() const final override;
virtual bool passed_cut() const final override;
virtual double get_weight() const final override;
};

} // namespace queryosity
Expand Down
6 changes: 3 additions & 3 deletions include/queryosity/selection_weight.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,9 @@ class selection::weight : public selection::node {
virtual ~weight() = default;

public:
virtual double calculate() const override;
virtual bool passed_cut() const override;
virtual double get_weight() const override;
virtual double calculate() const final override;
virtual bool passed_cut() const final override;
virtual double get_weight() const final override;
};

} // namespace queryosity
Expand Down
8 changes: 4 additions & 4 deletions include/queryosity/selection_yield.h
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,10 @@ class counter : public query::aggregation<count_t> {
counter() = default;
virtual ~counter() = default;

virtual void count(double w) override;
virtual count_t result() const override;
virtual void finalize(unsigned int) override;
virtual count_t merge(std::vector<count_t> const &results) const override;
virtual void count(double w) final override;
virtual count_t result() const final override;
virtual void finalize(unsigned int) final override;
virtual count_t merge(std::vector<count_t> const &results) const final override;

protected:
count_t m_cnt;
Expand Down

0 comments on commit e126b61

Please sign in to comment.