3#ifndef MSD_CHANNEL_BLOCKING_ITERATOR_HPP_
4#define MSD_CHANNEL_BLOCKING_ITERATOR_HPP_
21template <
typename Channel>
32 using reference =
const typename Channel::value_type&;
61#pragma warning(disable : 4702)
64 bool is_end =
false) noexcept(std::is_nothrow_default_constructible<
value_type>::value &&
65 std::is_nothrow_move_assignable<
value_type>::value)
66 : chan_{&chan}, is_end_{is_end}
68 if (!is_end_ && !chan_->read(value_)) {
83#pragma warning(disable : 4702)
87 if (!chan_->read(value_)) {
125template <
typename Channel>
210template <
typename Channel>
blocking_writer_iterator< Channel > back_inserter(Channel &chan)
Creates a blocking iterator for the given channel.
Definition blocking_iterator.hpp:211
std::ptrdiff_t difference_type
Signed integral type for iterator difference.
Definition blocking_iterator.hpp:42
reference operator*()
Returns the latest element retrieved from the channel.
Definition blocking_iterator.hpp:101
const value_type * pointer
Pointer type to the value_type.
Definition blocking_iterator.hpp:47
const typename Channel::value_type & reference
Constant reference to the type of the elements stored in the channel.
Definition blocking_iterator.hpp:32
bool operator!=(const blocking_iterator &other)
Makes iteration continue until the channel is closed and empty.
Definition blocking_iterator.hpp:110
std::input_iterator_tag iterator_category
Supporting single-pass reading of elements.
Definition blocking_iterator.hpp:37
blocking_iterator(Channel &chan, bool is_end=false) noexcept(std::is_nothrow_default_constructible< value_type >::value &&std::is_nothrow_move_assignable< value_type >::value)
Constructs a blocking iterator from a channel reference.
Definition blocking_iterator.hpp:63
blocking_iterator< Channel > & operator++() noexcept(std::is_nothrow_move_assignable< value_type >::value)
Retrieves the next element from the channel.
Definition blocking_iterator.hpp:85
typename Channel::value_type value_type
The type of the elements stored in the channel.
Definition blocking_iterator.hpp:27
An output iterator pushes elements into a channel. Blocking until the channel is not full.
Definition blocking_iterator.hpp:126
const value_type & reference
Constant reference to the type of the elements stored in the channel.
Definition blocking_iterator.hpp:136
blocking_writer_iterator operator++(int)
Not applicable (handled by operator=).
Definition blocking_iterator.hpp:197
blocking_writer_iterator & operator++()
Not applicable (handled by operator=).
Definition blocking_iterator.hpp:190
std::output_iterator_tag iterator_category
Supporting writing of elements.
Definition blocking_iterator.hpp:141
blocking_writer_iterator & operator=(reference value)
Writes an element into the channel, blocking until space is available.
Definition blocking_iterator.hpp:167
blocking_writer_iterator & operator*()
Not applicable (handled by operator=).
Definition blocking_iterator.hpp:183
typename Channel::value_type value_type
The type of the elements stored in the channel.
Definition blocking_iterator.hpp:131
std::ptrdiff_t difference_type
Signed integral type for iterator difference.
Definition blocking_iterator.hpp:146
blocking_writer_iterator(Channel &chan)
Constructs a blocking iterator from a channel reference.
Definition blocking_iterator.hpp:158
const value_type * pointer
Pointer type to the value_type.
Definition blocking_iterator.hpp:151