Geant4 11.3.0
Toolkit for the simulation of the passage of particles through matter
Loading...
Searching...
No Matches
PTL::Task< RetT, void > Class Template Reference

The task class is supplied to thread_pool. More...

#include <Task.hh>

+ Inheritance diagram for PTL::Task< RetT, void >:

Public Types

using this_type = Task<RetT>
 
using promise_type = std::promise<RetT>
 
using future_type = std::future<RetT>
 
using packaged_task_type = std::packaged_task<RetT()>
 
using result_type = RetT
 
using this_type
 
using promise_type
 
using future_type
 
using packaged_task_type
 
using result_type
 
using tuple_type
 
- Public Types inherited from PTL::TaskFuture< RetT >
using promise_type = std::promise<RetT>
 
using future_type = std::future<RetT>
 
using result_type = RetT
 
- Public Types inherited from PTL::VTask
using tid_type = std::thread::id
 
using size_type = size_t
 
using void_func_t = std::function<void()>
 

Public Member Functions

template<typename FuncT>
 Task (FuncT func)
 
template<typename FuncT>
 Task (bool _is_native, intmax_t _depth, FuncT func)
 
virtual ~Task ()=default
 
 Task (const Task &)=delete
 
Taskoperator= (const Task &)=delete
 
 Task (Task &&) noexcept=default
 
Taskoperator= (Task &&) noexcept=default
 
virtual void operator() () final
 
virtual future_type get_future () final
 
virtual void wait () final
 
virtual RetT get () final
 
 Task (FuncT func, Args... args)
 
 Task (bool _is_native, intmax_t _depth, FuncT func, Args... args)
 
 Task (const Task &)=delete
 
 Task (Task &&) noexcept=default
 
 ~Task () override=default
 
Taskoperator= (const Task &)=delete
 
Taskoperator= (Task &&) noexcept=default
 
void operator() () final
 
future_type get_future () final
 
void wait () final
 
RetT get () final
 
- Public Member Functions inherited from PTL::TaskFuture< RetT >
template<typename... Args>
 TaskFuture (Args &&... args)
 
 ~TaskFuture () override=default
 
 TaskFuture (const TaskFuture &)=delete
 
TaskFutureoperator= (const TaskFuture &)=delete
 
 TaskFuture (TaskFuture &&) noexcept=default
 
TaskFutureoperator= (TaskFuture &&) noexcept=default
 
- Public Member Functions inherited from PTL::VTask
 VTask (bool _is_native, intmax_t _depth)
 
 VTask ()=default
 
virtual ~VTask ()=default
 
 VTask (const VTask &)=delete
 
VTaskoperator= (const VTask &)=delete
 
 VTask (VTask &&)=default
 
VTaskoperator= (VTask &&)=default
 
bool is_native_task () const
 
intmax_t depth () const
 

Additional Inherited Members

- Protected Attributes inherited from PTL::VTask
bool m_is_native = false
 
intmax_t m_depth = 0
 
void_func_t m_func = []() {}
 

Detailed Description

template<typename RetT>
class PTL::Task< RetT, void >

The task class is supplied to thread_pool.

Definition at line 183 of file Task.hh.

Member Typedef Documentation

◆ future_type [1/2]

using PTL::Task< RetT, Args >::future_type

Definition at line 135 of file Task.hh.

◆ future_type [2/2]

template<typename RetT>
using PTL::Task< RetT, void >::future_type = std::future<RetT>

Definition at line 188 of file Task.hh.

◆ packaged_task_type [1/2]

using PTL::Task< RetT, Args >::packaged_task_type

Definition at line 136 of file Task.hh.

◆ packaged_task_type [2/2]

template<typename RetT>
using PTL::Task< RetT, void >::packaged_task_type = std::packaged_task<RetT()>

Definition at line 189 of file Task.hh.

◆ promise_type [1/2]

using PTL::Task< RetT, Args >::promise_type

Definition at line 134 of file Task.hh.

◆ promise_type [2/2]

template<typename RetT>
using PTL::Task< RetT, void >::promise_type = std::promise<RetT>

Definition at line 187 of file Task.hh.

◆ result_type [1/2]

using PTL::Task< RetT, Args >::result_type

Definition at line 137 of file Task.hh.

◆ result_type [2/2]

template<typename RetT>
using PTL::Task< RetT, void >::result_type = RetT

Definition at line 190 of file Task.hh.

◆ this_type [1/2]

using PTL::Task< RetT, Args >::this_type

Definition at line 133 of file Task.hh.

◆ this_type [2/2]

template<typename RetT>
using PTL::Task< RetT, void >::this_type = Task<RetT>

Definition at line 186 of file Task.hh.

◆ tuple_type

using PTL::Task< RetT, Args >::tuple_type

Definition at line 138 of file Task.hh.

Constructor & Destructor Documentation

◆ Task() [1/8]

template<typename RetT>
template<typename FuncT>
PTL::Task< RetT, void >::Task ( FuncT func)
inline

Definition at line 194 of file Task.hh.

196 , m_ptask{ std::move(func) }
197 {}
TaskFuture(Args &&... args)
Definition Task.hh:57
The task class is supplied to thread_pool.
Definition Task.hh:131

Referenced by operator=(), operator=(), Task(), and Task().

◆ Task() [2/8]

template<typename RetT>
template<typename FuncT>
PTL::Task< RetT, void >::Task ( bool _is_native,
intmax_t _depth,
FuncT func )
inline

Definition at line 200 of file Task.hh.

202 , m_ptask{ std::move(func) }
203 {}

◆ ~Task() [1/2]

template<typename RetT>
virtual PTL::Task< RetT, void >::~Task ( )
virtualdefault

◆ Task() [3/8]

template<typename RetT>
PTL::Task< RetT, void >::Task ( const Task< RetT, void > & )
delete

◆ Task() [4/8]

template<typename RetT>
PTL::Task< RetT, void >::Task ( Task< RetT, void > && )
defaultnoexcept

◆ Task() [5/8]

PTL::Task< RetT, Args >::Task ( FuncT func,
Args... args )
inline

Definition at line 142 of file Task.hh.

144 , m_ptask{ std::move(func) }
145 , m_args{ args... }
146 {}

◆ Task() [6/8]

PTL::Task< RetT, Args >::Task ( bool _is_native,
intmax_t _depth,
FuncT func,
Args... args )
inline

Definition at line 149 of file Task.hh.

151 , m_ptask{ std::move(func) }
152 , m_args{ args... }
153 {}

◆ Task() [7/8]

PTL::Task< RetT, Args >::Task ( const Task< RetT, void > & )
delete

◆ Task() [8/8]

PTL::Task< RetT, Args >::Task ( Task< RetT, void > && )
defaultnoexcept

◆ ~Task() [2/2]

PTL::Task< RetT, Args >::~Task ( )
overridedefault

Member Function Documentation

◆ get() [1/2]

RetT PTL::Task< RetT, Args >::get ( )
inlinefinalvirtual

Implements PTL::TaskFuture< RetT >.

Definition at line 172 of file Task.hh.

172{ return m_ptask.get_future().get(); }

◆ get() [2/2]

template<typename RetT>
virtual RetT PTL::Task< RetT, void >::get ( )
inlinefinalvirtual

Implements PTL::TaskFuture< RetT >.

Definition at line 218 of file Task.hh.

218{ return m_ptask.get_future().get(); }

◆ get_future() [1/2]

future_type PTL::Task< RetT, Args >::get_future ( )
inlinefinalvirtual

Implements PTL::TaskFuture< RetT >.

Definition at line 170 of file Task.hh.

170{ return m_ptask.get_future(); }

◆ get_future() [2/2]

template<typename RetT>
virtual future_type PTL::Task< RetT, void >::get_future ( )
inlinefinalvirtual

Implements PTL::TaskFuture< RetT >.

Definition at line 216 of file Task.hh.

216{ return m_ptask.get_future(); }

◆ operator()() [1/2]

void PTL::Task< RetT, Args >::operator() ( )
inlinefinalvirtual

Implements PTL::VTask.

Definition at line 165 of file Task.hh.

166 {
167 if(m_ptask.valid())
168 PTL::apply(std::move(m_ptask), std::move(m_args));
169 }

◆ operator()() [2/2]

template<typename RetT>
virtual void PTL::Task< RetT, void >::operator() ( )
inlinefinalvirtual

Implements PTL::VTask.

Definition at line 215 of file Task.hh.

215{ m_ptask(); }

◆ operator=() [1/4]

Task & PTL::Task< RetT, Args >::operator= ( const Task< RetT, void > & )
delete

◆ operator=() [2/4]

template<typename RetT>
Task & PTL::Task< RetT, void >::operator= ( const Task< RetT, void > & )
delete

◆ operator=() [3/4]

Task & PTL::Task< RetT, Args >::operator= ( Task< RetT, void > && )
defaultnoexcept

◆ operator=() [4/4]

template<typename RetT>
Task & PTL::Task< RetT, void >::operator= ( Task< RetT, void > && )
defaultnoexcept

◆ wait() [1/2]

void PTL::Task< RetT, Args >::wait ( )
inlinefinalvirtual

Implements PTL::TaskFuture< RetT >.

Definition at line 171 of file Task.hh.

171{ return m_ptask.get_future().wait(); }

◆ wait() [2/2]

template<typename RetT>
virtual void PTL::Task< RetT, void >::wait ( )
inlinefinalvirtual

Implements PTL::TaskFuture< RetT >.

Definition at line 217 of file Task.hh.

217{ return m_ptask.get_future().wait(); }

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