| 722 | |
| 723 | template <bool readonly, bool local> |
| 724 | auto sugoiV_get_owned(const sugoi_chunk_view_t* view, sugoi_type_index_t type) |
| 725 | { |
| 726 | using namespace sugoi; |
| 727 | using return_type = std::conditional_t<readonly, const void*, void*>; |
| 728 | if (type_index_t(type).is_tag()) SUGOI_UNLIKELY |
| 729 | return (return_type) nullptr; |
| 730 | auto chunk = view->chunk; |
| 731 | auto structure = chunk->type; |
| 732 | SIndex id; |
| 733 | if constexpr (local) |
| 734 | id = type; |
| 735 | else |
| 736 | id = structure->index(type); |
| 737 | if (id == kInvalidSIndex) |
| 738 | return (return_type) nullptr; |
| 739 | if constexpr (!readonly) |
| 740 | chunk->timestamps()[id] = structure->storage->timestamp; |
| 741 | auto scheduler = structure->storage->scheduler; |
| 742 | if (scheduler && scheduler->is_main_thread(structure->storage)) |
| 743 | SKR_ASSERT(!scheduler->sync_entry(structure, id, readonly)); |
| 744 | EIndex offset = 0; |
| 745 | if (!type_index_t(type).is_chunk()) |
| 746 | offset = structure->sizes[id] * view->start; |
| 747 | return (return_type)(chunk->data() + offset + structure->offsets[chunk->pt][id]); |
| 748 | } |
| 749 | |
| 750 | extern "C" { |
| 751 | const void* sugoiV_get_component_ro(const sugoi_chunk_view_t* view, sugoi_type_index_t type) |
nothing calls this directly
no test coverage detected