| 22 | |
| 23 | |
| 24 | IntersectOrExceptTransform::Status IntersectOrExceptTransform::prepare() |
| 25 | { |
| 26 | auto & output = outputs.front(); |
| 27 | |
| 28 | if (output.isFinished()) |
| 29 | { |
| 30 | for (auto & in : inputs) |
| 31 | in.close(); |
| 32 | |
| 33 | return Status::Finished; |
| 34 | } |
| 35 | |
| 36 | if (!output.canPush()) |
| 37 | { |
| 38 | for (auto & input : inputs) |
| 39 | input.setNotNeeded(); |
| 40 | |
| 41 | return Status::PortFull; |
| 42 | } |
| 43 | |
| 44 | if (current_output_chunk) |
| 45 | { |
| 46 | output.push(std::move(current_output_chunk)); |
| 47 | } |
| 48 | |
| 49 | if (finished_second_input) |
| 50 | { |
| 51 | if (inputs.front().isFinished()) |
| 52 | { |
| 53 | output.finish(); |
| 54 | return Status::Finished; |
| 55 | } |
| 56 | } |
| 57 | else if (inputs.back().isFinished()) |
| 58 | { |
| 59 | finished_second_input = true; |
| 60 | } |
| 61 | |
| 62 | if (!has_input) |
| 63 | { |
| 64 | InputPort & input = finished_second_input ? inputs.front() : inputs.back(); |
| 65 | |
| 66 | input.setNeeded(); |
| 67 | if (!input.hasData()) |
| 68 | return Status::NeedData; |
| 69 | |
| 70 | current_input_chunk = input.pull(); |
| 71 | has_input = true; |
| 72 | } |
| 73 | |
| 74 | return Status::Ready; |
| 75 | } |
| 76 | |
| 77 | |
| 78 | void IntersectOrExceptTransform::work() |
nothing calls this directly
no test coverage detected