5 #if !defined(RXCPP_RX_GROUPED_OBSERVABLE_HPP) 6 #define RXCPP_RX_GROUPED_OBSERVABLE_HPP 14 template<
class K,
class Source>
15 struct has_on_get_key_for
19 static auto check(
int) -> decltype((*(CS*)
nullptr).on_get_key());
21 static not_void check(...);
23 typedef decltype(check<Source>(0)) detail_result;
24 static const bool value = std::is_same<detail_result, rxu::decay_t<K>>::value;
29 template<
class K,
class T>
39 :
public std::enable_shared_from_this<state_type>
41 typedef std::function<key_type()> ongetkey_type;
43 ongetkey_type on_get_key;
45 std::shared_ptr<state_type> state;
47 template<
class U,
class V>
50 template<
class U,
class V>
55 template<
class U,
class V>
57 state = std::move(o.state);
62 auto so = std::make_shared<rxu::decay_t<SO>>(std::forward<SO>(source));
63 state->on_get_key = [so]()
mutable {
64 return so->on_get_key();
77 , state(std::make_shared<state_type>())
79 construct(std::move(sof),
83 template<
class SF,
class CF>
86 , state(std::make_shared<state_type>())
88 state->on_connect = std::forward<CF>(cf);
94 return state->on_get_key();
98 template<
class K,
class T>
100 return lhs.state == rhs.state;
102 template<
class K,
class T>
104 return !(lhs == rhs);
107 template<
class K,
class T,
class Source>
120 template<
class K,
class T,
class SourceOperator>
128 static_assert(detail::has_on_get_key_for<K, source_operator_type>::value,
"inner must have on_get_key method key_type()");
143 : base_type(std::move(o))
155 : base_type(std::move(o))
166 return base_type::source_operator.on_get_key();
177 template<
class K,
class T,
class SourceOperator,
class OperatorFactory>
179 -> decltype(source.op(std::forward<OperatorFactory>(of))) {
180 return source.op(std::forward<OperatorFactory>(of));
187 template<
class K,
class T,
class SourceOperator,
class OperatorFactory>
189 -> decltype(source.op(std::forward<OperatorFactory>(of))) {
190 return source.op(std::forward<OperatorFactory>(of));
grouped_observable(SourceOperator &&o)
Definition: rx-grouped_observable.hpp:142
key_type get_key() const
Definition: rx-grouped_observable.hpp:165
Definition: rx-grouped_observable.hpp:30
a source of observables which each emit values from one category specified by the key selector...
Definition: rx-grouped_observable.hpp:121
Definition: rx-all.hpp:26
rxu::decay_t< K > key_type
Definition: rx-grouped_observable.hpp:34
tag_dynamic_grouped_observable dynamic_observable_tag
Definition: rx-grouped_observable.hpp:35
rxu::decay_t< K > key_type
Definition: rx-grouped_observable.hpp:128
auto operator|(const rxcpp::grouped_observable< K, T, SourceOperator > &source, OperatorFactory &&of) -> decltype(source.op(std::forward< OperatorFactory >(of)))
Definition: rx-grouped_observable.hpp:188
grouped_observable(grouped_observable< K, T, SO > &&o)
Definition: rx-grouped_observable.hpp:154
dynamic_grouped_observable(SF &&sf, CF &&cf)
Definition: rx-grouped_observable.hpp:84
typename std::decay< T >::type decay_t
Definition: rx-util.hpp:36
Definition: rx-predef.hpp:232
Definition: rx-sources.hpp:15
Definition: rx-observable.hpp:36
Definition: rx-predef.hpp:235
grouped_observable< K, T > make_dynamic_grouped_observable(Source &&s)
Definition: rx-grouped_observable.hpp:108
a source of values. subscribe or use one of the operator methods that return a new observable...
Definition: rx-observable.hpp:510
grouped_observable< K, T > as_dynamic() const
Definition: rx-grouped_observable.hpp:161
grouped_observable(const grouped_observable< K, T, SO > &o)
Definition: rx-grouped_observable.hpp:149
bool operator!=(const dynamic_grouped_observable< K, T > &lhs, const dynamic_grouped_observable< K, T > &rhs)
Definition: rx-grouped_observable.hpp:103
grouped_observable()
Definition: rx-grouped_observable.hpp:134
bool operator==(const dynamic_grouped_observable< K, T > &lhs, const dynamic_grouped_observable< K, T > &rhs)
Definition: rx-grouped_observable.hpp:99
Definition: rx-predef.hpp:257
auto operator>>(const rxcpp::grouped_observable< K, T, SourceOperator > &source, OperatorFactory &&of) -> decltype(source.op(std::forward< OperatorFactory >(of)))
Definition: rx-grouped_observable.hpp:178
tag_grouped_observable observable_tag
Definition: rx-grouped_observable.hpp:132
dynamic_grouped_observable(SOF sof)
Definition: rx-grouped_observable.hpp:75
dynamic_grouped_observable()
Definition: rx-grouped_observable.hpp:70
key_type on_get_key() const
Definition: rx-grouped_observable.hpp:93
grouped_observable(const SourceOperator &o)
Definition: rx-grouped_observable.hpp:138