Eclipse SUMO - Simulation of Urban MObility
Loading...
Searching...
No Matches
TaskQueue< C > Class Template Reference

#include <TaskQueue.h>

Public Types

using TaskPtrType = std::unique_ptr< TaskBase< C > >
 

Public Member Functions

bool isEnabled () const
 
template<typename TaskT >
auto push (TaskT &&task) -> std::future< decltype(task(std::declval< C >()))>
 
void setEnabled (bool enabled)
 
 TaskQueue ()=default
 
bool tryPop (TaskPtrType &task)
 
template<typename TaskT >
auto tryPush (TaskT &&task, bool &success) -> std::future< decltype(task(std::declval< C >()))>
 
bool waitAndPop (TaskPtrType &task)
 
 ~TaskQueue ()=default
 

Private Types

using LockType = std::unique_lock< std::mutex >
 

Private Member Functions

TaskQueueoperator= (const TaskQueue &)=delete
 
 TaskQueue (const TaskQueue &)=delete
 

Private Attributes

bool myEnabled = true
 
std::mutex myMutex
 
std::queue< TaskPtrTypemyQueue
 
std::condition_variable myReady
 

Detailed Description

template<typename C>
class TaskQueue< C >

Definition at line 56 of file TaskQueue.h.

Member Typedef Documentation

◆ LockType

template<typename C >
using TaskQueue< C >::LockType = std::unique_lock<std::mutex>
private

Definition at line 57 of file TaskQueue.h.

◆ TaskPtrType

template<typename C >
using TaskQueue< C >::TaskPtrType = std::unique_ptr<TaskBase<C> >

Definition at line 60 of file TaskQueue.h.

Constructor & Destructor Documentation

◆ TaskQueue() [1/2]

template<typename C >
TaskQueue< C >::TaskQueue ( )
default

◆ ~TaskQueue()

template<typename C >
TaskQueue< C >::~TaskQueue ( )
default

◆ TaskQueue() [2/2]

template<typename C >
TaskQueue< C >::TaskQueue ( const TaskQueue< C > &  )
privatedelete

Member Function Documentation

◆ isEnabled()

template<typename C >
bool TaskQueue< C >::isEnabled ( ) const
inline

Definition at line 74 of file TaskQueue.h.

References TaskQueue< C >::myEnabled, and TaskQueue< C >::myMutex.

◆ operator=()

template<typename C >
TaskQueue & TaskQueue< C >::operator= ( const TaskQueue< C > &  )
privatedelete

◆ push()

template<typename C >
template<typename TaskT >
auto TaskQueue< C >::push ( TaskT &&  task) -> std::future<decltype(task(std::declval<C>()))>
inline

◆ setEnabled()

template<typename C >
void TaskQueue< C >::setEnabled ( bool  enabled)
inline

◆ tryPop()

template<typename C >
bool TaskQueue< C >::tryPop ( TaskPtrType task)
inline

◆ tryPush()

template<typename C >
template<typename TaskT >
auto TaskQueue< C >::tryPush ( TaskT &&  task,
bool &  success 
) -> std::future<decltype(task(std::declval<C>()))>
inline

◆ waitAndPop()

template<typename C >
bool TaskQueue< C >::waitAndPop ( TaskPtrType task)
inline

Field Documentation

◆ myEnabled

template<typename C >
bool TaskQueue< C >::myEnabled = true
private

◆ myMutex

template<typename C >
std::mutex TaskQueue< C >::myMutex
mutableprivate

◆ myQueue

template<typename C >
std::queue<TaskPtrType> TaskQueue< C >::myQueue
private

◆ myReady

template<typename C >
std::condition_variable TaskQueue< C >::myReady
private

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