transwarp
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Pages
Classes | Typedefs | Functions | Variables
transwarp::detail Namespace Reference

Detail namespace for internal functionality only. More...

Classes

class  thread_pool
 A simple thread pool used to execute tasks in parallel. More...
 
struct  assign_futures_impl
 
struct  assign_futures_impl<-1, ParentResults...>
 
struct  call_impl
 
struct  call_impl_vector
 
struct  call_impl< transwarp::root_type, true, total, n...>
 
struct  call_impl_vector< transwarp::root_type >
 
struct  call_impl< transwarp::accept_type, true, total, n...>
 
struct  call_impl_vector< transwarp::accept_type >
 
struct  call_impl< transwarp::accept_any_type, true, total, n...>
 
struct  call_impl_vector< transwarp::accept_any_type >
 
struct  call_impl< transwarp::consume_type, true, total, n...>
 
struct  call_impl_vector< transwarp::consume_type >
 
struct  call_impl< transwarp::consume_any_type, true, total, n...>
 
struct  call_impl_vector< transwarp::consume_any_type >
 
struct  call_impl< transwarp::wait_type, true, total, n...>
 
struct  call_impl_vector< transwarp::wait_type >
 
struct  call_impl< transwarp::wait_any_type, true, total, n...>
 
struct  call_impl_vector< transwarp::wait_any_type >
 
struct  parent_visitor
 Sets level of a task and increments the child count. More...
 
struct  final_visitor
 Applies final bookkeeping to the task and collects the task. More...
 
struct  edges_visitor
 Generates edges. More...
 
struct  schedule_visitor
 Schedules using the given executor. More...
 
struct  reset_visitor
 Resets the given task. More...
 
struct  cancel_visitor
 Cancels or resumes the given task. More...
 
struct  set_executor_visitor
 Assigns an executor to the given task. More...
 
struct  remove_executor_visitor
 Removes the executor from the given task. More...
 
struct  set_priority_visitor
 Assigns a priority to the given task. More...
 
struct  reset_priority_visitor
 Resets the priority of the given task. More...
 
struct  set_custom_data_visitor
 Assigns custom data to the given task. More...
 
struct  remove_custom_data_visitor
 Removes custom data from the given task. More...
 
struct  push_task_visitor
 Pushes the given task into the vector of tasks. More...
 
struct  add_listener_visitor
 Adds a new listener to the given task. More...
 
struct  add_listener_per_event_visitor
 Adds a new listener per event type to the given task. More...
 
struct  remove_listener_visitor
 Removes a listener from the given task. More...
 
struct  remove_listener_per_event_visitor
 Removes a listener per event type from the given task. More...
 
struct  remove_listeners_visitor
 Removes all listeners from the given task. More...
 
struct  remove_listeners_per_event_visitor
 Removes all listeners per event type from the given task. More...
 
struct  visit_visitor
 Visits the given task using the visitor given in the constructor. More...
 
struct  unvisit_visitor
 Unvisits the given task. More...
 
struct  functor_result
 Determines the result type of the Functor dispatching on the task type. More...
 
struct  functor_result< transwarp::root_type, Functor, ParentResults...>
 
struct  functor_result< transwarp::accept_type, Functor, ParentResults...>
 
struct  functor_result< transwarp::accept_type, Functor, std::vector< std::shared_ptr< transwarp::task< ParentResultType > > > >
 
struct  functor_result< transwarp::accept_any_type, Functor, ParentResults...>
 
struct  functor_result< transwarp::accept_any_type, Functor, std::vector< std::shared_ptr< transwarp::task< ParentResultType > > > >
 
struct  functor_result< transwarp::consume_type, Functor, ParentResults...>
 
struct  functor_result< transwarp::consume_type, Functor, std::vector< std::shared_ptr< transwarp::task< ParentResultType > > > >
 
struct  functor_result< transwarp::consume_any_type, Functor, ParentResults...>
 
struct  functor_result< transwarp::consume_any_type, Functor, std::vector< std::shared_ptr< transwarp::task< ParentResultType > > > >
 
struct  functor_result< transwarp::wait_type, Functor, ParentResults...>
 
struct  functor_result< transwarp::wait_type, Functor, std::vector< std::shared_ptr< transwarp::task< ParentResultType > > > >
 
struct  functor_result< transwarp::wait_any_type, Functor, ParentResults...>
 
struct  functor_result< transwarp::wait_any_type, Functor, std::vector< std::shared_ptr< transwarp::task< ParentResultType > > > >
 
struct  parents
 Determines the type of the parents. More...
 
struct  parents< std::vector< std::shared_ptr< transwarp::task< ParentResultType > > > >
 Determines the type of the parents. Specialization for vector parents. More...
 
class  base_runner
 
class  base_runner< void, TaskType >
 
class  runner
 A callable to run a task given its parents. More...
 
class  circular_buffer
 A simple circular buffer (FIFO). ValueType must support default construction. The buffer lets you push new values onto the back and pop old values off the front. More...
 
class  spinlock
 
class  task_common
 Common task functionality shared across task_impl and value_task More...
 
class  task_impl_base
 The base task class that contains the functionality that can be used with all result types (void and non-void). More...
 
class  task_impl_proxy
 A task proxy. More...
 
class  task_impl_proxy< ResultType &, TaskType, Functor, ParentResults...>
 A task proxy for reference result type. More...
 
class  task_impl_proxy< void, TaskType, Functor, ParentResults...>
 A task proxy for void result type. More...
 

Typedefs

template<typename TaskType , typename Functor , typename... ParentResults>
using functor_result_t = typename transwarp::detail::functor_result< TaskType, Functor, ParentResults...>::type
 Determines the result type of the Functor dispatching on the task type.
 
template<typename... ParentResults>
using parents_t = typename transwarp::detail::parents< ParentResults...>::type
 Determines the type of the parents.
 

Functions

void decrement_refcount (transwarp::itask &task)
 Decrements refcount.
 
template<typename TaskType >
std::shared_ptr< TaskType > clone_task (std::unordered_map< std::shared_ptr< transwarp::itask >, std::shared_ptr< transwarp::itask >> &task_cache, const std::shared_ptr< TaskType > &t)
 Clones a task.
 
template<typename F >
void assign_task_if (F &, transwarp::itask &) noexcept
 
template<typename Functor , typename Tuple >
void apply_to_each (Functor &&f, Tuple &&t)
 Applies the functor to each element in the tuple.
 
template<typename... ParentResults>
std::tuple< std::shared_future
< ParentResults >...> 
get_futures (const std::tuple< std::shared_ptr< transwarp::task< ParentResults >>...> &input)
 Returns the futures from the given tuple of tasks.
 
template<typename ParentResultType >
std::vector
< std::shared_future
< ParentResultType > > 
get_futures (const std::vector< std::shared_ptr< transwarp::task< ParentResultType >>> &input)
 Returns the futures from the given vector of tasks.
 
template<typename Result , typename Task , typename... Args>
Result run_task (std::size_t task_id, const std::weak_ptr< Task > &task, Args &&...args)
 Runs the task with the given arguments, hence, invoking the task's functor.
 
template<typename... ParentResults>
void wait_for_all (const std::tuple< std::shared_ptr< transwarp::task< ParentResults >>...> &parents)
 Waits for all parents to finish.
 
template<typename ParentResultType >
void wait_for_all (const std::vector< std::shared_ptr< transwarp::task< ParentResultType >>> &parents)
 Waits for all parents to finish.
 
template<typename Parent >
Parent wait_for_any_impl ()
 
template<typename Parent , typename ParentResult , typename... ParentResults>
Parent wait_for_any_impl (const std::shared_ptr< transwarp::task< ParentResult >> &parent, const std::shared_ptr< transwarp::task< ParentResults >> &...parents)
 
template<typename Parent , typename... ParentResults>
Parent wait_for_any (const std::shared_ptr< transwarp::task< ParentResults >> &...parents)
 Waits for the first parent to finish.
 
template<typename ParentResultType >
std::shared_ptr
< transwarp::task
< ParentResultType > > 
wait_for_any (const std::vector< std::shared_ptr< transwarp::task< ParentResultType >>> &parents)
 Waits for the first parent to finish.
 
template<typename OneResult , typename... ParentResults>
void cancel_all_but_one (const std::shared_ptr< transwarp::task< OneResult >> &one, const std::tuple< std::shared_ptr< transwarp::task< ParentResults >>...> &parents)
 Cancels all tasks but one.
 
template<typename OneResult , typename ParentResultType >
void cancel_all_but_one (const std::shared_ptr< transwarp::task< OneResult >> &one, const std::vector< std::shared_ptr< transwarp::task< ParentResultType >>> &parents)
 Cancels all tasks but one.
 
template<typename... ParentResults>
void decrement_refcount (const std::tuple< std::shared_ptr< transwarp::task< ParentResults >>...> &parents)
 Decrements the refcount of all parents.
 
template<typename ParentResultType >
void decrement_refcount (const std::vector< std::shared_ptr< transwarp::task< ParentResultType >>> &parents)
 Decrements the refcount of all parents.
 
template<typename TaskType , typename Result , typename Task , typename... ParentResults>
Result call (std::size_t task_id, const Task &task, const std::tuple< std::shared_ptr< transwarp::task< ParentResults >>...> &parents)
 Calls the functor of the given task with the results from the tuple of parents. Throws transwarp::task_canceled if the task is canceled. Throws transwarp::task_destroyed in case the task was destroyed prematurely.
 
template<typename TaskType , typename Result , typename Task , typename ParentResultType >
Result call (std::size_t task_id, const Task &task, const std::vector< std::shared_ptr< transwarp::task< ParentResultType >>> &parents)
 Calls the functor of the given task with the results from the vector of parents. Throws transwarp::task_canceled if the task is canceled. Throws transwarp::task_destroyed in case the task was destroyed prematurely.
 
template<typename Functor , typename... ParentResults>
void call_with_each (const Functor &f, const std::tuple< std::shared_ptr< transwarp::task< ParentResults >>...> &t)
 Calls the functor with every element in the tuple.
 
template<typename Functor , typename ParentResultType >
void call_with_each (const Functor &f, const std::vector< std::shared_ptr< transwarp::task< ParentResultType >>> &v)
 Calls the functor with every element in the vector.
 
template<typename Functor >
void assign_task_if (Functor &functor, transwarp::itask &task) noexcept
 Assigns the task to the given functor if the functor is a subclass of transwarp::functor.
 
template<typename ResultType , typename Value >
std::shared_future< ResultType > make_future_with_value (Value &&value)
 Returns a ready future with the given value as its state.
 
std::shared_future< void > make_ready_future ()
 Returns a ready future.
 
template<typename ResultType >
std::shared_future< ResultType > make_future_with_exception (std::exception_ptr exception)
 Returns a ready future with the given exception as its state.
 

Variables

const std::optional< std::string > nullopt_string
 
const std::any any_empty
 

Detailed Description

Detail namespace for internal functionality only.