MayaFlux 0.4.0
Digital-First Multimedia Processing Framework
Loading...
Searching...
No Matches

◆ live_arena_expose()

bool MayaFlux::internal::live_arena_expose ( const char *  key,
std::shared_ptr< void >  shared 
)
inlinenoexcept

Registers an externally owned shared_ptr under key.

Stores shared_ptr<void> in g_live_arena_shared_ptrs at the entry index. offset is set to UINT32_MAX to distinguish from bump-allocated entries.

Returns
true on success, false if the key is already registered or the directory is full.

Definition at line 169 of file LiveArena.hpp.

170 {
171 auto* hdr = live_arena_header();
172
173 if (hdr->entry_count >= LIVE_ARENA_MAX_ENTRIES) {
174 return false;
175 }
176
177 if (live_arena_find(key)) {
178 return false;
179 }
180
181 const uint32_t idx = hdr->entry_count;
182 auto& entry = hdr->entries[idx];
183 std::strncpy(entry.key, key, LIVE_ARENA_KEY_MAX - 1);
184 entry.key[LIVE_ARENA_KEY_MAX - 1] = '\0';
185 entry.offset = UINT32_MAX;
186 entry.size = UINT32_MAX;
187 entry.occupied = true;
188
189 g_live_arena_shared_ptrs[idx] = std::move(shared);
190
191 ++hdr->entry_count;
192 return true;
193 }
LiveArenaHeader * live_arena_header() noexcept
Returns a pointer to the header block at the start of arena storage.
Definition LiveArena.hpp:83

References g_live_arena_shared_ptrs, live_arena_find(), live_arena_header(), LIVE_ARENA_KEY_MAX, and LIVE_ARENA_MAX_ENTRIES.

Referenced by MayaFlux::expose_live(), and MayaFlux::expose_live().

+ Here is the call graph for this function:
+ Here is the caller graph for this function: