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 165 of file LiveArena.hpp.

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

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: