Filtering operators are operators that emit only part of items that satisfies some condition. More...
Functions | |
template<std::equivalence_relation< Type, Type > EqualityFn = std::equal_to<Type>> requires is_header_included<distinct_until_changed_tag, EqualityFn> | |
auto | observable::distinct_until_changed (EqualityFn &&equality_fn=EqualityFn{}) const & |
Suppress consecutive duplicates of emissions from original observable. | |
template<std::predicate< const Type & > Predicate> requires is_header_included<filter_tag, Predicate> | |
auto | observable::filter (Predicate &&predicate) const & |
Emit only those items from an Observable that satisfies a provided predicate. | |
auto | observable::first () const & |
emit only the first item. | |
auto | observable::last () const & |
Emit only the last item provided before on_completed. | |
template<schedulers::constraint::scheduler TScheduler, typename ... Args> requires is_header_included<sample_tag, TScheduler, Args...> | |
auto | observable::sample_with_time (schedulers::duration period, const TScheduler &scheduler) const & |
Emit most recent emitted from original observable emission obtained during last period of time. | |
template<typename... Args> requires is_header_included<skip_tag, Args...> | |
auto | observable::skip (size_t count) const & |
Skip first count items provided by observable then send rest items as expected. | |
template<typename... Args> requires is_header_included<take_tag, Args...> | |
auto | observable::take (size_t count) const & |
Emit only first count items provided by observable, then send on_completed | |
template<typename ... Args> requires is_header_included<take_last_tag, Args...> | |
auto | observable::take_last (size_t count) const & |
Emit only last count items provided by observable, then send on_completed | |
Filtering operators are operators that emit only part of items that satisfies some condition.
|
inline |
Suppress consecutive duplicates of emissions from original observable.
Actually this operator has std::optional
with last item and checks everytime where new emission is same or not.
equality_fn | optional equality comparator function |
shared_ptr
to store last emission
|
inline |
Emit only those items from an Observable that satisfies a provided predicate.
Actually this operator just checks if predicate returns true, then forwards emission
predicate | is predicate used to check emitted items. true -> items satisfies condition, false -> not |
|
inline |
emit only the first item.
Actually this operator is take(1)
with exception during on_completed
if no any emision happens. So, it just forwards first obtained emission and emits on_completed immediately
rpp::utils::not_enough_emissions | in case of on_completed obtained without any emissions |
shared_ptr
to keep internal state
|
inline |
Emit only the last item provided before on_completed.
Actually this operator just updates std::optional
on every new emission and emits this value on_completed
rpp::utils::not_enough_emissions | in case of on_completed obtained without any emissions |
shared_ptr
to keep std::optional
std::optional
|
inline |
Emit most recent emitted from original observable emission obtained during last period of time.
Emit item immediately in case of completion of the original observable
Actually operator just schedules periodical action and on each schedulable execution just emits last emitted emission (if any)
period | sampling period \scheduler scheduler to use to schedule emissions with provided sampling period |
shared_ptr
to store last emitted value
|
inline |
Skip first count
items provided by observable then send rest items as expected.
Actually this operator just decrements counter and starts to forward emissions when counter reaches zero.
count | amount of items to be skipped |
shared_ptr
to store counter
|
inline |
Emit only first count
items provided by observable, then send on_completed
Actually this operator just emits emissions while counter is not zero and decrements counter on each emission
count | amount of items to be emitted. 0 - instant complete |
shared_ptr
to store counter
|
inline |
Emit only last count
items provided by observable, then send on_completed
Actually this operator has buffer of requested size inside, keeps last count
values and emit stored values on on_completed
count | amount of last items to be emitted |
shared_ptr
to store internal buffer