| 485 | |
| 486 | template<typename TDatum, typename TDatums, typename TDatumsSP, typename TWorker> |
| 487 | bool WrapperT<TDatum, TDatums, TDatumsSP, TWorker>::tryEmplace(TDatumsSP& tDatums) |
| 488 | { |
| 489 | try |
| 490 | { |
| 491 | if (!mUserWs[int(WorkerType::Input)].empty()) |
| 492 | error("Emplace cannot be called if an input worker was already selected.", |
| 493 | __LINE__, __FUNCTION__, __FILE__); |
| 494 | // tryEmplace for 1 camera |
| 495 | if (tDatums->size() < 2) |
| 496 | { |
| 497 | return mThreadManager.tryEmplace(tDatums); |
| 498 | } |
| 499 | // tryEmplace for multiview |
| 500 | else |
| 501 | { |
| 502 | bool successfulEmplace = true; |
| 503 | for (auto datumIndex = 0u; datumIndex < tDatums->size(); ++datumIndex) |
| 504 | { |
| 505 | auto tDatumsSingle = std::make_shared<TDatums>(TDatums({ tDatums->at(datumIndex) })); |
| 506 | if (!tryEmplace(tDatumsSingle)) |
| 507 | { |
| 508 | successfulEmplace = false; |
| 509 | break; |
| 510 | } |
| 511 | } |
| 512 | return successfulEmplace; |
| 513 | } |
| 514 | } |
| 515 | catch (const std::exception& e) |
| 516 | { |
| 517 | error(e.what(), __LINE__, __FUNCTION__, __FILE__); |
| 518 | return false; |
| 519 | } |
| 520 | } |
| 521 | |
| 522 | template<typename TDatum, typename TDatums, typename TDatumsSP, typename TWorker> |
| 523 | bool WrapperT<TDatum, TDatums, TDatumsSP, TWorker>::waitAndEmplace(TDatumsSP& tDatums) |