29#ifndef NOMLIB_ACTIONS_ACTION_PLAYER_HPP
30#define NOMLIB_ACTIONS_ACTION_PLAYER_HPP
38#include "nomlib/config.hpp"
46typedef std::function<void()> action_callback_func;
52 typedef ActionPlayer self_type;
73 ActionPlayer&
operator =(
const ActionPlayer& rhs) =
delete;
146 bool run_action(
const std::shared_ptr<IActionObject>& action);
159 bool run_action(
const std::shared_ptr<IActionObject>& action,
160 const action_callback_func& completion_func );
197 bool run_action(
const std::shared_ptr<IActionObject>& action,
198 std::unique_ptr<DispatchQueue> dispatch_queue,
199 const action_callback_func& completion_func );
201 static const char* DEBUG_CLASS_NAME;
204 std::map<std::string, std::unique_ptr<DispatchQueue>> container_type;
206 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.
ActionPlayer & operator=(const ActionPlayer &rhs)=delete
Disabled copy assignment operator.
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.