TwiceAsNice  2019-02-18
Public Types | Public Member Functions | Protected Attributes | List of all members
Nice::DispatcherSchedulerLifo< Task > Class Template Reference

SchedulingPolicy which implements LIFO ordering. More...

#include <DispatcherScheduler.hh>

Collaboration diagram for Nice::DispatcherSchedulerLifo< Task >:
Collaboration graph

Public Types

typedef Task TaskType
 Indicates the scheduler's task type. More...
 
typedef Task TaskType
 Indicates the scheduler's task type. More...
 

Public Member Functions

bool push (TaskType const &task)
 
TaskType pop ()
 
size_t size () const
 
bool empty () const
 
void clear ()
 
bool push (TaskType const &task)
 
TaskType pop ()
 
size_t size () const
 
bool empty () const
 
void clear ()
 

Protected Attributes

std::deque< TaskTypem_container
 Internal task container. More...
 
Nice::Mutex m_mutex
 

Detailed Description

template<typename Task>
class Nice::DispatcherSchedulerLifo< Task >

SchedulingPolicy which implements LIFO ordering.

This container implements a LIFO scheduling policy. The last task to be added to the scheduler will be the first to be removed. LIFO stands for "last in, first out".

Parameters
TaskA function object which implements the operator()(void).

Member Typedef Documentation

◆ TaskType [1/2]

template<typename Task >
typedef Task Nice::DispatcherSchedulerLifo< Task >::TaskType

Indicates the scheduler's task type.

◆ TaskType [2/2]

template<typename Task >
typedef Task Nice::DispatcherSchedulerLifo< Task >::TaskType

Indicates the scheduler's task type.

Member Function Documentation

◆ clear() [1/2]

template<typename Task >
void Nice::DispatcherSchedulerLifo< Task >::clear ( )
inline

Removes all tasks from the scheduler.

◆ clear() [2/2]

template<typename Task >
void Nice::DispatcherSchedulerLifo< Task >::clear ( void  )
inline

Removes all tasks from the scheduler.

◆ empty() [1/2]

template<typename Task >
bool Nice::DispatcherSchedulerLifo< Task >::empty ( void  ) const
inline

Checks if the scheduler is empty.

Returns
true if the scheduler contains no tasks, false otherwise.
Remarks
Is more efficient than size() == 0.

◆ empty() [2/2]

template<typename Task >
bool Nice::DispatcherSchedulerLifo< Task >::empty ( ) const
inline

Checks if the scheduler is empty.

Returns
true if the scheduler contains no tasks, false otherwise.
Remarks
Is more efficient than size() == 0.

◆ pop() [1/2]

template<typename Task >
TaskType Nice::DispatcherSchedulerLifo< Task >::pop ( )
inline

Gets the task which should be executed next and remove it.

Returns
The task object to be executed.

◆ pop() [2/2]

template<typename Task >
TaskType Nice::DispatcherSchedulerLifo< Task >::pop ( )
inline

Gets the task which should be executed next and remove it.

Returns
The task object to be executed.

◆ push() [1/2]

template<typename Task >
bool Nice::DispatcherSchedulerLifo< Task >::push ( TaskType const task)
inline

Adds a new task to the scheduler.

Parameters
taskThe task object.
Returns
true, if the task could be scheduled and false otherwise.

◆ push() [2/2]

template<typename Task >
bool Nice::DispatcherSchedulerLifo< Task >::push ( TaskType const task)
inline

Adds a new task to the scheduler.

Parameters
taskThe task object.
Returns
true, if the task could be scheduled and false otherwise.

◆ size() [1/2]

template<typename Task >
size_t Nice::DispatcherSchedulerLifo< Task >::size ( ) const
inline

Gets the current number of tasks in the scheduler.

Returns
The number of tasks.
Remarks
Prefer empty() to size() == 0 to check if the scheduler is empty.

◆ size() [2/2]

template<typename Task >
size_t Nice::DispatcherSchedulerLifo< Task >::size ( void  ) const
inline

Gets the current number of tasks in the scheduler.

Returns
The number of tasks.
Remarks
Prefer empty() to size() == 0 to check if the scheduler is empty.

Member Data Documentation

◆ m_container

template<typename Task >
std::deque< TaskType > Nice::DispatcherSchedulerLifo< Task >::m_container
protected

Internal task container.

◆ m_mutex

template<typename Task >
Nice::Mutex Nice::DispatcherSchedulerLifo< Task >::m_mutex
protected

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