| 133 | } |
| 134 | |
| 135 | ISimpleTransform::Status ExplainAnalyzeTransform::prepare() |
| 136 | { |
| 137 | /// Check can output. |
| 138 | |
| 139 | if (output.isFinished()) |
| 140 | { |
| 141 | input.close(); |
| 142 | return Status::Finished; |
| 143 | } |
| 144 | |
| 145 | if (!output.canPush()) |
| 146 | { |
| 147 | input.setNotNeeded(); |
| 148 | return Status::PortFull; |
| 149 | } |
| 150 | |
| 151 | /// Output if has data. |
| 152 | if (has_output) |
| 153 | { |
| 154 | output.pushData(std::move(output_data)); |
| 155 | has_output = false; |
| 156 | |
| 157 | if (!no_more_data_needed) |
| 158 | return Status::PortFull; |
| 159 | } |
| 160 | |
| 161 | /// Stop if don't need more data. |
| 162 | if (no_more_data_needed) |
| 163 | { |
| 164 | input.close(); |
| 165 | output.finish(); |
| 166 | return Status::Finished; |
| 167 | } |
| 168 | |
| 169 | /// Check can input. |
| 170 | if (!has_input) |
| 171 | { |
| 172 | if (input.isFinished()) |
| 173 | { |
| 174 | if (has_final_transform) |
| 175 | return Status::Ready; |
| 176 | output.finish(); |
| 177 | return Status::Finished; |
| 178 | } |
| 179 | |
| 180 | input.setNeeded(); |
| 181 | |
| 182 | if (!input.hasData()) |
| 183 | return Status::NeedData; |
| 184 | |
| 185 | input_data = input.pullData(set_input_not_needed_after_read); |
| 186 | has_input = true; |
| 187 | |
| 188 | if (input_data.exception) |
| 189 | /// No more data needed. Exception will be thrown (or swallowed) later. |
| 190 | input.setNotNeeded(); |
| 191 | } |
| 192 |
nothing calls this directly
no test coverage detected