|
|
@ -9,7 +9,21 @@ namespace gp { |
|
|
|
class self_filling_channel{ |
|
|
|
error_function on_error; |
|
|
|
pop_function filler; |
|
|
|
public: |
|
|
|
|
|
|
|
gp::buffer<char>::associated_iterator push(gp::buffer<char> input) { |
|
|
|
return filler(input); |
|
|
|
} |
|
|
|
gp::buffer<char>::associated_iterator pop(gp::buffer<char> dest) { |
|
|
|
on_error(); |
|
|
|
return dest.begin(); |
|
|
|
} |
|
|
|
}; |
|
|
|
|
|
|
|
template<typename error_function, typename push_function> |
|
|
|
class input_channel{ |
|
|
|
error_function on_error; |
|
|
|
push_function filler; |
|
|
|
|
|
|
|
gp::buffer<char>::associated_iterator push(gp::buffer<char> input) { |
|
|
|
on_error(); |
|
|
|
return input.begin(); |
|
|
|