DelegateMQ
Loading...
Searching...
No Matches
make_tuple_heap.h File Reference

Helper functions for creating dynamic copies of function arguments stored within a tuple. More...

#include <tuple>
#include <list>
#include <memory>
#include <type_traits>
#include "DelegateOpt.h"

Go to the source code of this file.

Classes

struct  dmq::is_shared_ptr< T >
 
struct  dmq::is_shared_ptr< std::shared_ptr< T > >
 
struct  dmq::is_shared_ptr< std::shared_ptr< T > & >
 
struct  dmq::is_shared_ptr< const std::shared_ptr< T > & >
 
struct  dmq::is_shared_ptr< std::shared_ptr< T > * >
 
struct  dmq::is_shared_ptr< const std::shared_ptr< T > * >
 
struct  dmq::is_unique_ptr< T >
 
struct  dmq::is_unique_ptr< std::unique_ptr< T > >
 
class  dmq::heap_arg_deleter_base
 Base class for all deleter's. More...
 
class  dmq::heap_arg_deleter< T >
 Frees heap memory for reference heap argument. More...
 
class  dmq::heap_arg_deleter< T * >
 Frees heap memory for pointer heap argument. More...
 
class  dmq::heap_arg_deleter< T ** >
 Frees heap memory for pointer to pointer heap argument. More...
 

Namespaces

namespace  dmq
 The delegate library namespace.
 

Functions

template<typename Arg , typename... TupleElem>
auto dmq::tuple_append (xlist< std::shared_ptr< heap_arg_deleter_base > > &heapArgs, const std::tuple< TupleElem... > &tup, Arg **arg)
 Append a pointer to pointer argument to the tuple.
 
template<typename Arg , typename... TupleElem>
auto dmq::tuple_append (xlist< std::shared_ptr< heap_arg_deleter_base > > &heapArgs, const std::tuple< TupleElem... > &tup, Arg *arg)
 Append a pointer argument to the tuple.
 
template<typename Arg , typename... TupleElem>
auto dmq::tuple_append (xlist< std::shared_ptr< heap_arg_deleter_base > > &heapArgs, const std::tuple< TupleElem... > &tup, Arg &arg)
 Append a reference argument to the tuple.
 
template<typename... Ts>
auto dmq::make_tuple_heap (xlist< std::shared_ptr< heap_arg_deleter_base > > &heapArgs, std::tuple< Ts... > tup)
 Terminate the template metaprogramming argument loop. This function is called when there are no more arguments to process.
 
template<typename Arg1 , typename... Args, typename... Ts>
auto dmq::make_tuple_heap (xlist< std::shared_ptr< heap_arg_deleter_base > > &heapArgs, std::tuple< Ts... > tup, Arg1 arg1, Args... args)
 Creates a tuple with all tuple elements created on the heap using operator new().
 

Detailed Description

Helper functions for creating dynamic copies of function arguments stored within a tuple.

The template function make_tuple_heap() creates dynamic copies of function arguments, storing them within a tuple for transport through a thread message queue. It supports all types of function arguments, including by value, pointer, pointer-to-pointer, and reference.

The destination thread uses std::apply() to invoke the target function using the tuple of arguments. See Invoke() and DelegateAsyncMsg() in the file DelegateAsync.h for example usage.