29#ifndef NOMLIB_ACTIONS_ACTION_PLAYER_HPP
30#define NOMLIB_ACTIONS_ACTION_PLAYER_HPP
39#include "nomlib/config.hpp"
47typedef std::function<void()> action_callback_func;
50class NOM_EXPORT ActionPlayer
53 typedef ActionPlayer self_type;
74 ActionPlayer& operator =(
const ActionPlayer& rhs) =
delete;
147 bool run_action(
const std::shared_ptr<IActionObject>& action);
160 bool run_action(
const std::shared_ptr<IActionObject>& action,
161 const action_callback_func& completion_func );
198 bool run_action(
const std::shared_ptr<IActionObject>& action,
199 std::unique_ptr<DispatchQueue> dispatch_queue,
200 const action_callback_func& completion_func );
202 static const char* DEBUG_CLASS_NAME;
205 std::map<std::string, std::unique_ptr<DispatchQueue>> container_type;
207 typedef container_type::iterator container_iterator;
Interface for running and controlling action flow.
State
The status of the player.
bool idle() const
Get the status of the action queue.
bool run_action(const std::shared_ptr< IActionObject > &action)
Enqueue an action.
bool action_running(const std::string &action_id) const
Get the completion status of an action.
void stop()
Reset the enqueued actions back to its initial starting state.
void resume()
Resume the advancement of time for the enqueued actions.
bool run_action(const std::shared_ptr< IActionObject > &action, const action_callback_func &completion_func)
Enqueue an action with a completion callback.
nom::size_type num_actions() const
Get the number of actions enqueued.
ActionPlayer::State player_state() const
Get the control status of the queue.
void cancel_actions()
Stop executing the enqueued actions.
std::deque< container_iterator > free_list_
The actions pending removal.
bool cancel_action(const std::string &action_id)
Stop executing an action.
std::vector< const char * > action_names
bool update(real32 delta_time)
Run the enqueued actions' update loop.
container_type actions_
Enqueued actions.
bool run_action(const std::shared_ptr< IActionObject > &action, std::unique_ptr< DispatchQueue > dispatch_queue, const action_callback_func &completion_func)
Enqueue an action that runs on a specific dispatch queue.
void pause()
Freeze the enqueued actions from advancing forward in time.
ActionPlayer(const ActionPlayer &rhs)=delete
Disabled copy constructor.
The internal processing queue for actions.
Pure virtual base class interface for actions.