| 280 | } |
| 281 | |
| 282 | IProcessor::Status SortingTransform::prepareGenerate() |
| 283 | { |
| 284 | auto & output = outputs.front(); |
| 285 | |
| 286 | if (output.isFinished()) |
| 287 | { |
| 288 | for (auto & input : inputs) |
| 289 | input.close(); |
| 290 | |
| 291 | return Status::Finished; |
| 292 | } |
| 293 | |
| 294 | if (!output.canPush()) |
| 295 | return Status::PortFull; |
| 296 | |
| 297 | if (merge_sorter) |
| 298 | { |
| 299 | if (!generated_chunk) |
| 300 | return Status::Ready; |
| 301 | |
| 302 | output.push(std::move(generated_chunk)); |
| 303 | return Status::PortFull; |
| 304 | } |
| 305 | else |
| 306 | { |
| 307 | auto & input = inputs.back(); |
| 308 | |
| 309 | if (generated_chunk) |
| 310 | output.push(std::move(generated_chunk)); |
| 311 | |
| 312 | if (input.isFinished()) |
| 313 | { |
| 314 | output.finish(); |
| 315 | return Status::Finished; |
| 316 | } |
| 317 | |
| 318 | input.setNeeded(); |
| 319 | |
| 320 | if (!input.hasData()) |
| 321 | return Status::NeedData; |
| 322 | |
| 323 | auto chunk = input.pull(); |
| 324 | enrichChunkWithConstants(chunk); |
| 325 | output.push(std::move(chunk)); |
| 326 | return Status::PortFull; |
| 327 | } |
| 328 | } |
| 329 | |
| 330 | void SortingTransform::work() |
| 331 | { |