Skip to content

Commit

Permalink
rename to subscribe
Browse files Browse the repository at this point in the history
  • Loading branch information
SachiSakurane committed Feb 24, 2025
1 parent 356da55 commit 0e0171c
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 8 deletions.
2 changes: 1 addition & 1 deletion include/riw/notify/concepts/observable.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,6 @@ concept observable =
requires(ObservableType o,
std::weak_ptr<riw::subscription<typename ObservableType::value_type>> s) {
{ o.observe() } -> std::convertible_to<typename ObservableType::value_type>;
o.add_subscribe(s);
o.subscribe(s);
};
} // namespace riw
8 changes: 4 additions & 4 deletions include/riw/notify/connection/observable_connection.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -45,12 +45,12 @@ namespace detail {

constexpr observable_connection(O &o, F &&f) {
sub = std::make_shared<subscription_impl>(o, std::forward<F>(f));
o.add_subscribe(sub);
o.subscribe(sub);
}

operator value_type() const { return sub->observe(); }
value_type observe() const { return sub->observe(); }
void add_subscribe(std::weak_ptr<riw::subscription<value_type>> s) { sub->add_subscribe(s); }
void subscribe(std::weak_ptr<riw::subscription<value_type>> s) { sub->subscribe(s); }
std::size_t subscriptions_count() const { return sub->subscriptions_count(); }

private:
Expand Down Expand Up @@ -84,12 +84,12 @@ namespace detail {

constexpr observable_connection_r(O &&o, F &&f)
: sub{std::make_shared<subscription_impl>(std::forward<O>(o), std::forward<F>(f))} {
sub->get_observer()->add_subscribe(sub);
sub->get_observer()->subscribe(sub);
}

operator value_type() const { return sub->observe(); }
value_type observe() const { return sub->observe(); }
void add_subscribe(std::weak_ptr<riw::subscription<value_type>> s) { sub->add_subscribe(s); }
void subscribe(std::weak_ptr<riw::subscription<value_type>> s) { sub->subscribe(s); }
std::size_t subscriptions_count() const { return sub->subscriptions_count(); }

private:
Expand Down
4 changes: 2 additions & 2 deletions include/riw/notify/connection/subscription_connection.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ namespace detail {

constexpr subscription_connection(O &o, F &&f) {
sub = std::make_shared<subscription_impl>(o, std::forward<F>(f));
sub->get_observable()->get().add_subscribe(sub);
sub->get_observable()->get().subscribe(sub);
}

private:
Expand All @@ -67,7 +67,7 @@ namespace detail {

constexpr subscription_connection_r(O &&o, F &&f)
: sub{std::make_shared<subscription_impl>(std::forward<O>(o), std::forward<F>(f))} {
sub->get_observable()->add_subscribe(sub);
sub->get_observable()->subscribe(sub);
}

private:
Expand Down
2 changes: 1 addition & 1 deletion include/riw/notify/observer.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ class observer {

virtual ~observer() = default;

void add_subscribe(std::weak_ptr<subscription_type> s) {
void subscribe(std::weak_ptr<subscription_type> s) {
auto &ss = subscriptions.emplace_back(s);
if (auto l = ss.lock(); l) {
l->receive(observe());
Expand Down

0 comments on commit 0e0171c

Please sign in to comment.