1 #if !defined(FLOW_PIPE_H)
34 std::deque<std::unique_ptr<packet<T>>> d_packets;
53 :
named(name_r), d_input_p(output_p), d_output_p(input_p), d_max_length(
max_length), d_max_weight(
max_weight), d_weight(0)
57 pipe(
pipe&& pipe_rr) :
named(std::move(pipe_rr)), d_packets(std::move(pipe_rr.d_packets)), d_input_p(std::move(pipe_rr.d_input_p)), d_output_p(std::move(pipe_rr.d_output_p)),
58 d_max_length(std::move(pipe_rr.d_max_length)), d_max_weight(std::move(pipe_rr.d_max_weight)), d_weight(std::move(pipe_rr.d_weight))
78 return d_packets.size();
106 size_t previous_cap = d_max_length;
114 size_t previous_cap = d_max_weight;
122 size_t s = d_packets.size();
139 if(d_max_length && (d_packets.size() == d_max_length))
return false;
140 if(d_max_weight && (d_weight + packet_p->size() > d_max_weight))
return false;
142 d_weight += packet_p->size();
143 d_packets.push_back(std::move(packet_p));
153 virtual std::unique_ptr<packet<T>>
pop()
155 if(!d_packets.size())
return std::unique_ptr<
packet<T>>();
157 std::unique_ptr<packet<T>> packet_p(std::move(d_packets.front()));
159 d_packets.pop_front();
160 d_weight -= packet_p->size();