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

◆ commit()

void MayaFlux::Nexus::Fabric::commit ( )

Update all positions, publish the snapshot, fire all registered objects.

For each object with a position, calls m_index->update() then m_index->publish(). Then fires each object's function with a context built from the new snapshot.

Definition at line 176 of file Fabric.cpp.

177{
178 for (auto& [id, reg] : m_registrations) {
179 if (reg.spatial_id.has_value()) {
180 std::visit([&](const auto& ptr) {
181 if (ptr->m_position.has_value()) {
182 m_index->update(*reg.spatial_id, *ptr->m_position);
183 }
184 },
185 reg.member);
186 }
187 }
188
189 m_index->publish();
190
191 if (!m_expanses.empty()) {
192 const auto snapshot = m_index->all();
193 for (auto& [xid, expanse] : m_expanses)
194 expanse->evaluate(m_fabric_id, snapshot);
195 }
196
197 for (auto& [id, reg] : m_registrations) {
198 if (reg.commit_driven) {
199 fire(reg);
200 }
201 }
202}
const uint8_t * ptr
std::unordered_map< uint32_t, std::shared_ptr< Expanse > > m_expanses
Definition Fabric.hpp:293
std::unique_ptr< Kinesis::SpatialIndex3D > m_index
Definition Fabric.hpp:291
void fire(uint32_t id)
Fire a single object against the current snapshot without republishing.
Definition Fabric.cpp:204
std::unordered_map< uint32_t, Registration > m_registrations
Definition Fabric.hpp:292

References fire(), m_expanses, m_fabric_id, m_index, m_registrations, and ptr.

+ Here is the call graph for this function: