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

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

#include <Task.hh>

+ Inheritance diagram for PTL::PackagedTask< RetT, Args >:

Public Types

typedef PackagedTask< RetT, Args... > this_type
 
typedef std::promise< RetT > promise_type
 
typedef std::future< RetT > future_type
 
typedef std::packaged_task< RetT(Args...)> packaged_task_type
 
typedef RetT result_type
 
typedef std::tuple< Args... > tuple_type
 
- Public Types inherited from PTL::VTask
typedef std::thread::id tid_type
 
typedef size_t size_type
 
typedef VTask this_type
 
typedef std::atomic_uintmax_t count_t
 
typedef VTaskiterator
 
typedef const VTaskconst_iterator
 
typedef std::function< void()> void_func_t
 

Public Member Functions

template<typename FuncT >
 PackagedTask (FuncT &&func, Args... args)
 
template<typename FuncT >
 PackagedTask (VTaskGroup *tg, FuncT &&func, Args... args)
 
template<typename FuncT >
 PackagedTask (ThreadPool *_pool, FuncT &&func, Args... args)
 
virtual ~PackagedTask ()
 
virtual void operator() () override
 
future_type get_future ()
 
virtual bool is_native_task () const override
 
- Public Member Functions inherited from PTL::VTask
 VTask ()
 
 VTask (VTaskGroup *task_group)
 
 VTask (ThreadPool *pool)
 
virtual ~VTask ()
 
virtual void operator() ()=0
 
void operator-- ()
 
virtual bool is_native_task () const
 
virtual ThreadPoolpool () const
 
VTaskGroupgroup () const
 
iterator begin ()
 
iterator end ()
 
const_iterator begin () const
 
const_iterator end () const
 
const_iterator cbegin () const
 
const_iterator cend () const
 
intmax_t & depth ()
 
const intmax_t & depth () const
 

Additional Inherited Members

- Static Protected Member Functions inherited from PTL::VTask
static tid_type this_tid ()
 
- Protected Attributes inherited from PTL::VTask
intmax_t m_depth
 
VTaskGroupm_group
 
ThreadPoolm_pool
 
void_func_t m_func = []() {}
 

Detailed Description

template<typename RetT, typename... Args>
class PTL::PackagedTask< RetT, Args >

The task class is supplied to thread_pool.

Definition at line 50 of file Task.hh.

Member Typedef Documentation

◆ future_type

template<typename RetT , typename... Args>
typedef std::future<RetT> PTL::PackagedTask< RetT, Args >::future_type

Definition at line 55 of file Task.hh.

◆ packaged_task_type

template<typename RetT , typename... Args>
typedef std::packaged_task<RetT(Args...)> PTL::PackagedTask< RetT, Args >::packaged_task_type

Definition at line 56 of file Task.hh.

◆ promise_type

template<typename RetT , typename... Args>
typedef std::promise<RetT> PTL::PackagedTask< RetT, Args >::promise_type

Definition at line 54 of file Task.hh.

◆ result_type

template<typename RetT , typename... Args>
typedef RetT PTL::PackagedTask< RetT, Args >::result_type

Definition at line 57 of file Task.hh.

◆ this_type

template<typename RetT , typename... Args>
typedef PackagedTask<RetT, Args...> PTL::PackagedTask< RetT, Args >::this_type

Definition at line 53 of file Task.hh.

◆ tuple_type

template<typename RetT , typename... Args>
typedef std::tuple<Args...> PTL::PackagedTask< RetT, Args >::tuple_type

Definition at line 58 of file Task.hh.

Constructor & Destructor Documentation

◆ PackagedTask() [1/3]

template<typename RetT , typename... Args>
template<typename FuncT >
PTL::PackagedTask< RetT, Args >::PackagedTask ( FuncT &&  func,
Args...  args 
)
inline

Definition at line 63 of file Task.hh.

64 : VTask()
65 , m_ptask(std::forward<FuncT>(func))
66 , m_args(args...)
67 {}
VTask()
Definition: VTask.cc:40

◆ PackagedTask() [2/3]

template<typename RetT , typename... Args>
template<typename FuncT >
PTL::PackagedTask< RetT, Args >::PackagedTask ( VTaskGroup tg,
FuncT &&  func,
Args...  args 
)
inline

Definition at line 70 of file Task.hh.

71 : VTask(tg)
72 , m_ptask(std::forward<FuncT>(func))
73 , m_args(args...)
74 {}

◆ PackagedTask() [3/3]

template<typename RetT , typename... Args>
template<typename FuncT >
PTL::PackagedTask< RetT, Args >::PackagedTask ( ThreadPool _pool,
FuncT &&  func,
Args...  args 
)
inline

Definition at line 77 of file Task.hh.

78 : VTask(_pool)
79 , m_ptask(std::forward<FuncT>(func))
80 , m_args(args...)
81 {}

◆ ~PackagedTask()

template<typename RetT , typename... Args>
virtual PTL::PackagedTask< RetT, Args >::~PackagedTask ( )
inlinevirtual

Definition at line 83 of file Task.hh.

83{}

Member Function Documentation

◆ get_future()

template<typename RetT , typename... Args>
future_type PTL::PackagedTask< RetT, Args >::get_future ( )
inline

Definition at line 91 of file Task.hh.

91{ return m_ptask.get_future(); }

◆ is_native_task()

template<typename RetT , typename... Args>
virtual bool PTL::PackagedTask< RetT, Args >::is_native_task ( ) const
inlineoverridevirtual

Reimplemented from PTL::VTask.

Definition at line 92 of file Task.hh.

92{ return true; }

◆ operator()()

template<typename RetT , typename... Args>
virtual void PTL::PackagedTask< RetT, Args >::operator() ( )
inlineoverridevirtual

Implements PTL::VTask.

Definition at line 87 of file Task.hh.

88 {
89 mpl::apply(std::move(m_ptask), std::move(m_args));
90 }

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