The Gaudi Framework  v29r0 (ff2e7097)
boost::threadpool::fifo_scheduler< Task > Class Template Reference

SchedulingPolicy which implements FIFO ordering. More...

#include <src/threadpool/boost/threadpool/scheduling_policies.hpp>

Collaboration diagram for boost::threadpool::fifo_scheduler< Task >:

Public Types

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

Public Member Functions

bool push (task_type const &task)
 Adds a new task to the scheduler. More...
 
void pop ()
 Removes the task which should be executed next. More...
 
task_type const & top () const
 Gets the task which should be executed next. More...
 
size_t size () const
 Gets the current number of tasks in the scheduler. More...
 
bool empty () const
 Checks if the scheduler is empty. More...
 
void clear ()
 Removes all tasks from the scheduler. More...
 

Protected Attributes

std::deque< task_typem_container
 Internal task container. More...
 

Detailed Description

template<typename Task = task_func>
class boost::threadpool::fifo_scheduler< Task >

SchedulingPolicy which implements FIFO ordering.

This container implements a FIFO scheduling policy. The first task to be added to the scheduler will be the first to be removed. The processing proceeds sequentially in the same order. FIFO stands for "first in, first out".

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

Definition at line 45 of file scheduling_policies.hpp.

Member Typedef Documentation

template<typename Task = task_func>
typedef Task boost::threadpool::fifo_scheduler< Task >::task_type

Indicates the scheduler's task type.

Definition at line 48 of file scheduling_policies.hpp.

Member Function Documentation

template<typename Task = task_func>
void boost::threadpool::fifo_scheduler< Task >::clear ( )
inline

Removes all tasks from the scheduler.

Definition at line 100 of file scheduling_policies.hpp.

101  {
102  m_container.clear();
103  }
T clear(T...args)
std::deque< task_type > m_container
Internal task container.
template<typename Task = task_func>
bool boost::threadpool::fifo_scheduler< 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.

Definition at line 93 of file scheduling_policies.hpp.

94  {
95  return m_container.empty();
96  }
T empty(T...args)
std::deque< task_type > m_container
Internal task container.
template<typename Task = task_func>
void boost::threadpool::fifo_scheduler< Task >::pop ( )
inline

Removes the task which should be executed next.

Definition at line 67 of file scheduling_policies.hpp.

68  {
70  }
std::deque< task_type > m_container
Internal task container.
T pop_front(T...args)
template<typename Task = task_func>
bool boost::threadpool::fifo_scheduler< Task >::push ( task_type 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.

Definition at line 59 of file scheduling_policies.hpp.

60  {
61  m_container.push_back(task);
62  return true;
63  }
T push_back(T...args)
std::deque< task_type > m_container
Internal task container.
template<typename Task = task_func>
size_t boost::threadpool::fifo_scheduler< 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.

Definition at line 84 of file scheduling_policies.hpp.

85  {
86  return m_container.size();
87  }
std::deque< task_type > m_container
Internal task container.
T size(T...args)
template<typename Task = task_func>
task_type const& boost::threadpool::fifo_scheduler< Task >::top ( ) const
inline

Gets the task which should be executed next.

Returns
The task object to be executed.

Definition at line 75 of file scheduling_policies.hpp.

76  {
77  return m_container.front();
78  }
T front(T...args)
std::deque< task_type > m_container
Internal task container.

Member Data Documentation

template<typename Task = task_func>
std::deque<task_type> boost::threadpool::fifo_scheduler< Task >::m_container
protected

Internal task container.

Definition at line 51 of file scheduling_policies.hpp.


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