| 31 | } |
| 32 | |
| 33 | IProcessor::Status FinalSampleTransform::prepare() |
| 34 | { |
| 35 | auto & output = outputs.front(); |
| 36 | |
| 37 | /// Check can output. |
| 38 | if (output.isFinished() || stop_reading) |
| 39 | { |
| 40 | output.finish(); |
| 41 | for (auto & input : inputs) |
| 42 | input.close(); |
| 43 | |
| 44 | if (has_output && output_chunk) |
| 45 | { |
| 46 | output.push(std::move(output_chunk)); |
| 47 | has_output = false; |
| 48 | } |
| 49 | |
| 50 | return Status::Finished; |
| 51 | } |
| 52 | |
| 53 | if (!output.canPush()) |
| 54 | { |
| 55 | for (auto & input : inputs) |
| 56 | input.setNotNeeded(); |
| 57 | return Status::PortFull; |
| 58 | } |
| 59 | |
| 60 | /// Output if has data. |
| 61 | if (has_output) |
| 62 | { |
| 63 | output.push(std::move(output_chunk)); |
| 64 | has_output = false; |
| 65 | |
| 66 | return Status::PortFull; |
| 67 | } |
| 68 | |
| 69 | if (has_input) |
| 70 | return Status::Ready; |
| 71 | |
| 72 | bool all_inputs_finished = true; |
| 73 | for (auto & input: inputs) |
| 74 | { |
| 75 | if (!input.isFinished()) |
| 76 | { |
| 77 | all_inputs_finished = false; |
| 78 | break; |
| 79 | } |
| 80 | } |
| 81 | if (all_inputs_finished) |
| 82 | { |
| 83 | output.finish(); |
| 84 | return Status::Finished; |
| 85 | } |
| 86 | |
| 87 | for (auto & input: inputs) |
| 88 | { |
| 89 | input.setNeeded(); |
| 90 | if (input.hasData()) |
nothing calls this directly
no test coverage detected