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

◆ add_conditional_unique()

HookId MayaFlux::Nodes::HookList::add_conditional_unique ( NodeHook  hook,
NodeCondition  condition,
const std::type_info &  key,
uint8_t  tag = 0 
)

As add_conditional, returning the existing id when the same hook and condition types exist.

Definition at line 188 of file NodeUtils.cpp.

189{
190 const HookId fresh = next_id();
191 HookId result = fresh;
192 mutate([&](std::vector<HookEntry>& entries) {
193 const auto it = std::ranges::find_if(entries, [&](const HookEntry& entry) {
194 return *entry.key == key && entry.condition && entry.condition->target_type() == condition.target_type();
195 });
196 if (it != entries.end()) {
197 result = it->id;
198 return false;
199 }
200 result = fresh;
201 entries.push_back(HookEntry { fresh, &key, tag, {}, hook, condition });
202 return true;
203 });
204 return result;
205}
bool mutate(const std::function< bool(std::vector< HookEntry > &)> &edit)
uint64_t HookId
Identifies one registration inside a HookList.
Definition NodeUtils.hpp:60

References MayaFlux::Nodes::HookEntry::condition, MayaFlux::Nodes::HookEntry::key, mutate(), and next_id().

Referenced by MayaFlux::Nodes::Node::on_tick_if().

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