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

◆ add_callback()

HookId MayaFlux::Nodes::Generator::Logic::add_callback ( const TypedHook< LogicContext > &  callback,
LogicEventType  type,
const std::optional< NodeCondition > &  condition = std::nullopt 
)
inlineprivate

Adds a callback to the list of all callbacks.

Parameters
callbackThe callback function to add
typeThe type of event to trigger the callback
conditionOptional condition for conditional callbacks

Definition at line 740 of file Logic.hpp.

741 {
742 if (type == LogicEventType::TICK) {
743 return m_callbacks.add(adapt_hook(callback), callback.target_type());
744 }
745 if (type == LogicEventType::CONDITIONAL && condition) {
746 return m_conditional_callbacks.add_conditional(adapt_hook(callback), *condition, callback.target_type());
747 }
748 return m_all_callbacks.add(adapt_hook(callback), callback.target_type(), static_cast<uint8_t>(type));
749 }
PickCallback callback
Definition Picker.cpp:22
vk::PhysicalDeviceType type
Definition VKDevice.cpp:126
HookList m_all_callbacks
Event-specific callbacks, tagged with their LogicEventType.
Definition Logic.hpp:762
HookId add(NodeHook hook, const std::type_info &key, uint8_t tag=0, std::array< double, 2 > params={})
Appends a hook with no duplicate check and returns its id.
HookId add_conditional(NodeHook hook, NodeCondition condition, const std::type_info &key, uint8_t tag=0)
Appends a hook that fires only while condition holds.
HookList m_conditional_callbacks
Hooks fired on a tick only while their condition holds.
Definition Node.hpp:485
HookList m_callbacks
Hooks fired on every tick.
Definition Node.hpp:478
NodeHook adapt_hook(const TypedHook< ContextT > &hook)
Wraps a context-typed hook into a NodeHook.

References MayaFlux::Nodes::adapt_hook(), callback, and type.

Referenced by on_change(), on_change_to(), on_tick(), on_tick_if(), while_false(), and while_true().

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