36 auto channel_bit =
static_cast<uint32_t
>((0x0ffffffff) & (1ULL << (uint64_t)channel_id));
45 auto channel_bit =
static_cast<uint32_t
>((0x0ffffffff) & (1ULL << (uint64_t)channel_id));
56 auto channel_bit =
static_cast<uint32_t
>((0x0ffffffff) & (1ULL << (uint64_t)channel_id));
58 return (active_mask & channel_bit) != 0;
65 auto channel_bit =
static_cast<uint32_t
>((0x0ffffffff) & (1ULL << (uint64_t)channel_id));
67 uint32_t new_pending = old_pending | channel_bit;
70 if ((new_pending & active_channels) == active_channels && active_channels != 0) {
71 uint32_t expected = new_pending;
86 if (active_mask == 0) {
std::atomic< uint32_t > m_active_channels_mask
Bitmask tracking which channels are currently using this node.
virtual void on_tick_if(const NodeHook &callback, const NodeCondition &condition)
Registers a conditional callback.
std::atomic< uint32_t > m_pending_reset_mask
Bitmask tracking which channels have requested a reset.
std::vector< NodeHook > m_callbacks
Collection of standard callback functions.
virtual void reset_processed_state()
Resets the processed state of the node and any attached input nodes.
bool is_used_by_channel(uint32_t channel_id) const
Checks if the node is currently used by a specific channel.
void unregister_channel_usage(uint32_t channel_id)
Removes the specified channel from the usage tracking.
virtual void reset_processed_state_internal()
Resets the processed state of the node directly.
std::vector< std::pair< NodeHook, NodeCondition > > m_conditional_callbacks
Collection of conditional callback functions with their predicates.
virtual void remove_all_hooks()
Removes all registered callbacks.
std::atomic< Utils::NodeState > m_state
Atomic state flag tracking the node's processing status.
virtual bool remove_hook(const NodeHook &callback)
Removes a previously registered callback.
void register_channel_usage(uint32_t channel_id)
Mark the specificed channel as a processor/user.
void request_reset_from_channel(uint32_t channel_id)
Requests a reset of the processed state from a specific channel.
virtual bool remove_conditional_hook(const NodeCondition &callback)
Removes a previously registered conditional callback.
std::vector< float > m_gpu_data_buffer
GPU data buffer for context objects.
std::span< const float > get_gpu_data_buffer() const
Provides access to the GPU data buffer.
virtual void on_tick(const NodeHook &callback)
Registers a callback to be called on each tick.
std::function< void(NodeContext &)> NodeHook
Callback function type for node processing events.
bool safe_remove_conditional_callback(std::vector< std::pair< NodeHook, NodeCondition > > &callbacks, const NodeCondition &callback)
Safely removes all conditional callbacks with a specific condition.
bool safe_add_callback(std::vector< NodeHook > &callbacks, const NodeHook &callback)
Safely adds a callback to a collection if it doesn't already exist.
std::function< bool(NodeContext &)> NodeCondition
Predicate function type for conditional callbacks.
bool safe_add_conditional_callback(std::vector< std::pair< NodeHook, NodeCondition > > &callbacks, const NodeHook &callback, const NodeCondition &condition)
Safely adds a conditional callback if it doesn't already exist.
void atomic_remove_flag(std::atomic< Utils::NodeState > &state, Utils::NodeState flag)
Atomically removes a flag from a node state.
bool safe_remove_callback(std::vector< NodeHook > &callbacks, const NodeHook &callback)
Safely removes a callback from a collection.
Contains the node-based computational processing system components.
@ PROCESSED
Node has been processed this cycle.