13#include <rpp/defs.hpp>
14#include <rpp/observables/specific_observable.hpp>
15#include <rpp/utils/operator_declaration.hpp>
19IMPLEMENTATION_FILE(dynamic_observable_tag);
23template<constra
int::decayed_type Type>
27 template<constra
int::observable_of_type<Type> TObs>
29 : m_impl{std::make_shared<dynamic_observable_state_impl<std::decay_t<TObs>>>(std::forward<TObs>(obs))} {}
31 template<constra
int::on_subscribe_fn<Type> TOnSub>
32 requires (!constraint::decayed_same_as<TOnSub, dynamic_observable_state<Type>>)
34 : m_impl{ std::make_shared<dynamic_observable_state_impl<specific_observable<Type, std::decay_t<TOnSub>>>>(std::forward<TOnSub>(on_sub)) } {}
43 return (*m_impl)(subscriber);
46 struct interface_dynamic_observable_state_impl
48 virtual ~interface_dynamic_observable_state_impl() =
default;
53 template<constra
int::observable TObs>
54 class dynamic_observable_state_impl final :
public interface_dynamic_observable_state_impl
57 dynamic_observable_state_impl(TObs&& observable)
58 : m_observable{std::move(observable)} {}
60 dynamic_observable_state_impl(
const TObs& observable)
61 : m_observable{observable} {}
65 return m_observable.subscribe(subscriber);
69 RPP_NO_UNIQUE_ADDRESS TObs m_observable{};
72 std::shared_ptr<interface_dynamic_observable_state_impl> m_impl{};
87template<constra
int::decayed_type Type>
95 :
base{std::forward<decltype(on_subscribe)>(on_subscribe)} {}
97 template<constra
int::observable_of_type<Type> TObs>
100 :
base{std::forward<TObs>(observable)} {}
103template<constra
int::observable TObs>
106template<
typename OnSub>
rpp::subscription_base with ability to add some dependent subscriptions as a part of this one: in cas...
Definition: composite_subscription.hpp:30
Definition: dynamic_observable.hpp:25
Type-less observable (or partially untyped) that has the notion of Type but hides the notion of on_su...
Definition: dynamic_observable.hpp:89
subscriber which uses dynamic_observer<T> to hide original callbacks
Definition: dynamic_subscriber.hpp:24
Type-full observable (or typed) that has the notion of Type and upstream observables for C++ compiler...
Definition: specific_observable.hpp:39