MCPcopy Create free account
hub / github.com/cutdigital/mcut / get_connected_component_data_impl

Function get_connected_component_data_impl

source/frontend.cpp:3672–3710  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

3670}
3671
3672void get_connected_component_data_impl(
3673 const McContext contextHandle,
3674 const McConnectedComponent connCompId,
3675 McFlags flags,
3676 McSize bytes,
3677 McVoid* pMem,
3678 McSize* pNumBytes,
3679 uint32_t numEventsInWaitlist,
3680 const McEvent* pEventWaitList,
3681 McEvent* pEvent)
3682{
3683 std::shared_ptr<context_t> context_ptr = g_contexts.find_first_if([=](const std::shared_ptr<context_t> cptr) { return cptr->m_user_handle == contextHandle; });
3684
3685 if (context_ptr == nullptr) {
3686 throw std::invalid_argument("invalid context");
3687 }
3688
3689 std::weak_ptr<context_t> context_weak_ptr(context_ptr);
3690
3691 const McEvent event_handle = context_ptr->prepare_and_submit_API_task(
3692 MC_COMMAND_GET_CONNECTED_COMPONENT_DATA, numEventsInWaitlist, pEventWaitList,
3693 [=]() {
3694 if (!context_weak_ptr.expired()) {
3695 std::shared_ptr<context_t> context = context_weak_ptr.lock();
3696 if (context) {
3697 // asynchronously get the data and write to user provided pointer
3698 get_connected_component_data_impl_detail(
3699 context,
3700 connCompId,
3701 flags,
3702 bytes,
3703 pMem,
3704 pNumBytes);
3705 }
3706 }
3707 });
3708
3709 *pEvent = event_handle;
3710}
3711
3712void release_event_impl(
3713 McEvent eventHandle)

Callers 1

Tested by

no test coverage detected