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

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

#include <Task.hh>

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

Public Types

using RetT = void
 
using this_type = Task< void, void >
 
using promise_type = std::promise< RetT >
 
using future_type = std::future< RetT >
 
using packaged_task_type = std::packaged_task< RetT()>
 
using result_type = RetT
 
- Public Types inherited from PTL::TaskFuture< void >
using promise_type = std::promise< void >
 
using future_type = std::future< void >
 
using result_type = void
 
- 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)
 
 ~Task () override=default
 
 Task (const Task &)=delete
 
Taskoperator= (const Task &)=delete
 
 Task (Task &&)=default
 
Taskoperator= (Task &&)=default
 
void operator() () final
 
future_type get_future () final
 
void wait () final
 
RetT get () final
 
- Public Member Functions inherited from PTL::TaskFuture< void >
 TaskFuture (Args &&... args)
 
 TaskFuture (const TaskFuture &)=delete
 
 TaskFuture (TaskFuture &&) noexcept=default
 
 ~TaskFuture () override=default
 
TaskFutureoperator= (const TaskFuture &)=delete
 
TaskFutureoperator= (TaskFuture &&) noexcept=default
 
virtual future_type get_future ()=0
 
virtual void wait ()=0
 
virtual void get ()=0
 
- 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
 
virtual void operator() ()=0
 
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

The task class is supplied to thread_pool.

Definition at line 228 of file Task.hh.

Member Typedef Documentation

◆ future_type

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

Definition at line 234 of file Task.hh.

◆ packaged_task_type

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

Definition at line 235 of file Task.hh.

◆ promise_type

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

Definition at line 233 of file Task.hh.

◆ result_type

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

Definition at line 236 of file Task.hh.

◆ RetT

using PTL::Task< void, void >::RetT = void

Definition at line 231 of file Task.hh.

◆ this_type

using PTL::Task< void, void >::this_type = Task<void, void>

Definition at line 232 of file Task.hh.

Constructor & Destructor Documentation

◆ Task() [1/4]

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

Definition at line 240 of file Task.hh.

241 : TaskFuture<RetT>{}
242 , m_ptask{ std::move(func) }
243 {}

◆ Task() [2/4]

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

Definition at line 246 of file Task.hh.

247 : TaskFuture<RetT>{ _is_native, _depth }
248 , m_ptask{ std::move(func) }
249 {}

◆ ~Task()

PTL::Task< void, void >::~Task ( )
overridedefault

◆ Task() [3/4]

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

◆ Task() [4/4]

PTL::Task< void, void >::Task ( Task< void, void > &&  )
default

Member Function Documentation

◆ get()

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

Implements PTL::TaskFuture< void >.

Definition at line 264 of file Task.hh.

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

◆ get_future()

future_type PTL::Task< void, void >::get_future ( )
inlinefinalvirtual

Implements PTL::TaskFuture< void >.

Definition at line 262 of file Task.hh.

262{ return m_ptask.get_future(); }

◆ operator()()

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

Implements PTL::VTask.

Definition at line 261 of file Task.hh.

261{ m_ptask(); }

◆ operator=() [1/2]

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

◆ operator=() [2/2]

Task & PTL::Task< void, void >::operator= ( Task< void, void > &&  )
default

◆ wait()

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

Implements PTL::TaskFuture< void >.

Definition at line 263 of file Task.hh.

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

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