Antkeeper
0.0.1
|
Evaluates an activation state given input values and publishes events on activation state changes. More...
#include <action.hpp>
Public Types | |
using | threshold_function_type = std::function< bool(float)> |
Threshold function type. More... | |
Public Member Functions | |
action () | |
Constructs an action. More... | |
void | set_threshold_function (const threshold_function_type &function) noexcept |
Sets the threshold function. More... | |
void | evaluate (float value) |
Evaluates the activation state of the action, according to its threshold function and an input value. More... | |
void | update () const |
Publishes an action active event if the action is active. More... | |
void | reset () noexcept |
Resets the activation state of the action without publishing any events. More... | |
const threshold_function_type & | get_threshold_function () const noexcept |
Returns the threshold function. More... | |
bool | is_active () const noexcept |
Returns true if the action is active, false otherwise. More... | |
float | get_input_value () const noexcept |
Returns the most recently evaluated input value. More... | |
::event::channel< action_activated_event > & | get_activated_channel () noexcept |
Returns the channel through which action activated events are published. More... | |
::event::channel< action_active_event > & | get_active_channel () noexcept |
Returns the channel through which action active events are published. More... | |
::event::channel< action_deactivated_event > & | get_deactivated_channel () noexcept |
Returns the channel through which action deactivated events are published. More... | |
Evaluates an activation state given input values and publishes events on activation state changes.
Definition at line 32 of file action.hpp.
using input::action::threshold_function_type = std::function<bool(float)> |
Threshold function type.
Given an input value, returns true
if the action should be considered active, and false
otherwise.
Definition at line 40 of file action.hpp.
input::action::action | ( | ) |
Constructs an action.
Definition at line 33 of file action.cpp.
void input::action::evaluate | ( | float | value | ) |
Evaluates the activation state of the action, according to its threshold function and an input value.
value | Input value. |
Definition at line 37 of file action.cpp.
|
inlinenoexcept |
Returns the channel through which action activated events are published.
Definition at line 91 of file action.hpp.
|
inlinenoexcept |
Returns the channel through which action active events are published.
Definition at line 97 of file action.hpp.
|
inlinenoexcept |
Returns the channel through which action deactivated events are published.
Definition at line 103 of file action.hpp.
|
inlinenoexcept |
Returns the most recently evaluated input value.
Definition at line 85 of file action.hpp.
|
inlinenoexcept |
Returns the threshold function.
Definition at line 73 of file action.hpp.
|
inlinenoexcept |
Returns true
if the action is active, false
otherwise.
Definition at line 79 of file action.hpp.
|
noexcept |
Resets the activation state of the action without publishing any events.
Definition at line 75 of file action.cpp.
|
inlinenoexcept |
Sets the threshold function.
function | Threshold function. |
Definition at line 50 of file action.hpp.
void input::action::update | ( | ) | const |
Publishes an action active event if the action is active.
Definition at line 66 of file action.cpp.