nomlib
Loading...
Searching...
No Matches
nom::DispatchQueue Class Reference

The internal processing queue for actions. More...

#include <DispatchQueue.hpp>

Public Types

enum  State { IDLING = 0 , RUNNING }
 The status of the queue. More...
typedef DispatchQueue self_type

Public Member Functions

nom::size_type num_actions () const
 Get the total number of enqueued actions.
bool enqueue_action (const std::shared_ptr< IActionObject > &action, const action_callback_func &completion_func)
 Append an action to the list of actions to be executed.
DispatchQueue::State update (uint32 player_state, real32 delta_time)
 Run the enqueued actions' update loop.

Private Types

typedef std::vector< std::unique_ptr< DispatchEnqueue > > container_type
typedef container_type::iterator iterator_type

Private Attributes

container_type actions_
 Enqueued actions.
iterator_type actions_iterator_
nom::size_type num_actions_ = 0
 The total number of actions enqueued.

Static Private Attributes

static const char * DEBUG_CLASS_NAME

(Note that these are not member symbols.)

template<typename ObjectType, typename... ObjectArgs>
std::unique_ptr< ObjectType > create_dispatch_queue (ObjectArgs &&... args)
 Constructor function for creating a nom::DispatchQueue.

Detailed Description

The internal processing queue for actions.

This interface was inspired by Apple's Grand Central Dispatch (GCD).

See also
nom::ActionPlayer

Definition at line 48 of file DispatchQueue.hpp.

Member Typedef Documentation

◆ container_type

typedef std::vector<std::unique_ptr<DispatchEnqueue> > nom::DispatchQueue::container_type
private

Definition at line 97 of file DispatchQueue.hpp.

◆ iterator_type

typedef container_type::iterator nom::DispatchQueue::iterator_type
private

Definition at line 98 of file DispatchQueue.hpp.

◆ self_type

typedef DispatchQueue nom::DispatchQueue::self_type

Definition at line 51 of file DispatchQueue.hpp.

Member Enumeration Documentation

◆ State

The status of the queue.

Definition at line 54 of file DispatchQueue.hpp.

Member Function Documentation

◆ enqueue_action()

bool nom::DispatchQueue::enqueue_action ( const std::shared_ptr< IActionObject > & action,
const action_callback_func & completion_func )

Append an action to the list of actions to be executed.

Parameters
actionThe action to run; NULL actions are valid.
completion_funcAn optional function to call when the action is completed – passing NULL here will ignore this parameter.

◆ update()

DispatchQueue::State nom::DispatchQueue::update ( uint32 player_state,
real32 delta_time )

Run the enqueued actions' update loop.

Parameters
player_stateOne of the ActionPlayer::State enumeration values.
delta_timeReserved for application-defined implementations.
Returns
DispatchQueue::State::RUNNING if one or more actions are executing, or DispatchQueue::State::IDLING when no actions are running, such as when the queue is empty.
Todo
Pausing the action does not always take effect for every nom::MoveByAction in the group within ActionTest.RainingRectsStressTest – some actions are sometimes skipped for some mysterious reason!
See also
nom::ActionPlayer::update.

◆ create_dispatch_queue()

template<typename ObjectType, typename... ObjectArgs>
std::unique_ptr< ObjectType > create_dispatch_queue ( ObjectArgs &&... args)
related

Constructor function for creating a nom::DispatchQueue.

Parameters
argsThe arguments to pass to the constructed object.

Definition at line 114 of file DispatchQueue.hpp.

Member Data Documentation

◆ actions_

container_type nom::DispatchQueue::actions_
private

Enqueued actions.

Definition at line 101 of file DispatchQueue.hpp.

◆ actions_iterator_

iterator_type nom::DispatchQueue::actions_iterator_
private

Definition at line 102 of file DispatchQueue.hpp.

◆ DEBUG_CLASS_NAME

const char* nom::DispatchQueue::DEBUG_CLASS_NAME
staticprivate

Definition at line 95 of file DispatchQueue.hpp.

◆ num_actions_

nom::size_type nom::DispatchQueue::num_actions_ = 0
private

The total number of actions enqueued.

Definition at line 105 of file DispatchQueue.hpp.


The documentation for this class was generated from the following file: