20 #if !defined(RXCPP_OPERATORS_RX_RETRY_HPP) 21 #define RXCPP_OPERATORS_RX_RETRY_HPP 23 #include "../rx-includes.hpp" 33 struct retry_invalid_arguments {};
36 struct retry_invalid :
public rxo::operator_base<retry_invalid_arguments<AN...>> {
37 using type = observable<retry_invalid_arguments<
AN...>, retry_invalid<
AN...>>;
40 using retry_invalid_t =
typename retry_invalid<
AN...>::type;
44 struct event_handlers {
45 template <
typename State>
46 static inline void on_error(State& state, std::exception_ptr& e) {
49 if (state->completed_predicate()) {
50 state->out.on_error(e);
52 state->do_subscribe();
56 template <
typename State>
57 static inline void on_completed(State& state) {
58 state->out.on_completed();
63 template <
class T,
class Observable,
class Count>
64 using finite = ::rxcpp::operators::detail::retry_repeat_common::finite
65 <event_handlers, T, Observable, Count>;
68 template <
class T,
class Observable>
69 using infinite = ::rxcpp::operators::detail::retry_repeat_common::infinite
70 <event_handlers, T, Observable>;
88 template<
class Observable,
91 class Retry = rxo::detail::retry::infinite<SourceValue, rxu::decay_t<Observable>>,
95 static Result
member(Observable&& o) {
96 return Result(Retry(std::forward<Observable>(o)));
99 template<
class Observable,
103 class Retry = rxo::detail::retry::finite<SourceValue, rxu::decay_t<Observable>,
rxu::decay_t<Count>>,
107 static Result
member(Observable&& o, Count&& c) {
108 return Result(Retry(std::forward<Observable>(o), std::forward<Count>(c)));
111 template<
class...
AN>
112 static operators::detail::retry_invalid_t<
AN...>
member(
const AN&...) {
115 static_assert(
sizeof...(
AN) == 10000,
"retry takes (optional Count)");
Definition: rx-all.hpp:26
typename std::decay< T >::type::value_type value_type_t
Definition: rx-util.hpp:35
Definition: rx-operators.hpp:69
auto AN
Definition: rx-finally.hpp:105
Definition: rx-operators.hpp:339
typename std::decay< T >::type decay_t
Definition: rx-util.hpp:36
Definition: rx-operators.hpp:47
typename std::enable_if< all_true_type< BN... >::value >::type enable_if_all_true_type_t
Definition: rx-util.hpp:114
a source of values. subscribe or use one of the operator methods that return a new observable...
Definition: rx-observable.hpp:510
static Result member(Observable &&o, Count &&c)
Definition: rx-retry.hpp:107
auto retry(AN &&...an) -> operator_factory< retry_tag, AN... >
Retry this observable for the given number of times.
Definition: rx-retry.hpp:78
static operators::detail::retry_invalid_t< AN... > member(const AN &...)
Definition: rx-retry.hpp:112
Implementation commonalities between retry and repeat operators abstracted away from rx-retry...
static Result member(Observable &&o)
Definition: rx-retry.hpp:95